I have a number of tables that use the Postgres \"Partitioning\" feature. I want to define a common BEFORE INSERT OF ROW trigger on each table that will 1) dynamically crea
Yes, you can use EXECUTE ... USING in 8.4. For example:
EXECUTE 'INSERT INTO ' || table_name || ' SELECT $1.*' USING NEW;
In lower versions (I've only tested in 8.3), you can use:
EXECUTE 'INSERT INTO ' || table_name || ' SELECT (' || quote_literal(NEW) || '::' || TG_RELID::regclass || ').*';