Re: [SQL] DEFAULT TEXT 'now'

Поиск
Список
Период
Сортировка
От tolik@icomm.ru (Anatoly K. Lasareff)
Тема Re: [SQL] DEFAULT TEXT 'now'
Дата
Msg-id 87ogljz7kd.fsf@tolikus.hq.aaanet.ru
обсуждение исходный текст
Ответ на DEFAULT TEXT 'now'  (Roberto Joao Lopes Garcia <roberto@mha.com.br>)
Список pgsql-sql
>>>>> "RJLG" == Roberto Joao Lopes Garcia <roberto@mha.com.br> writes:

 RJLG> Hi
 RJLG> I╢m have a table like bellow:

 RJLG> CREATE TABLE conex (
 RJLG> id int4 PRIMARY KEY DEFAULT NEXTVAL('seq_conex'),

 RJLG> inicio datetime DEFAULT TEXT 'now',
 RJLG> ultimo datetime DEFAULT TEXT
 RJLG> 'now',
 RJLG> .
 RJLG> .
 RJLG> .
 RJLG> )

 RJLG> insert into conex (ip) values(╢200.200.200.200╢)

 RJLG> Will result every time the same data and time for ╢inicio╢ and ╢ultimo╢!

You must type


inicio datetime DEFAULT TEXT now(),
                             ^^^^^

This is the function which calls every time you insert new record. In
your case 'now' is the constant, which calculates once, when you
create the table.

--
Anatoly K. Lasareff              Email:       tolik@icomm.ru
Senior programmer

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

Предыдущее
От: Howie
Дата:
Сообщение: Re: [SQL] DEFAULT TEXT 'now'
Следующее
От: Herouth Maoz
Дата:
Сообщение: Re: [SQL] transaction-lock?