Re: difference between current_timestamp and now() in quotes - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: difference between current_timestamp and now() in quotes
Date
Msg-id 20090122161646.GG4296@alvh.no-ip.org
Whole thread Raw
In response to difference between current_timestamp and now() in quotes  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Responses Re: difference between current_timestamp and now() in quotes
List pgsql-general
Grzegorz Jaśkiewicz escribió:

> test2=# insert into dupa(a) select 'current_timestamp' from
> generate_series(1,100);
> ERROR:  date/time value "current" is no longer supported
> LINE 1: insert into dupa(a) select 'current_timestamp' from generate...
>                                    ^
> test2=# insert into dupa(a) select 'now()' from generate_series(1,100);
> INSERT 0 100
>
>
> Any ideas why the difference ?

The parser handles CURRENT_TIMESTAMP (and others) specially, and doesn't
recognize it in quotes.  I don't know why 'now()' works; I think it is a
literal of type unknown.  I guess it's expanded to the actual value in
later parsing stages.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: [ADMIN] bytea size limit?
Next
From: Adrian Klaver
Date:
Subject: Re: difference between current_timestamp and now() in quotes