Subject Re: [firebird-support] Re: Making evaluation of UDFs constant across a query
Author Geoff Worboys
Paul Vinkenoog wrote:
> 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 imagine it must be the same thing for most literals, but
the special case of literal 'now' it is certainly surprising.
I noticed it while writing a stored procedure to do some
performance testing. eg:
A = TIMESTAMP 'now';
-- do some time consuming stuff.
B = TIMESTAMP 'now';

From that I got the unexpected result of: (B - A) == 0;
(Sort of like using CURRENT_TIMESTAMP in this sort of situation
but the value of TIMESTAMP 'now' is slightly different to

When I changed the code to
-- do some time consuming stuff.

I got the expected result of (B > A).

> I'd definitely call this a bug, but maybe someone can explain
> why it "should be" this way?

Seems buggish to me. But thought I'd bump the thread to see if
anyone had any explanation for the behaviour.

I was working with FB v2.5 when I saw this, but I imagine the
problem may exist on v2.1 too.

Geoff Worboys
Telesis Computing