Subject RE: [firebird-support] Re: Making evaluation of UDFs constant across a query
Author Paul Lopez
Hi

> -----Original Message-----
> Subject: Re: [firebird-support] Re: Making evaluation of UDFs constant across
> a query
>
> Den 2011-04-05 10:12 skrev Paul Vinkenoog såhär:
> > That very surprising. timestamp '<string>' is supposed to be just
> > shorthand syntax for cast('<string>' as timestamp), so if the result
> > differs, that's rather alarming.
> >
> > I just ran the following query a number of times:
> >
> > select timestamp 'now', cast ('now' as timestamp) from rdb$database
> >
> > About one time in ten, the values differ (the second value being a
> > little higher).
> >
> > If I swap the columns:
> >
> > select cast ('now' as timestamp), timestamp 'now' from rdb$database
> >
> > it's still the CAST (now in the first column) that's sometimes higher.
> >
> > I'd definitely call this a bug, but maybe someone can explain why it
> > "should be" this way?
>
> If it had always been the rightmost expression that was higher I'd say it was
> caused by "non constness" and evaluation order.
>

I use current_timestamp to get consistent values in the transaction.

Eg. Select current_timestamp from rdb$database.