Skip site navigation (1) Skip section navigation (2)

suggestion: fix 'now' -> CURRENT_TIMESTAMP

From: Mark Stosberg <mark(at)summersault(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: suggestion: fix 'now' -> CURRENT_TIMESTAMP
Date: 2005-09-23 14:40:54
Message-ID: slrndj84v7.9sp.mark@simba.summersault.com (view raw or flat)
Thread:
Lists: pgsql-bugs
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/interactive/release-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


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-09-23 15:01:49
Subject: Re: BUG #1905: When a column with the chkpass datatype is used in a where clause it returns invalid results
Previous:From: Trevor TingeyDate: 2005-09-23 04:42:16
Subject: BUG #1905: When a column with the chkpass datatype is used in a where clause it returns invalid results

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group