postgresql/src/test
Tom Lane 4d9ceb0018 Fix bogus tuple-slot management in logical replication UPDATE handling.
slot_modify_cstrings seriously abused the TupleTableSlot API by relying
on a slot's underlying data to stay valid across ExecClearTuple.  Since
this abuse was also quite undocumented, it's little surprise that the
case got broken during the v12 slot rewrites.  As reported in bug #16129
from Ondřej Jirman, this could lead to crashes or data corruption when
a logical replication subscriber processes a row update.  Problems would
only arise if the subscriber's table contained columns of pass-by-ref
types that were not being copied from the publisher.

Fix by explicitly copying the datum/isnull arrays from the source slot
that the old row was in already.  This ends up being about the same
thing that happened pre-v12, but hopefully in a less opaque and
fragile way.

We might've caught the problem sooner if there were any test cases
dealing with updates involving non-replicated or dropped columns.
Now there are.

Back-patch to v10 where this code came in.  Even though the failure
does not manifest before v12, IMO this code is too fragile to leave
as-is.  In any case we certainly want the additional test coverage.

Patch by me; thanks to Tomas Vondra for initial investigation.

Discussion: https://postgr.es/m/16129-a0c0f48e71741e5f@postgresql.org
2019-11-22 11:31:19 -05:00
..
authentication Fix use of term "verifier" 2019-10-12 21:41:59 +02:00
examples Fix example program in docs too (??) 2019-09-18 16:54:11 -03:00
isolation Improve stability of tests for VACUUM (SKIP_LOCKED) 2019-11-16 15:23:12 +09:00
kerberos Save Kerberos and LDAP daemon logs where the buildfarm can find them. 2019-08-06 17:08:07 -04:00
ldap Be more careful about port selection in src/test/ldap/. 2019-09-09 14:21:40 -04:00
locale
mb
modules Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
perl Suppress another CR in program output 2019-09-30 15:51:14 -04:00
recovery Remove temporary WAL and history files at the end of archive recovery 2019-10-02 15:53:07 +09:00
regress Allow ALTER VIEW command to rename the column in the view. 2019-11-21 19:55:13 +09:00
ssl Fix SSL test for libpq connection parameter channel_binding 2019-09-30 13:11:31 +09:00
subscription Fix bogus tuple-slot management in logical replication UPDATE handling. 2019-11-22 11:31:19 -05:00
thread Fix inconsistencies and typos in the tree, take 11 2019-08-19 16:21:39 +09:00
Makefile
README

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

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

isolation/
  Tests for concurrent behavior at the SQL level

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

thread/
  A thread-safety-testing utility used by configure