开发者

Delete row in trigger (PostgreSQL)

I've got a trigger on update, that should delete the row OLD*, but I don't know the table structure. So I've tried using information_schema to grab columns names, but it's really slow.

Is it possible to perform the deletion without knowledge about table structure?

UPD: Trigger should accept row of any table, so trigger function cannot know anything about the table before it will be invoked.

UPD2:

This works well for me:

EXECUTE 'DELETE FROM ' || tablename || ' WHERE ctid=$1' USIN开发者_开发百科G OLD.ctid;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜