It is possible to make something like this in Postgres?
DECLARE variable VARCHAR
BEGIN
variable := TG_RELNAME || '_id';
OLD.variable = 123;
END;
I can't use value of variable as field_name...
ps my version of db is 8.4.
据我所知,唯一的方法就是进行一个额外的查询,例如
execute 'update ' || TG_RELNAME || ' set ' || variable ||' = 123';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.