DEFAULT now() ?

От
ty
Тема
DEFAULT now() ?
Дата
Msg-id
000e01bfa922$03466330$a20efea9@indus
Список
Дерево обсуждения
DEFAULT now() ? "ty" <ty@koi.tsukebe.net>
Re: DEFAULT now() ? Margarita Barvinok <brita@umich.edu>
May someone please show me the necessary code snippets that would allow the value of a column to take the current time ( ala now() ) by default on INSERT?
 
Indicative example:
 
CREATE TABLE foo (
    a INTEGER NOT NULL DEFAULT 0,
    b DATETIME NOT NULL DEFAULT now()
);
 
INSERT INTO foo (a) VALUES (123);
 
What happens here? Well, a row is inserted into table ``foo'' where ``a'' has the value 123 and b holds the date & time of when the create DDL statement was executed. I'm wondering how to get b to have the value of the time whenever any arbitrary insert statement is executed...
 
Ty
 
В списке pgsql-admin по дате отправления
От: Loïc TREGOUËT
Дата:
Сообщение: This Object side of postgresql
От: Raul Carvalho
Дата:
Сообщение: RE: Maintenance
Поиск
Список
Период
Сортировка
Искать
FAQ