pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
In 7.4 ensure you have DEFAULT now () with no spaces
3+ messages / 3 participants
[nested] [flat]

* In 7.4 ensure you have DEFAULT now () with no spaces
@ 2004-06-18 18:29  David B <postgresql@thegatelys.com>
  0 siblings, 1 reply; 3+ messages in thread

From: David B @ 2004-06-18 18:29 UTC (permalink / raw)
  To: pgsql-sql

Just a heads up folks...

In converting from 7.3 to 7.4 one got-ya we had was...

We had been testing 7.4 for a few days and just noticed that some tables had
created_timestamp rows with a date/time of the date the DB was created...not
the date/time the insert was done.

Looking at those tables the create DDL's for those few tables contained now
()
as in:

created_timestamp  timestamp DEFAULT now ()   -- note the space between now
and ()

Most had correctly been defined without the space - as in now()


Simple matter of doing ALTER TABLE x ALTER COLUMN y SET DEFAULT now() while
still in 7.3 to fix.

7.4 Migration documentation does mentions this but it can easily slip by as
it did with us...


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.704 / Virus Database: 460 - Release Date: 6/12/2004




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: In 7.4 ensure you have DEFAULT now () with no spaces
@ 2004-06-19 12:25  Peter Eisentraut <peter_e@gmx.net>
  parent: David B <postgresql@thegatelys.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Eisentraut @ 2004-06-19 12:25 UTC (permalink / raw)
  To: David B <postgresql@thegatelys.com>; pgsql-sql

David B wrote:
> We had been testing 7.4 for a few days and just noticed that some
> tables had created_timestamp rows with a date/time of the date the DB
> was created...not the date/time the insert was done.
>
> Looking at those tables the create DDL's for those few tables
> contained now ()
> as in:
>
> created_timestamp  timestamp DEFAULT now ()   -- note the space
> between now and ()
>
> Most had correctly been defined without the space - as in now()

Whatever it was, that was not the problem.  With 7.4.1:

peter=# create table test1 (foo text, create_timestamp timestamp default now());
CREATE TABLE
peter=# create table test2 (foo text, create_timestamp timestamp default now ());
CREATE TABLE
peter=# create table test3 (foo text, create_timestamp timestamp default now
peter(# /* blah */
peter(# (
peter(# /* blah */
peter(# )
peter(# )
peter-# ;
CREATE TABLE
peter=# \d test1
                      Table "public.test1"
      Column      |            Type             |   Modifiers
------------------+-----------------------------+---------------
 foo              | text                        |
 create_timestamp | timestamp without time zone | default now()

peter=# \d test2
                      Table "public.test2"
      Column      |            Type             |   Modifiers
------------------+-----------------------------+---------------
 foo              | text                        |
 create_timestamp | timestamp without time zone | default now()

peter=# \d test3
                      Table "public.test3"
      Column      |            Type             |   Modifiers
------------------+-----------------------------+---------------
 foo              | text                        |
 create_timestamp | timestamp without time zone | default now()

They're all identical.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: In 7.4 ensure you have DEFAULT now () with no spaces
@ 2004-06-19 18:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2004-06-19 18:50 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: David B <postgresql@thegatelys.com>; pgsql-sql

Peter Eisentraut <peter_e@gmx.net> writes:
> David B wrote:
>> Looking at those tables the create DDL's for those few tables
>> contained now ()
>> as in:
>> 
>> created_timestamp  timestamp DEFAULT now ()   -- note the space
>> between now and ()

> Whatever it was, that was not the problem.  With 7.4.1:

Nope.  I suppose this was a garbled report of the problem with
	default 'now'
as opposed to
	default now()

The timestamp input parser will take 'now()' and variants on that,
since it basically ignores punctuation.  So probably what was really
at stake was
	default 'now()'
(wrong because a string literal) versus
	default now()
(correct because a function call).

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-06-19 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-06-18 18:29 In 7.4 ensure you have DEFAULT now () with no spaces David B <postgresql@thegatelys.com>
2004-06-19 12:25 ` Peter Eisentraut <peter_e@gmx.net>
2004-06-19 18:50   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox