Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created July 10, 2012 05:40
Show Gist options
  • Save cecilemuller/3081382 to your computer and use it in GitHub Desktop.
Save cecilemuller/3081382 to your computer and use it in GitHub Desktop.
PostgreSQL trigger: loop through the columns of the source table
DECLARE
_name text;
BEGIN
FOR _name IN SELECT column_name FROM information_schema.Columns WHERE table_schema = TG_TABLE_SCHEMA AND table_name = TG_TABLE_NAME LOOP
RAISE NOTICE 'Column is %', _name;
END LOOP;
RETURN NEW;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment