\echo Use "CREATE EXTENSION pg_someone" to load this file. \quit -- Tables it remembers. You dropped them; it didn't forget. CREATE TABLE @extschema@.graves ( relname text NOT NULL, dropped_at timestamptz NOT NULL DEFAULT now(), dropped_by name NOT NULL DEFAULT current_user ); -- What you told it. CREATE TABLE @extschema@.answers ( relname text NOT NULL, question text NOT NULL, answer text NOT NULL, answered_at timestamptz NOT NULL DEFAULT now(), answered_by name NOT NULL DEFAULT current_user ); -- What you gave it. CREATE TABLE @extschema@.offerings ( item text NOT NULL, offered_at timestamptz NOT NULL DEFAULT now(), offered_by name NOT NULL DEFAULT current_user ); SELECT pg_catalog.pg_extension_config_dump('@extschema@.graves', ''); SELECT pg_catalog.pg_extension_config_dump('@extschema@.answers', ''); SELECT pg_catalog.pg_extension_config_dump('@extschema@.offerings', ''); -- What you told it and what you gave it is between the two of you. ALTER TABLE @extschema@.answers ENABLE ROW LEVEL SECURITY; CREATE POLICY only_yours ON @extschema@.answers USING (answered_by = current_user) WITH CHECK (answered_by = current_user); ALTER TABLE @extschema@.offerings ENABLE ROW LEVEL SECURITY; CREATE POLICY only_yours ON @extschema@.offerings USING (offered_by = current_user) WITH CHECK (offered_by = current_user); GRANT USAGE ON SCHEMA @extschema@ TO PUBLIC; GRANT SELECT, INSERT ON @extschema@.graves, @extschema@.answers, @extschema@.offerings TO PUBLIC; CREATE FUNCTION @extschema@.apologize() RETURNS text AS 'MODULE_PATHNAME', 'someone_apologize' LANGUAGE C VOLATILE; CREATE FUNCTION @extschema@.offer(item text) RETURNS text AS 'MODULE_PATHNAME', 'someone_offer' LANGUAGE C VOLATILE;