Porting Schema from MySQL

Started by Farhan Khanover 18 years ago2 messagesgeneral
Jump to latest
#1Farhan Khan
farhankhan@google.com

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

#2Michael Glaesemann
grzm@seespotcode.net
In reply to: Farhan Khan (#1)
Re: Porting Schema from MySQL

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