postgresql/src/test
Tom Lane ad77039fad Calculate extraUpdatedCols in query rewriter, not parser.
It's unsafe to do this at parse time because addition of generated
columns to a table would not invalidate stored rules containing
UPDATEs on the table ... but there might now be dependent generated
columns that were not there when the rule was made.  This also fixes
an oversight that rewriteTargetView failed to update extraUpdatedCols
when transforming an UPDATE on an updatable view.  (Since the new
calculation is downstream of that, rewriteTargetView doesn't actually
need to do anything; but before, there was a demonstrable bug there.)

In v13 and HEAD, this leads to easily-visible bugs because (since
commit c6679e4fc) we won't recalculate generated columns that aren't
listed in extraUpdatedCols.  In v12 this bitmap is mostly just used
for trigger-firing decisions, so you'd only notice a problem if a
trigger cared whether a generated column had been updated.

I'd complained about this back in May, but then forgot about it
until bug #16671 from Michael Paul Killian revived the issue.

Back-patch to v12 where this field was introduced.  If existing
stored rules contain any extraUpdatedCols values, they'll be
ignored because the rewriter will overwrite them, so the bug will
be fixed even for existing rules.  (But note that if someone were
to update to 13.1 or 12.5, store some rules with UPDATEs on tables
having generated columns, and then downgrade to a prior minor version,
they might observe issues similar to what this patch fixes.  That
seems unlikely enough to not be worth going to a lot of effort to fix.)

Discussion: https://postgr.es/m/10206.1588964727@sss.pgh.pa.us
Discussion: https://postgr.es/m/16671-2fa55851859fb166@postgresql.org
2020-10-28 13:47:02 -04:00
..
authentication Make new authentication test case more robust. 2020-09-04 21:01:58 -04:00
examples Update copyrights for 2020 2020-01-01 12:21:45 -05:00
isolation Install pg_isolation_regress and isolationtester 2020-10-15 13:09:29 -03:00
kerberos Correct several behavior descriptions in comments. 2020-08-15 20:21:52 -07:00
ldap Fix rare failure in LDAP tests. 2020-08-03 12:49:36 +12:00
locale Use perl warnings pragma consistently 2020-04-13 11:55:45 -04:00
mb Fix MB regression tests for WAL-logging of hash indexes. 2017-03-15 07:25:36 -04:00
modules Rethink recent fix for pg_dump's handling of extension config tables. 2020-10-07 12:51:02 -04:00
perl Use croak instead of die in Perl code when appropriate 2020-10-22 13:41:28 +02:00
recovery Add pg_relation_check_pages() to check on-disk pages of a relation 2020-10-28 12:15:00 +09:00
regress Calculate extraUpdatedCols in query rewriter, not parser. 2020-10-28 13:47:02 -04:00
ssl Correct several behavior descriptions in comments. 2020-08-15 20:21:52 -07:00
subscription Fix query in new test to check tables are synced 2020-10-15 09:48:36 -03:00
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
README Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00

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 (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