Re: I was spoiled by the MySQL timestamp field

Поиск
Список
Период
Сортировка
От will trillich
Тема Re: I was spoiled by the MySQL timestamp field
Дата
Msg-id 20030124085618.GC12814@mail.serensoft.com
обсуждение исходный текст
Ответ на Re: I was spoiled by the MySQL timestamp field  ("Luke Pascoe" <luke.p@kmg.co.nz>)
Список pgsql-general
On Fri, Jan 24, 2003 at 09:57:04AM +1300, Luke Pascoe wrote:
> Why not just use a DEFAULT NOW()?
> ie:
>     CREATE TABLE blah (
>         time    TIMESTAMP NOT NULL DEFAULT NOW()
>         );
>
> I know it works for DATETIME types, don't know about TIMESTAMP
> but I assume it would be the same.

great for INSERT, but rather inert on UPDATE.

create table _gribnif (
    created  timestamp default current_timestamp,
    modified timestamp,
    other    text,
);

create view gribnif ...

create rule gribnif_edit as
on update to gribnif
do instead (
    update _gribnif set
        MODIFIED = CURRENT_TIMESTAMP,
        other    = NEW.other
    where
        id = NEW.id
    ;
);

--
There are 10 kinds of people:
ones that get binary, and ones that don't.

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Looking for a firewall? Do you think smoothwall sucks? You're
probably right... Try the folks at http://clarkconnect.org/ !

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

Предыдущее
От: Oliver Vecernik
Дата:
Сообщение: Re: standard schemas for addresses, others?
Следующее
От: "SZŰCS Gábor"
Дата:
Сообщение: 7.2.1: coalesce double-calls function?