pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Reset relhassubclass upon attaching table as a partition
7+ messages / 1 participants
[nested] [flat]

* pgsql: Reset relhassubclass upon attaching table as a partition
@ 2024-07-24 10:39  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2024-07-24 10:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ed743097555ddf8f3ffd7662a608e6765c6820cf

Modified Files
--------------
src/backend/catalog/heap.c                |  8 ++++++++
src/test/regress/expected/alter_table.out | 10 +++++++++-
src/test/regress/sql/alter_table.sql      |  7 +++++++
3 files changed, 24 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Reset relhassubclass upon attaching table as a partition
@ 2024-07-24 10:39  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2024-07-24 10:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f74fac06c6b134f574eee5145f22a95901d1fa28

Modified Files
--------------
src/backend/catalog/heap.c                |  8 ++++++++
src/test/regress/expected/alter_table.out | 10 +++++++++-
src/test/regress/sql/alter_table.sql      |  7 +++++++
3 files changed, 24 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Reset relhassubclass upon attaching table as a partition
@ 2024-07-24 10:39  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2024-07-24 10:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3dd637f3d5997eb5ef3ccf8787e6fa091d93cd0c

Modified Files
--------------
src/backend/catalog/heap.c                |  8 ++++++++
src/test/regress/expected/alter_table.out | 10 +++++++++-
src/test/regress/sql/alter_table.sql      |  7 +++++++
3 files changed, 24 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Reset relhassubclass upon attaching table as a partition
@ 2024-07-24 10:39  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2024-07-24 10:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fe1d16f66350be01ffe4f316e0820d01f204f91a

Modified Files
--------------
src/backend/catalog/heap.c                |  8 ++++++++
src/test/regress/expected/alter_table.out | 10 +++++++++-
src/test/regress/sql/alter_table.sql      |  7 +++++++
3 files changed, 24 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Reset relhassubclass upon attaching table as a partition
@ 2024-07-24 10:39  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2024-07-24 10:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2b22543a440d2fa72a1918950d6e67dc1e71b271

Modified Files
--------------
src/backend/catalog/heap.c                |  8 ++++++++
src/test/regress/expected/alter_table.out | 10 +++++++++-
src/test/regress/sql/alter_table.sql      |  7 +++++++
3 files changed, 24 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Reset relhassubclass upon attaching table as a partition
@ 2024-07-24 10:39  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2024-07-24 10:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/084814d888b163b20ab26674108363e3ef179769

Modified Files
--------------
src/backend/catalog/heap.c                |  8 ++++++++
src/test/regress/expected/alter_table.out | 10 +++++++++-
src/test/regress/sql/alter_table.sql      |  7 +++++++
3 files changed, 24 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Reset relhassubclass upon attaching table as a partition
@ 2024-07-24 10:39  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2024-07-24 10:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/08b6a9ecf922dc7e4a39bcb88ca568f515a7e93b

Modified Files
--------------
src/backend/catalog/heap.c                |  8 ++++++++
src/test/regress/expected/alter_table.out | 10 +++++++++-
src/test/regress/sql/alter_table.sql      |  7 +++++++
3 files changed, 24 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2024-07-24 10:39 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-24 10:39 pgsql: Reset relhassubclass upon attaching table as a partition Alvaro Herrera <alvherre@alvh.no-ip.org>
2024-07-24 10:39 pgsql: Reset relhassubclass upon attaching table as a partition Alvaro Herrera <alvherre@alvh.no-ip.org>
2024-07-24 10:39 pgsql: Reset relhassubclass upon attaching table as a partition Alvaro Herrera <alvherre@alvh.no-ip.org>
2024-07-24 10:39 pgsql: Reset relhassubclass upon attaching table as a partition Alvaro Herrera <alvherre@alvh.no-ip.org>
2024-07-24 10:39 pgsql: Reset relhassubclass upon attaching table as a partition Alvaro Herrera <alvherre@alvh.no-ip.org>
2024-07-24 10:39 pgsql: Reset relhassubclass upon attaching table as a partition Alvaro Herrera <alvherre@alvh.no-ip.org>
2024-07-24 10:39 pgsql: Reset relhassubclass upon attaching table as a partition Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox