From: | Reg Me Please <regmeplease(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Resp.: difference between current_timestamp and now() in quotes |
Date: | 2009-01-22 18:01:59 |
Message-ID: | 200901221901.59357.regmeplease@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thursday 22 January 2009 18:57:16 Osvaldo Kussama wrote:
> 2009/1/22, Adrian Klaver <aklaver(at)comcast(dot)net>:
> > On Thursday 22 January 2009 8:16:46 am Alvaro Herrera wrote:
> >> 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
> >
> > At least on 8.2 'now()' does not work either at least not in the way I
> > think
> > you want. I get:
> >
> > test=# SELECT 'now()';
> > ?column?
> > ----------
> > now()
> > (1 row)
>
> Table 8-13. Special Date/Time Inputs
> http://www.postgresql.org/docs/current/interactive/datatype-datetime.html
>
> bdteste=# SELECT 'now'::date, 'yesterday'::date, 'today'::date,
> 'tomorrow'::date;
> date | date | date | date
> ------------+------------+------------+------------
> 2009-01-22 | 2009-01-21 | 2009-01-22 | 2009-01-23
> (1 registro)
>
> Osvaldo
'now' != 'now()'
And also the cast matters, IMHO.
--
Fahrbahn ist ein graues Band
weisse Streifen, grüner Rand
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2009-01-22 18:04:05 | Re: difference between current_timestamp and now() in quotes |
Previous Message | Osvaldo Kussama | 2009-01-22 17:57:16 | Resp.: difference between current_timestamp and now() in quotes |