postgresql/src/test/modules
Tom Lane f2c6e94f07 Rethink recent fix for pg_dump's handling of extension config tables.
Commit 3eb3d3e78 was a few bricks shy of a load: while it correctly
set the table's "interesting" flag when deciding to dump the data of
an extension config table, it was not correct to clear that flag
if we concluded we shouldn't dump the data.  This led to the crash
reported in bug #16655, because in fact we'll traverse dumpTableSchema
anyway for all extension tables (to see if they have user-added
seclabels or RLS policies).

The right thing to do is to force "interesting" true in makeTableDataInfo,
and otherwise leave the flag alone.  (Doing it there is more future-proof
in case additional calls are added, and it also avoids setting the flag
unnecessarily if that function decides the table is non-dumpable.)

This investigation also showed that while only the --inserts code path
had an obvious failure in the case considered by 3eb3d3e78, the COPY
code path also has a problem with not having loaded table subsidiary
data.  That causes fmtCopyColumnList to silently return an empty string
instead of the correct column list.  That accidentally mostly works,
which perhaps is why we didn't notice this before.  It would only fail
if the restore column order is different from the dump column order,
which only happens in weird inheritance cases, so it's not surprising
nobody had hit the case with an extension config table.  Nonetheless,
it's a bug, and it goes a long way back, not just to v12 where the
--inserts code path started to have a problem with this.

In hopes of catching such cases a bit sooner in future, add some
Asserts that "interesting" has been set in both dumpTableData and
dumpTableSchema.  Adjust the test case added by 3eb3d3e78 so that it
checks the COPY rather than INSERT form of that bug, allowing it to
detect the longer-standing symptom.

Per bug #16655 from Cameron Daniel.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/16655-5c92d6b3a9438137@postgresql.org
Discussion: https://postgr.es/m/18048b44-3414-b983-8c7c-9165b177900d@2ndQuadrant.com
2020-10-07 12:51:05 -04:00
..
brin perltidy: Add option --nooutdent-long-quotes 2018-04-27 11:37:43 -04:00
commit_ts Rework activation of commit timestamps during recovery 2018-09-26 10:29:20 +09:00
dummy_seclabel doc: Fix naming of SELinux 2020-01-10 09:37:21 +09:00
snapshot_too_old Fix up confusion over how to use EXTRA_INSTALL. 2019-01-11 17:39:46 -05:00
test_bloomfilter Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
test_ddl_deparse Solve cross-version-upgrade testing problem induced by 1fb57af92. 2019-02-09 21:02:06 -05:00
test_extensions Avoid duplicates in ALTER ... DEPENDS ON EXTENSION 2020-03-11 11:04:59 -03:00
test_parser Update copyright for 2018 2018-01-02 23:30:12 -05:00
test_pg_dump Rethink recent fix for pg_dump's handling of extension config tables. 2020-10-07 12:51:05 -04:00
test_predtest Improve predtest.c's handling of cases with NULL-constant inputs. 2018-03-21 18:30:46 -04:00
test_rbtree Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
test_rls_hooks Fix test_rls_hooks to assign expression collations properly. 2018-12-11 11:48:00 -05:00
test_shm_mq Update copyright for 2018 2018-01-02 23:30:12 -05:00
worker_spi Fix worker_spi for new parameter to initialize connection 2018-04-05 19:14:50 +02:00
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
README Add README in src/test and src/test/modules 2016-02-25 21:08:32 -03:00

Test extensions and libraries
=============================

src/test/modules contains PostgreSQL extensions that are primarily or entirely
intended for testing PostgreSQL and/or to serve as example code. The extensions
here aren't intended to be installed in a production server and aren't suitable
for "real work".

Most extensions have their own pg_regress tests or isolationtester specs. Some
are also used by tests elsewhere in the tree.

If you're adding new hooks or other functionality exposed as C-level API this
is where to add the tests for it.