postgresql/contrib/test_decoding/sql
Michael Paquier 173b56f1ef Add flush option to pg_logical_emit_message()
Since its introduction, LogLogicalMessage() (via the SQL interface
pg_logical_emit_message()) has never included a call to XLogFlush(),
causing it to potentially lose messages on a crash when used in
non-transactional mode.  This has come up to me as a problem while
playing with ideas to design a test suite for what has become
039_end_of_wal.pl introduced in bae868caf2 by Thomas Munro, because
there are no direct ways to force a WAL flush via SQL.

The default is false, to not flush messages and influence existing
use-cases where this function could be used.  If set to true, the
message emitted is flushed before returning back to the caller, making
the message durable on crash.  This new option has no effect when using
pg_logical_emit_message() in transactional mode, as the record's flush
is guaranteed by the WAL record generated by the transaction committed.

Two queries of test_decoding are tweaked to cover the new code path for
the flush.

Bump catalog version.

Author: Michael Paquier
Reviewed-by: Andres Freund, Amit Kapila, Fujii Masao, Tung Nguyen, Tomas
Vondra
Discussion: https://postgr.es/m/ZNsdThSe2qgsfs7R@paquier.xyz
2023-10-18 11:24:59 +09:00
..
binary.sql test_decoding: Protect against rare spurious test failures. 2015-09-22 15:39:46 +02:00
ddl.sql Make test_decoding ddl.out shorter 2023-07-24 17:48:06 +02:00
decoding_in_xact.sql Revert "Logical decoding of sequences" 2022-04-07 20:06:36 +02:00
decoding_into_rel.sql Revert "Logical decoding of sequences" 2022-04-07 20:06:36 +02:00
messages.sql Add flush option to pg_logical_emit_message() 2023-10-18 11:24:59 +09:00
permissions.sql Establish conventions about global object names used in regression tests. 2016-07-17 18:42:43 -04:00
prepared.sql Add skip-empty-xacts option to test_decoding for use in the regression tests. 2014-09-01 15:59:44 +02:00
replorigin.sql Fix the misuse of origin filter across multiple pg_logical_slot_get_changes() calls. 2023-09-27 14:32:51 +05:30
rewrite.sql Revert "Logical decoding of sequences" 2022-04-07 20:06:36 +02:00
slot.sql Revert "Logical decoding of sequences" 2022-04-07 20:06:36 +02:00
spill.sql Make contrib/test_decoding regression tests safe for CZ locale. 2016-11-21 20:39:28 -05:00
stats.sql pgstat: add/extend tests for resetting various kinds of stats. 2022-04-07 15:43:43 -07:00
stream.sql Fix assertion during streaming of multi-insert toast changes. 2021-05-27 07:59:43 +05:30
time.sql logical decoding: fix decoding of a commit's commit time. 2016-03-02 23:42:21 -08:00
toast.sql Revert "Logical decoding of sequences" 2022-04-07 20:06:36 +02:00
truncate.sql Revert "Logical decoding of sequences" 2022-04-07 20:06:36 +02:00
twophase.sql test_decoding: Remove unnecessary table in twophase test 2023-10-10 17:49:22 +09:00
twophase_stream.sql Add option to enable two_phase commits via pg_create_logical_replication_slot. 2021-03-03 07:34:11 +05:30
xact.sql Don't propagate a null subtransaction snapshot up to parent transaction. 2016-08-07 13:15:55 -04:00