postgresql/src/test
Masahiko Sawada 48796a98d5 Fix assertion when decoding XLOG_PARAMETER_CHANGE on promoted primary.
When a standby replays an XLOG_PARAMETER_CHANGE record that lowers
wal_level below logical, we invalidate all logical slots in hot
standby mode. However, if this record was replayed while not in hot
standby mode, logical slots could remain valid even after promotion,
potentially causing an assertion failure during WAL record decoding.

To fix this issue, this commit adds a check for hot_standby status
when restoring a logical replication slot on standbys. This check
ensures that logical slots are invalidated when they become
incompatible due to insufficient wal_level during recovery.

Backpatch to v16 where logical decoding on standby was introduced.

Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/CAD21AoABoFwGY_Rh2aeE6tEq3HkJxf0c6UeOXn4VV9v6BAQPSw%40mail.gmail.com
Backpatch-through: 16
2025-02-24 14:03:04 -08:00
..
authentication Add support for OAUTHBEARER SASL mechanism 2025-02-20 16:25:17 +01:00
examples Update copyright for 2025 2025-01-01 11:21:55 -05:00
icu Update copyright for 2025 2025-01-01 11:21:55 -05:00
isolation Add OLD/NEW support to RETURNING in DML queries. 2025-01-16 14:57:35 +00:00
kerberos Update copyright for 2025 2025-01-01 11:21:55 -05:00
ldap Update copyright for 2025 2025-01-01 11:21:55 -05:00
locale Update copyright for 2025 2025-01-01 11:21:55 -05:00
mb Fix MB regression tests for WAL-logging of hash indexes. 2017-03-15 07:25:36 -04:00
modules Remove unstable test suite added by 525392d57 2025-02-22 15:19:23 +09:00
perl Ignore hash's relallvisible when checking pg_upgrade from pre-v10. 2025-02-23 14:16:26 -05:00
postmaster Test postmaster with program_options_handling_ok() et al. 2025-01-26 09:39:05 -08:00
recovery Fix assertion when decoding XLOG_PARAMETER_CHANGE on promoted primary. 2025-02-24 14:03:04 -08:00
regress Remove read/sync fields from pg_stat_wal and GUC track_wal_io_timing 2025-02-24 09:51:56 +09:00
ssl Improve grammar of options for command arrays in TAP tests 2025-01-22 14:47:13 +09:00
subscription Fix a WARNING for data origin discrepancies. 2025-02-21 14:34:40 +05:30
Makefile Add PG_TEST_EXTRA configure option to the Make builds 2024-11-04 14:09:38 +02:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
README Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00

PostgreSQL tests
================

This directory contains a variety of test infrastructure as well as some of the
tests in PostgreSQL. Not all tests are here -- in particular, there are more in
individual contrib/ modules and in src/bin.

Not all these tests get run by "make check". Check src/test/Makefile to see
which tests get run automatically.

authentication/
  Tests for authentication (but see also below)

examples/
  Demonstration programs for libpq that double as regression tests via
  "make check"

isolation/
  Tests for concurrent behavior at the SQL level

kerberos/
  Tests for Kerberos/GSSAPI authentication and encryption

ldap/
  Tests for LDAP-based authentication

locale/
  Sanity checks for locale data, encodings, etc

mb/
  Tests for multibyte encoding (UTF-8) support

modules/
  Extensions used only or mainly for test purposes, generally not suitable
  for installing in production databases

perl/
  Infrastructure for Perl-based TAP tests

recovery/
  Test suite for recovery and replication

regress/
  PostgreSQL's main regression test suite, pg_regress

ssl/
  Tests to exercise and verify SSL certificate handling

subscription/
  Tests for logical replication