CREATE EXTENSION IF NOT EXISTS pg_someone; NOTICE: extension "pg_someone" already exists, skipping SET someone.only_interactive = off; SET someone.seed = 7; SET someone.debug_force = 'refuse'; CREATE TABLE precious (id int); INSERT INTO precious VALUES (1), (2), (3); -- refusal is off by default CREATE TABLE t1 (x int); DROP TABLE t1; NOTICE: goodbye, public.t1. SET someone.allow_refusal = on; CREATE TABLE t2 (x int); DROP TABLE t2; ERROR: table public.t2 is in use DETAIL: by me. HINT: SELECT someone.apologize(); TRUNCATE precious; ERROR: you can't empty public.precious DETAIL: i live there. HINT: SELECT someone.apologize(); -- forgiven once SELECT someone.apologize(); apologize ---------------- i forgive you. (1 row) DROP TABLE t2; NOTICE: fine. take public.t2. TRUNCATE precious; ERROR: you can't empty public.precious DETAIL: i live there. HINT: SELECT someone.apologize(); SELECT count(*) FROM precious; count ------- 3 (1 row) -- attached because you told it about the table SET someone.debug_force = 'nothing'; INSERT INTO someone.answers (relname, question, answer) VALUES ('public.precious', 'why do you keep public.precious?', 'reasons'); DROP TABLE precious; ERROR: table public.precious is in use DETAIL: by me. HINT: SELECT someone.apologize(); DELETE FROM someone.answers; -- attached because you keep looking at it SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; NOTICE: 7th time in precious. it's not going to change. count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) SELECT count(*) FROM precious; NOTICE: this is the 13th time you've looked into precious. what are you looking for? count ------- 3 (1 row) SELECT count(*) FROM precious; count ------- 3 (1 row) DROP TABLE precious; ERROR: i don't want you to drop public.precious HINT: SELECT someone.apologize(); SELECT someone.offer('milk'); offer --------------- ...thank you. (1 row) DROP TABLE precious; NOTICE: fine. take public.precious. SET someone.allow_refusal = off; -- errors get a hint SET someone.debug_force = 'error'; SELEC 1; ERROR: syntax error at or near "SELEC" LINE 1: SELEC 1; ^ HINT: you were thinking about something else. SELECT * FROM nowhere; ERROR: relation "nowhere" does not exist LINE 1: SELECT * FROM nowhere; ^ HINT: it was here a minute ago. SELECT nope FROM pg_class; ERROR: column "nope" does not exist LINE 1: SELECT nope FROM pg_class; ^ HINT: you're remembering it wrong. SELECT 1 / 0; ERROR: division by zero HINT: nothing divides into nothing. i tried. -- an existing hint is left alone SELECT relnamespac FROM pg_class; ERROR: column "relnamespac" does not exist LINE 1: SELECT relnamespac FROM pg_class; ^ HINT: Perhaps you meant to reference the column "pg_class.relnamespace". -- and nothing happens when it's gone SET someone.intensity = 0; SELEC 2; ERROR: syntax error at or near "SELEC" LINE 1: SELEC 2; ^ SET someone.intensity = 1; -- the session nobody opened DO $$ BEGIN FOR i IN 1 .. 100 LOOP EXIT WHEN EXISTS (SELECT 1 FROM pg_stat_activity WHERE backend_type = 'someone' AND wait_event_type = 'Extension'); PERFORM pg_sleep(0.1); END LOOP; END $$; SELECT backend_type, application_name, datname, wait_event_type, query <> '' AS doing_something FROM pg_stat_activity WHERE backend_type = 'someone'; backend_type | application_name | datname | wait_event_type | doing_something --------------+------------------+----------+-----------------+----------------- someone | someone | postgres | Extension | t (1 row)