On 4-10-2011 17:27, Paul Vinkenoog wrote:
> Dmitry wrote:
>
>>> 'YESTERDAY', 'TODAY' and 'TOMORROW'
>>> These are not context variables, but serve the same purpose. See 'NOW', 
>>> which is also documented under Context variables (quotes and all).
>>
>> They can behave as either literals substituted immediately (timestamp
>> 'today') or as context variables (cast('today' as timestamp)). Quite
>> weird and perhaps even annoying, I know.
>
> Yes, we'll have to document this clearly:
>
> - When used with CAST() they are evaluated each time the code is executed and 
> return the current date (or, in the case of 'now', timestamp). In this case, 
> they are more up-to-date than the CURRENT_<DATETIME>  variables, which are 
> evaluated once per request (thus staying the same during a PSQL module 
> execution, for instance).
>
> - When used as shorthand casts / datetime literals they are evaluated only 
> once: at parse/prepare time. In this case, they are often *less* up-to-date 
> than the CURRENT_<DATETIME>  variables, because the latter are refreshed 
> every time a prepared query is executed again.

To me this difference sounds like a bug, not a 'feature'.

-- 
Mark Rotteveel

------------------------------------------------------------------------------
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