Обсуждение: Porting Schema from MySQL

Поиск
Список
Период
Сортировка

Porting Schema from MySQL

От
"Farhan Khan"
Дата:
Hi ... I am porting a db schema from MySQL to postgresql and having problem in defining a column level constraint...

mtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

gives me problem at  ^ON UPDATE ...

Any pointer for implementing this functionality in postgresql ??

Tx .. Farhan

Re: Porting Schema from MySQL

От
Michael Glaesemann
Дата:
On Oct 1, 2007, at 14:54 , Farhan Khan wrote:

> Any pointer for implementing this functionality in postgresql ??

Write a trigger that fires on update and replaces the value with
CURRENT_TIMESTAMP.

You could probably do something like this with rules as well, but the
trigger method is probably more straightforward.

Michael Glaesemann
grzm seespotcode net