Hi

I have no data in a table,


$ dbisql -c "uid=sadb;pwd=sadb;eng=ftnode_sa;links=tcpip(host=10.11.12.17;port=49153);LOG=conn.log;dbn=ftnode_sa" "select * from test1"
x y 


(0 rows)

yet when I run a hash query over the results, I get a hash value:


$ dbisql -c "uid=sadb;pwd=sadb;eng=ftnode_sa;links=tcpip(host=10.11.12.17;port=49153);LOG=conn.log;dbn=ftnode_sa" "select hash(list(hash_val,'' ORDER BY hash_val), 'MD5') as hash_val from (select hash( x||y, 'MD5') as hash_val from (select x,y from test1) as ht) as ht"
hash_val                         
--------------------------------
d41d8cd98f00b204e9800998ecf8427e 

When I perform the same test in PostgreSQL and Oracle then no hash value is returned, which is as expected. Note, when a table does have row data then the hash value matches to Oracle and PostgreSQL, but not so with empty tables.

Could somebody suggest why ?

Thanks

asked 18 Sep, 23:11

bluefrog's gravatar image

bluefrog
183114
accept rate: 0%

edited 18 Sep, 23:12


It has to do with the LIST aggregate you are using as argument for the HASH function.

SELECT LIST(null) by definition returns an empty string, and that prevents HASH from returning null.

(The hash value in your sample is that of an empty string.)

permanent link

answered 19 Sep, 06:08

Volker%20Barth's gravatar image

Volker Barth
31.4k316458676
accept rate: 32%

edited 19 Sep, 07:00

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×7

question asked: 18 Sep, 23:11

question was seen: 64 times

last updated: 19 Sep, 07:00