postgresql/src/test
Dean Rasheed 8d367a44d3 Fix alias matching in transformLockingClause().
When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com
2022-07-07 13:08:08 +01:00
..
authentication
examples
icu Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
isolation Replace PGISOLATIONTIMEOUT with 2 * PG_TEST_TIMEOUT_DEFAULT. 2022-07-01 18:27:50 -07:00
kerberos
ldap Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
locale
mb
modules libpq: Improve idle state handling in pipeline mode 2022-07-05 14:21:20 +02:00
perl Add pg_version() to PostgreSQL::Test::Cluster 2022-05-20 18:29:51 +09:00
recovery Clean up some includes and comments in TAP test scripts 2022-07-07 10:13:01 +09:00
regress Fix alias matching in transformLockingClause(). 2022-07-07 13:08:08 +01:00
ssl Remove unportable test 2022-06-24 13:03:59 +02:00
subscription pgindent run prior to branching v15. 2022-06-30 11:03:03 -04:00
Makefile Add option to use ICU as global locale provider 2022-03-17 11:13:16 +01: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