postgresql/src/backend/catalog
Alvaro Herrera 2b22543a44
Reset relhassubclass upon attaching table as a partition
We don't allow inheritance parents as partitions, and have checks to
prevent this; but if a table _was_ in the past an inheritance parents
and all their children are removed, the pg_class.relhassubclass flag
may remain set, which confuses the partition pruning code (most
obviously, it results in an assertion failure; in production builds it
may be worse.)

Fix by resetting relhassubclass on attach.

Backpatch to all supported versions.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/18550-d5e047e9a897a889@postgresql.org
2024-07-24 12:38:18 +02:00
..
aclchk.c Remove recordExtensionInitPriv[Worker]'s ownerId argument. 2024-06-17 13:00:53 -04:00
catalog.c Cope with inplace update making catcache stale during TOAST fetch. 2024-06-27 19:21:06 -07:00
Catalog.pm Pre-beta mechanical code beautification. 2024-05-14 16:34:50 -04:00
dependency.c Clean out column-level pg_init_privs entries when dropping tables. 2024-06-14 16:20:35 -04:00
genbki.pl Generate syscache info from catalog files 2024-01-23 07:31:06 +01:00
heap.c Reset relhassubclass upon attaching table as a partition 2024-07-24 12:38:18 +02:00
index.c Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX. 2024-06-27 19:21:05 -07:00
indexing.c Revert: Let table AM insertion methods control index insertion 2024-04-11 16:01:30 +03:00
information_schema.sql Revert structural changes to not-null constraints 2024-05-13 11:31:09 +02:00
Makefile Put genbki.pl output into src/include/catalog/ directly 2024-03-14 07:11:21 +01:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
namespace.c Fix missing invalidations for search_path cache. 2024-07-09 11:27:10 -07:00
objectaccess.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
objectaddress.c Remove ObjectClass type 2024-03-26 10:08:56 +01:00
partition.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_aggregate.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_attrdef.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_cast.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_class.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_collation.c Introduce "builtin" collation provider. 2024-03-13 23:33:44 -07:00
pg_constraint.c Revert temporal primary keys and foreign keys 2024-05-16 08:17:46 +02:00
pg_conversion.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_db_role_setting.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_depend.c Fix potential NULL pointer dereference in getIdentitySequence() 2024-05-26 20:58:27 +09:00
pg_enum.c Allow more cases to pass the unsafe-use-of-new-enum-value restriction. 2024-03-24 14:30:29 -04:00
pg_inherits.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_largeobject.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_namespace.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_operator.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_parameter_acl.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_proc.c Separate equalRowTypes() from equalTupleDescs() 2024-03-17 05:58:04 +01:00
pg_publication.c Make the order of the header file includes consistent 2024-03-13 15:07:00 +01:00
pg_range.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_shdepend.c Improve tracking of role dependencies of pg_init_privs entries. 2024-06-17 12:55:10 -04:00
pg_subscription.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
pg_type.c Explicitly list dependent types as extension members in pg_depend. 2024-03-04 14:49:36 -05:00
sql_feature_packages.txt Update SQL features 2023-05-02 10:59:21 +02:00
sql_features.txt JSON_TABLE: Add support for NESTED paths and columns 2024-04-08 16:14:13 +09:00
storage.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
system_functions.sql Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
system_views.sql Reintroduce dead tuple counter in pg_stat_progress_vacuum. 2024-06-14 10:08:15 +09:00
toasting.c Add attstattarget to FormExtraData_pg_attribute 2024-03-17 12:38:27 +01:00