dbTalk Databases Forums  

[BUGS] suggestion: fix 'now' -> CURRENT_TIMESTAMP

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] suggestion: fix 'now' -> CURRENT_TIMESTAMP in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Stosberg
 
Posts: n/a

Default [BUGS] suggestion: fix 'now' -> CURRENT_TIMESTAMP - 09-23-2005 , 04:02 PM






Hello,

I'm in the process of migrating dozens of databases from 7.1 to 8.0.
It's been a great opportunity to become familiar with all the things
that have changed in the meantime.

Of of those things is the meaning 'now', as documented in the 7.4
release notes:
http://www.postgresql.org/docs/8.0/i...lease-7-4.html
( Search for 'now' on the page to find the related docs. ).

When dumping from 7.1 and restoring into 8.0, working code is being
created in the cases I'm looking at, because these construct is put in
the dump file, and then imported verbatim:

date("timestamp"('now'::text))
"timestamp"('now'::text)

This these mean the exact same thing as:

CURRENT_DATE
CURRENT_TIMESTAMP

( But not the same thing as a bare 'now' ).

Why not make the translation on the fly, since using 'now' and
timestamp() are not recommended practices anyway ?

I have seen that PostgreSQL has already taken the liberty to rewrite
"serial" and other schema constructions when they are dumped or
imported, so I see no problem with rewriting code to equivalent, but
better style.

For now I'm doing find & replace on the dump files as a workaround.

Mark


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] suggestion: fix 'now' -> CURRENT_TIMESTAMP - 09-23-2005 , 04:29 PM






Mark Stosberg <mark (AT) summersault (DOT) com> writes:
Quote:
Why not make the translation on the fly, since using 'now' and
timestamp() are not recommended practices anyway ?
Because we can't retroactively fix 7.1.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #3  
Old   
Mark Stosberg
 
Posts: n/a

Default Re: [BUGS] suggestion: fix 'now' -> CURRENT_TIMESTAMP - 09-24-2005 , 10:53 AM



On 2005-09-23, Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> wrote:
Quote:
Mark Stosberg <mark (AT) summersault (DOT) com> writes:
Why not make the translation on the fly, since using 'now' and
timestamp() are not recommended practices anyway ?

Because we can't retroactively fix 7.1.
That fact hadn't escaped me.

I was thinking that in *8*.1, the parsing of "CREATE TABLE" could be
altered to recognize the old syntax and improve it on the fly.

Since the meaning is identical, it seems like a reasonable improvement
to me.

This kind of rewriting is apparently already happening, because when I declare
a column as "serial", it's immediately translated into a different
representation.

test=# create table t (c1 serial);
test=# \d t
Table "public.t"
Column | Type | Modifiers
--------+---------+---------------------------------------------------
c1 | integer | not null default nextval('public.t_c1_seq'::text)


Mark


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.