Created
July 10, 2012 05:37
-
-
Save cecilemuller/3081372 to your computer and use it in GitHub Desktop.
PostgreSQL trigger: loop through the columns of NEW record (requires `hstore` extension)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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