Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created July 10, 2012 05:37
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cecilemuller/3081372 to your computer and use it in GitHub Desktop.
Save cecilemuller/3081372 to your computer and use it in GitHub Desktop.
PostgreSQL trigger: loop through the columns of NEW record (requires `hstore` extension)
DECLARE
r record;
BEGIN
FOR r IN SELECT (each(hstore(NEW))).*
LOOP
RAISE NOTICE '% value is %', r.key, quote_nullable(r.value);
END LOOP;
RETURN NEW;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment