Thread: Porting Schema from MySQL

Porting Schema from MySQL

From
"Farhan Khan"
Date:
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

From
Michael Glaesemann
Date:
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