Re: difference between current_timestamp and now() in quotes

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: GENERAL <pgsql-general(at)postgresql(dot)org>
Subject: Re: difference between current_timestamp and now() in quotes
Date: 2009-01-22 16:16:46
Message-ID: 20090122161646.GG4296@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2009-01-22 17:03:33 Re: difference between current_timestamp and now() in quotes
Previous Message Albe Laurenz 2009-01-22 16:08:32 Re: [GENERAL] bytea size limit?