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

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: [HACKERS] create table and default 'now' problem ?
Дата
Msg-id 37E72573.4EB4C364@alumni.caltech.edu
обсуждение исходный текст
Ответ на Re: [HACKERS] create table and default 'now' problem ?  (The Hermit Hacker <scrappy@hub.org>)
Список 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@alumni.caltech.edu
South Pasadena, California


В списке pgsql-hackers по дате отправления:

Предыдущее
От: José Soares
Дата:
Сообщение: Re: [HACKERS] create table and default 'now' problem ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] create table and default 'now' problem ?