Thomas and all,

> I am also unsure about documenting 'TODAY''s usefulness for measuring time 
> intervals in procedures, but I left it in anyway.

It doesn't really measure (clock) time intervals, but it should notice the 
passing of a day.

However, I just had a surprise: within a PSQL module, "timestamp 'now'" and 
"date 'today'" stayed the same throughout the execution (I built in a delay 
loop and made sure the system day changed while the module ran).

What's more: in a prepared statement - an EXECUTE BLOCK with a counter as input 
param - those values stayed the same even if I re-executed the block minutes 
later, regardless whether I changed the input param or not. Now *that*'s some 
caching! ;-)

I don't know if this _always_ happens with shorthand casts or if it is an 
optimizer thing that may or may not occur depending on the circumstances.

When I changed from shorthand to full casts, the behaviour was as documented, 
i.e. time and day progressed.

I also noticed that, in the case of shorthand casts, the cached date/time 
values are taken at prepare time, not at the time the first shorthand cast is 
encountered or even the start time of the first execution.

With CURRENT_TIMESTAMP and friends, it's another thing: they are (as 
documented) evaluated once per module execution (don't know yet if at start or 
at first encounter), not at prepare time.

Will do some more testing tomorrow afternoon. Whatever the outcome, we'll have 
to adapt the documentation at this point.


Cheers,
Paul Vinkenoog

PS: Not surprisingly, 'YESTERDAY' and 'TOMORROW' behave the same as 'TODAY' and 
'NOW' in this respect.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Firebird-docs mailing list
Firebird-docs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-docs

Reply via email to