Bruce Momjian <br...@momjian.us> writes:
> Does anyone like this patch?  I changed now()::timestamptz to
> now::timestamptz.

No, because you clearly didn't bother to test it:

regression=# select now::timestamptz;
ERROR:  column "now" does not exist
LINE 1: select now::timestamptz;
               ^

Also "a string that returns a volatile result once cast to a data
type" is pretty meaningless to my eyes, not least because the real
problem is that the construct is *not* volatile, but gets folded to
a constant at CREATE TABLE time.

The distinction we want to draw is that 'now'::timestamptz is a
parse-time constant and so is not equivalent to the function call
now() (which already produces timestamptz, so no need for a cast).
This is already covered at the end of section 9.9.5 Current Date/Time,
although I have no objection to repeating it in some form in the
CREATE TABLE docs.

                        regards, tom lane


Reply via email to