postgresql/src/test
Tom Lane 7f90a5dc36 Account for optimized MinMax aggregates during SS_finalize_plan.
We are capable of optimizing MIN() and MAX() aggregates on indexed
columns into subqueries that exploit the index, rather than the normal
thing of scanning the whole table.  When we do this, we replace the
Aggref node(s) with Params referencing subquery outputs.  Such Params
really ought to be included in the per-plan-node extParam/allParam
sets computed by SS_finalize_plan.  However, we've never done so
up to now because of an ancient implementation choice to perform
that substitution during set_plan_references, which runs after
SS_finalize_plan, so that SS_finalize_plan never sees these Params.

The cleanest fix would be to perform a separate tree walk to do
these substitutions before SS_finalize_plan runs.  That seems
unattractive, first because a whole-tree mutation pass is expensive,
and second because we lack infrastructure for visiting expression
subtrees in a Plan tree, so that we'd need a new function knowing
as much as SS_finalize_plan knows about that.  I also considered
swapping the order of SS_finalize_plan and set_plan_references,
but that fell foul of various assumptions that seem tricky to fix.
So the approach adopted here is to teach SS_finalize_plan itself
to check for such Aggrefs.  I refactored things a bit in setrefs.c
to avoid having three copies of the code that does that.

Back-patch of v17 commits d0d44049d and 779ac2c74.  When d0d44049d
went in, there was no evidence that it was fixing a reachable bug,
so I refrained from back-patching.  Now we have such evidence.

Per bug #18465 from Hal Takahara.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18465-2fae927718976b22@postgresql.org
Discussion: https://postgr.es/m/2391880.1689025003@sss.pgh.pa.us
2024-05-18 14:31:35 -04:00
..
authentication Make new authentication test case more robust. 2020-09-04 21:01:59 -04:00
examples Update copyrights for 2020 2020-01-01 12:21:45 -05:00
isolation Remove test from commit fa2e874946. 2023-08-10 10:26:46 -07:00
kerberos Don't clobber test exit code at cleanup in LDAP/Kerberors tests 2024-04-07 20:26:22 +03:00
ldap Don't clobber test exit code at cleanup in LDAP/Kerberors tests 2024-04-07 20:26:22 +03: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 Allow new role 'regress_dump_login_role' to log in under SSPI. 2023-11-14 00:31:39 -05:00
perl Don't trust unvalidated xl_tot_len. 2023-09-23 10:29:44 +12:00
recovery Fix edge-case for xl_tot_len broken by bae868ca. 2023-09-26 10:54:47 +13:00
regress Account for optimized MinMax aggregates during SS_finalize_plan. 2024-05-18 14:31:35 -04:00
ssl Fix failures in SSL tests caused by out-of-tree keys and certificates 2022-03-22 13:21:39 +09:00
subscription Ignore generated columns during apply of update/delete. 2023-03-23 11:21:13 +05:30
thread Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Revert "Allow on-line enabling and disabling of data checksums" 2018-04-09 19:03:42 +02:00
README Add TAP tests for password-based authentication methods. 2017-03-17 11:34:16 +02: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

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