Re: In 7.4 ensure you have DEFAULT now () with no spaces

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "David B" <postgresql(at)thegatelys(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: In 7.4 ensure you have DEFAULT now () with no spaces
Date: 2004-06-19 12:25:43
Message-ID: 200406191425.43379.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-06-19 18:39:08 Re: plpgsql - Insert from a record variable?
Previous Message V i s h a l Kashyap @ [Sai Hertz And Control Systems] 2004-06-19 10:20:05 Re: case stement when null