Hi!

I don't known a reason, but I feel that very few people uses date/time
(and timestamp) literals.

In Firebird generally people use casts to transform a string to these
types. In Oracle, they use TO_DATE.

It's much better to use DATE '2018-01-01', TIME '10:00:00' and TIMESTAMP
'2018-01-01 10:00:00'.

They are literals (constants) and are parsed at compile time.

However, I found a very weird situation with some literals.

We may use things as DATE 'TODAY', TIME 'NOW' and TIMESTAMP 'NOW'.

And different than these strings used in CAST, these are literais
(evaluated at compile time).

So if you create a procedure/function with them, they value are
refreshed every time you recompile (from SQL) the routine, but never
refreshed when you run it.

Also imagine a compiled statement cache (implementation detail), a
"select timestamp 'now' from rdb$database" will give stalled results.

For me this is more a bug than a feature.

I think these expressions should better generate the equivalent of
CAST(string as type).


Adriano

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to