Subject | Re: [firebird-support] Re: Making evaluation of UDFs constant across a query |
---|---|
Author | Helen Borrie |
Post date | 2011-03-21T22:57:28Z |
At 08:08 AM 22/03/2011, Michael Ludwig wrote:
Test them separately. Hint, write a SP that processes two statements like your example. Note also that, in Fb 1.5 or a dialect 1 database, the differences may be invisible, since current_timestamp and 'NOW' both return sub-seconds as .0000 and most simple SELECTs like your example are sub-second in duration. Check the v.2.0 release notes for the changes (improvements) introduced in v.2.0.
./heLen
./heLen
>That should not be surprising. You have a single statement there in a single transaction.
>> CURRENT_TIMESTAMP context is the CURRENT_TRANSACTION
>> Date literal 'NOW' context is the executing statement
>> UDF GetExactTimestamp() refreshes with each call to the function
>
>I don't get it.
>
> select
> current_timestamp,
> cast( 'now' as timestamp )
> from rdb$database;
>
>Both values are always identical, as I thought.
>I (mis)understood your statement as saying that CURRENT_TIMESTAMPYes, it does.
>remains constant during a transaction (which of course it doesn't)
>whereas 'NOW' remains constant during a single executing statementCorrect.
>(which it probably does).
>So what is the *context* you're referring to in the above statementAs indicated already.
>and how do CURRENT_TIMESTAMP and 'NOW' differ in that respect?
Test them separately. Hint, write a SP that processes two statements like your example. Note also that, in Fb 1.5 or a dialect 1 database, the differences may be invisible, since current_timestamp and 'NOW' both return sub-seconds as .0000 and most simple SELECTs like your example are sub-second in duration. Check the v.2.0 release notes for the changes (improvements) introduced in v.2.0.
./heLen
./heLen