Converting mysql "on update" to postgres "rule"
От | Edward Blake |
---|---|
Тема | Converting mysql "on update" to postgres "rule" |
Дата | |
Msg-id | eae776d40803251151t4ec96531ka5ba0976c064dba6@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Converting mysql "on update" to postgres "rule"
Re: Converting mysql "on update" to postgres "rule" Re: Converting mysql "on update" to postgres "rule" Re: Converting mysql "on update" to postgres "rule" |
Список | pgsql-general |
Thanks to everyone who's helped me before.
I'm trying to create the following mysql table in postgres:
CREATE TABLE visit (
data1 varchar(30) NOT NULL,
data2 varchar(30) DEFAULT NULL,
data3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
Thus far, I've been able to get this far:
CREATE TABLE visit (
data1 varchar(30) NOT NULL,
data2 varchar(30) DEFAULT NULL,
data3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE RULE timestamp_update AS ON UPDATE TO visit
DO ALSO
UPDATE vist
SET data3 = CURRENT_TIMESTAMP;
I've tried multiple iterations of how to accomplish this and keep getting stuck. With the one above, postgres yells and says:
ERROR: infinite recursion detected in rules for relation "visit"
Any ideas?
I'm trying to create the following mysql table in postgres:
CREATE TABLE visit (
data1 varchar(30) NOT NULL,
data2 varchar(30) DEFAULT NULL,
data3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
Thus far, I've been able to get this far:
CREATE TABLE visit (
data1 varchar(30) NOT NULL,
data2 varchar(30) DEFAULT NULL,
data3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE RULE timestamp_update AS ON UPDATE TO visit
DO ALSO
UPDATE vist
SET data3 = CURRENT_TIMESTAMP;
I've tried multiple iterations of how to accomplish this and keep getting stuck. With the one above, postgres yells and says:
ERROR: infinite recursion detected in rules for relation "visit"
Any ideas?
В списке pgsql-general по дате отправления: