Dynamically access column value in record
问题 Is it possible to dynamically access a column value from a record by its name? I'm writing a trigger function that executes a dynamic SQL command and I would like to dynamically extract a column value from a NEW record by column name. Here's a simplified example of what I'm trying to do: $$ DECLARE command text := 'UPDATE $1 SET $2 = $3'; myColumn := 'votes' BEGIN EXECUTE command using 'anotherTable', myColumn, NEW.myColumn; END $$ 回答1: That's possible , but the USING clause of EXECUTE can