From: | Dmitry Tkach <dmitry(at)openratings(dot)com> |
---|---|
To: | mel(at)gmanmi(dot)tv |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: help: now() + N is now failing! |
Date: | 2003-07-29 14:33:09 |
Message-ID: | 3F2685A5.9060901@openratings.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Yeah... Looks weird.
For some reason, even date_pli(now(), 2) doesn't work any more - you
have to do date_pli(now()::date,2)
I guess, the now()+2 has the same problem - for some reason, it fails to
coerce timestamptz into date automatically :-(
Why is that? There is only one function called date_pli(), and there is
an unambigous conversion date(timestamptz)... Why does it now force the
user to cast explicitly???
Dima
Mel Jamero wrote:
>help. does anybody know how, without using date_pli, i can make now() + N
>work in newer versions of postgres?
>
>we ported our old data to a new db.
>
>VALUE = NULL doesn't work anymore, had to use IS NULL. had to modify
>hundred liners of scripts :(
>
>i don't wanna go about modifying all the scripts again to modify now() + N
>in my old scripts.
>
>i've been a victim of backwards compatibility issue and late side-effect of
>my DB infancy sydrome years ago :(
>
>TIA!
>
>--OLD postgres
>
>old_postgres=# select now();
> now
>------------------------
> 2003-07-29 16:11:11+08
>(1 row)
>
>old_postgres=# select now() + 2;
> ?column?
>------------
> 2003-07-31
>(1 row)
>
>-- NEW postgres
>
>new_postgres=# select now();
> now
>-------------------------------
> 2003-07-29 16:31:39.494534+08
>(1 row)
>
>new_postgres=# select now() + 2;
>ERROR: Unable to identify an operator '+' for types 'timestamp with time
>zone' and 'integer'
> You will have to retype this query using an explicit cast
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-07-29 14:47:08 | Re: any idea regarding this error? |
Previous Message | Tom Lane | 2003-07-29 14:29:43 | Re: help: now() + N is now failing! |