diff options
author | Alvaro Herrera | 2018-08-01 21:39:07 +0000 |
---|---|---|
committer | Alvaro Herrera | 2018-08-01 21:47:15 +0000 |
commit | c40489e449ea08e154cd62fa055785873f7bdac8 (patch) | |
tree | c97f4789aa534001c9ca479d0a89570066375e87 /contrib/test_decoding | |
parent | 91bc213d90c5a8f2b2e162d4ecf09b9301027ceb (diff) |
Fix logical replication slot initialization
This was broken in commit 9c7d06d60680, which inadvertently gave the
wrong value to fast_forward in one StartupDecodingContext call. Fix by
flipping the value. Add a test for the obvious error, namely trying to
initialize a replication slot with an nonexistent output plugin.
While at it, move the CreateDecodingContext call earlier, so that any
errors are reported before sending the CopyBoth message.
Author: Dave Cramer <davecramer@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CADK3HHLVkeRe1v4P02-5hj55H3_yJg3AEtpXyEY5T3wuzO2jSg@mail.gmail.com
Diffstat (limited to 'contrib/test_decoding')
-rw-r--r-- | contrib/test_decoding/expected/slot.out | 2 | ||||
-rw-r--r-- | contrib/test_decoding/sql/slot.sql | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/contrib/test_decoding/expected/slot.out b/contrib/test_decoding/expected/slot.out index 2737a8a301b..523621a705d 100644 --- a/contrib/test_decoding/expected/slot.out +++ b/contrib/test_decoding/expected/slot.out @@ -30,6 +30,8 @@ SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_t2', 'tes init (1 row) +SELECT pg_create_logical_replication_slot('foo', 'nonexistent'); +ERROR: could not access file "nonexistent": No such file or directory -- here we want to start a new session and wait till old one is gone select pg_backend_pid() as oldpid \gset \c - diff --git a/contrib/test_decoding/sql/slot.sql b/contrib/test_decoding/sql/slot.sql index 24cdf7155d7..c8d08f85417 100644 --- a/contrib/test_decoding/sql/slot.sql +++ b/contrib/test_decoding/sql/slot.sql @@ -9,6 +9,8 @@ SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_p', 'test SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_t2', 'test_decoding', true); +SELECT pg_create_logical_replication_slot('foo', 'nonexistent'); + -- here we want to start a new session and wait till old one is gone select pg_backend_pid() as oldpid \gset \c - |