pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Don't mark partitioned indexes invalid unnecessarily
2+ messages / 1 participants
[nested] [flat]

* pgsql: Don't mark partitioned indexes invalid unnecessarily
@ 2018-12-05 16:38 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2018-12-05 16:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't mark partitioned indexes invalid unnecessarily

When an indexes is created on a partitioned table using ONLY (don't
recurse to partitions), it gets marked invalid until index partitions
are attached for each table partition.  But there's no reason to do this
if there are no partitions ... and moreover, there's no way to get the
index to become valid afterwards, because all partitions that get
created/attached get their own index partition already attached to the
parent index, so there's no chance to do ALTER INDEX ... ATTACH PARTITION
that would make the parent index valid.

Fix by not marking the index as invalid to begin with.

This is very similar to 9139aa19423b, but the pg_dump aspect does not
appear to be relevant until we add FKs that can point to PKs on
partitioned tables.  (I tried to cause the pg_upgrade test to break by
leaving some of these bogus tables around, but wasn't able to.)

Making this change means that an index that was supposed to be invalid
in the insert_conflict regression test is no longer invalid; reorder the
DDL so that the test continues to verify the behavior we want it to.

Author: Álvaro Herrera
Reviewed-by: Amit Langote
Discussion: https://postgr.es/m/20181203225019.2vvdef2ybnkxt364@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/71a05b22326088ce59c7ed12cc4160adec634940

Modified Files
--------------
src/backend/commands/indexcmds.c              | 12 +++++++++++-
src/test/regress/expected/insert_conflict.out |  2 +-
src/test/regress/sql/insert_conflict.sql      |  2 +-
3 files changed, 13 insertions(+), 3 deletions(-)



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

* pgsql: Don't mark partitioned indexes invalid unnecessarily
@ 2018-12-05 16:38 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2018-12-05 16:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't mark partitioned indexes invalid unnecessarily

When an indexes is created on a partitioned table using ONLY (don't
recurse to partitions), it gets marked invalid until index partitions
are attached for each table partition.  But there's no reason to do this
if there are no partitions ... and moreover, there's no way to get the
index to become valid afterwards, because all partitions that get
created/attached get their own index partition already attached to the
parent index, so there's no chance to do ALTER INDEX ... ATTACH PARTITION
that would make the parent index valid.

Fix by not marking the index as invalid to begin with.

This is very similar to 9139aa19423b, but the pg_dump aspect does not
appear to be relevant until we add FKs that can point to PKs on
partitioned tables.  (I tried to cause the pg_upgrade test to break by
leaving some of these bogus tables around, but wasn't able to.)

Making this change means that an index that was supposed to be invalid
in the insert_conflict regression test is no longer invalid; reorder the
DDL so that the test continues to verify the behavior we want it to.

Author: Álvaro Herrera
Reviewed-by: Amit Langote
Discussion: https://postgr.es/m/20181203225019.2vvdef2ybnkxt364@alvherre.pgsql

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/37798a8e83db978c7d92f2491935c6ba96b95fbc

Modified Files
--------------
src/backend/commands/indexcmds.c              | 12 +++++++++++-
src/test/regress/expected/insert_conflict.out |  2 +-
src/test/regress/sql/insert_conflict.sql      |  2 +-
3 files changed, 13 insertions(+), 3 deletions(-)



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


end of thread, other threads:[~2018-12-05 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 16:38 pgsql: Don't mark partitioned indexes invalid unnecessarily Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-05 16:38 pgsql: Don't mark partitioned indexes invalid unnecessarily 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