Unable to update a record with a trigger using a dynamic column on a PostgreSQL DB
In PostgreSQL, every UPDATE will create a new row version. An attempt to modify the old row version in a BEFORE trigger won't work.

The new table row version that is about to be added to the database is available in the NEW variable of the trigger. You have to modify NEW in order to modify the new table row.

Dynamic modification of NEW is what you need, but this is hard to impossible in PL/pgSQL.

I suggest that you use a PL/Python trigger instead:

CREATE OR REPLACE FUNCTION update_lastchange() RETURNS trigger
   LANGUAGE plpythonu AS
'TD["new"][TD["args"][0] + "_lastchange"] = plpy.execute("SELECT current_timestamp")[0]["current_timestamp"]
return "MODIFY"';

CREATE TRIGGER update_lastchange
   BEFORE UPDATE ON content
   FOR EACH ROW EXECUTE FUNCTION update_lastchange('cnt');


What does the trigger do?

It runs SELECT current_timestamp on the database to get the current timestamp and retrieves that value from the result set (the column labeled current_timestamp from the first row (row 0) of the result set).

Then it stores that value in the appropriate entry of the TD["new"] mapping that contains NEW in PL/Python.

Finally, "MODIFY" is returned to indicate that the UPDATE should proceed.