sagarswathi / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

Incorrect results when comparing with CURRENT_TIMESTAMP #379

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Selecting a result seems to be cached. This leads under some conditions to 
invalid results if you do the same query again and the where clause contains a 
comparision with CURRENT_TIMESTAMP (maybe also with CURRENT_DATE, CURRENT_TIME, 
now()...).

If you a table has a row (e.g mytimestamp) with values in the future and you do 
a select like
   select * form T1 where MYTIMESTAMP < CURRENT_TIMESTAMP;
it always returns the same result set, event if more rows values of MYTIMESTAMP 
are less than CURRENT_TIMESTAMP in subsequent queries. If you do a commit 
between the querys, everthing works well.

I attached a test for this issue.

Best regards
 Andreas

Original issue reported on code.google.com by andreas....@gmail.com on 17 Feb 2012 at 8:19

GoogleCodeExporter commented 8 years ago
Please use StackOverflow or send a mail to the H2 Google Group. Don't open new 
issues.

See the docs http://h2database.com/html/functions.html#current_timestamp
"This method always returns the same value within a transaction."

Original comment by thomas.t...@gmail.com on 17 Feb 2012 at 8:27