postgresql/src
Tom Lane 2a42c1c51d Fix subtly-incorrect matching of parent and child partitioned indexes.
When creating a partitioned index, DefineIndex tries to identify
any existing indexes on the partitions that match the partitioned
index, so that it can absorb those as child indexes instead of
building new ones.  Part of the matching is to compare IndexInfo
structs --- but that wasn't done quite right.  We're comparing
the IndexInfo built within DefineIndex itself to one made from
existing catalog contents by BuildIndexInfo.  Notably, while
BuildIndexInfo will run index expressions and predicates through
expression preprocessing, that has not happened to DefineIndex's
struct.  The result is failure to match and subsequent creation
of duplicate indexes.

The easiest and most bulletproof fix is to build a new IndexInfo
using BuildIndexInfo, thereby guaranteeing that the processing done
is identical.

While here, let's also extract the opfamily and collation data
from the new partitioned index, removing ad-hoc logic that
duplicated knowledge about how those are constructed.

Per report from Christophe Pettus.  Back-patch to v11 where
we invented partitioned indexes.

Richard Guo and Tom Lane

Discussion: https://postgr.es/m/8864BFAA-81FD-4BF9-8E06-7DEB8D4164ED@thebuild.com
2022-08-18 12:12:03 -04:00
..
backend Fix subtly-incorrect matching of parent and child partitioned indexes. 2022-08-18 12:12:03 -04:00
bin pg_upgrade: Fix some minor code issues 2022-08-13 00:11:01 +02:00
common Fix get_dirent_type() for symlinks on MinGW/MSYS. 2022-07-28 14:27:28 +12:00
fe_utils Fix minor memory leaks in psql's tab completion. 2022-07-22 10:53:26 -04:00
include Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW 2022-08-17 14:55:24 +09:00
interfaces Add missing bad-PGconn guards in libpq entry points. 2022-08-15 15:40:07 -04:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Translation updates 2022-08-08 12:39:52 +02:00
port Fix get_dirent_type() for Windows junction points. 2022-07-22 16:57:36 +12:00
template Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
test Fix subtly-incorrect matching of parent and child partitioned indexes. 2022-08-18 12:12:03 -04:00
timezone Update time zone data files to tzdata release 2022a. 2022-05-05 14:54:53 -04:00
tools expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size. 2022-07-05 11:26:27 -07:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Increase minimum supported GNU make version to 3.81. 2022-07-23 12:12:42 -04:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00