Subject Re: [firebird-support] Re: Making evaluation of UDFs constant across a query
Author Paul Vinkenoog
Geoff Worboys wrote:

> Regarding
> current_timestamp
> vs cast('now' as timestamp)
> vs timestamp 'now'
>
> I just hit this for myself. After reading the FB v2.1 release
> notes I thought I understood that
> timestamp 'now'
> was the equivalent of
> cast('now' as timestamp)
>
> but after using it in a few places I found it is definitely not
> the same.

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?


Paul Vinkenoog