Skip to content

Instantly share code, notes, and snippets.

@rupurt
Created December 1, 2016 19:44
Show Gist options
  • Save rupurt/5ac6c2c729a85ddbb11f2c70551ebe0a to your computer and use it in GitHub Desktop.
Save rupurt/5ac6c2c729a85ddbb11f2c70551ebe0a to your computer and use it in GitHub Desktop.
DROP TABLE IF EXISTS test;
CREATE TABLE test();
CREATE OR REPLACE FUNCTION dummy_tg() RETURNS TRIGGER
LANGUAGE plpgsql AS $$ BEGIN END; $$;
BEGIN;
CREATE TRIGGER blah BEFORE INSERT ON test FOR EACH ROW EXECUTE PROCEDURE dummy_tg();
SELECT * FROM pg_locks
WHERE pid = pg_backend_pid()
AND relation = 'test'::regclass;
ROLLBACK;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment