Created
July 24, 2018 11:55
-
-
Save swedishborgie/454275c7a668ae8b42150d1aba79de12 to your computer and use it in GitHub Desktop.
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
--On Master | |
CREATE TABLE test (id SERIAL PRIMARY KEY, msg TEXT NOT NULL); | |
CREATE PUBLICATION testpub FOR TABLE test | |
--On Replica | |
CREATE TABLE test (id SERIAL PRIMARY KEY, msg TEXT NOT NULL); | |
CREATE SUBSCRIPTION testsub CONNECTION 'host=<host> user=<user> password=<test>' PUBLICATION testpub; | |
CREATE OR REPLACE FUNCTION notify_channel() RETURNS trigger AS $$ | |
BEGIN | |
RAISE LOG 'Notify Triggered'; | |
PERFORM pg_notify('testchannel', 'Testing'); | |
RETURN NEW; | |
END; | |
$$ LANGUAGE 'plpgsql'; | |
DROP TRIGGER queue_insert ON TEST; | |
CREATE TRIGGER queue_insert AFTER INSERT ON test FOR EACH ROW EXECUTE PROCEDURE notify_channel(); | |
ALTER TABLE test ENABLE ALWAYS TRIGGER queue_insert; | |
LISTEN testchannel; | |
--Execute insert on master: | |
INSERT INTO test (msg) VALUES ('test'); | |
--Log from replica from postgresql-10-main.log: | |
--2018-07-24 07:45:15.705 EDT [6701] LOG: 00000: Notify Triggered | |
--2018-07-24 07:45:15.705 EDT [6701] CONTEXT: PL/pgSQL function notify_channel() line 3 at RAISE | |
--2018-07-24 07:45:15.705 EDT [6701] LOCATION: exec_stmt_raise, pl_exec.c:3337 |
Yep! That's the one.
Thanks! Sadly I still can reproduce it on 14beta1
postgres version (compiled from source).
Yep, the bug is still open. There's a patch available in the comment chain which worked, but it wasn't accepted.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @swedishborgie. Is this for reproducing this bug https://www.postgresql.org/message-id/153243441449.1404.2274116228506175596%40wrigleys.postgresql.org ?