Re: [HACKERS] create table and default 'now' problem ?

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: The Hermit Hacker <scrappy(at)hub(dot)org>
Cc: Mike Mascari <mascarim(at)yahoo(dot)com>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] create table and default 'now' problem ?
Date: 1999-09-21 06:28:03
Message-ID: 37E72573.4EB4C364@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Why the 'create function'?
> hardware=> insert into test_table values ( 1 ) ;
> hardware=> select * from test_table;
> 1|Tue Sep 21 02:00:50 1999 EDT

Right. And if you run the insert again, you'll see the exact same time
inserted. But if you force 'now' to be a true string type (rather than
leaving it unspecified) then the evaluation will happen at insert
time.

The behavior is "correct" for most values of most types, but falls
down when a seemingly constant value, like a fixed string N-O-W,
actually is not a constant but rather something which changes value
depending on when the query runs. In the long run, we need to have a
new attribute associated with data types which tells whether constants
have that nature (most won't). In the meantime, this is a feature, and
has been since Vadim (?) implemented DEFAULT ;)

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 1999-09-21 06:50:59 Re: [HACKERS] Re: HISTORY for 6.5.2
Previous Message The Hermit Hacker 1999-09-21 06:14:40 Re: [HACKERS] Re: HISTORY for 6.5.2