pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix subtly-incorrect matching of parent and child partitioned in
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix subtly-incorrect matching of parent and child partitioned in
@ 2022-08-18 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-08-18 16:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/commands/indexcmds.c       | 23 ++++++++----
src/test/regress/expected/indexing.out | 66 +++++++++++++++++++++++++++++++++-
src/test/regress/sql/indexing.sql      | 15 +++++++-
3 files changed, 96 insertions(+), 8 deletions(-)



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

* pgsql: Fix subtly-incorrect matching of parent and child partitioned in
@ 2022-08-18 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-08-18 16:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/commands/indexcmds.c       | 23 ++++++++----
src/test/regress/expected/indexing.out | 66 +++++++++++++++++++++++++++++++++-
src/test/regress/sql/indexing.sql      | 15 +++++++-
3 files changed, 96 insertions(+), 8 deletions(-)



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

* pgsql: Fix subtly-incorrect matching of parent and child partitioned in
@ 2022-08-18 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-08-18 16:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

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

Modified Files
--------------
src/backend/commands/indexcmds.c       | 23 ++++++++----
src/test/regress/expected/indexing.out | 66 +++++++++++++++++++++++++++++++++-
src/test/regress/sql/indexing.sql      | 15 +++++++-
3 files changed, 96 insertions(+), 8 deletions(-)



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

* pgsql: Fix subtly-incorrect matching of parent and child partitioned in
@ 2022-08-18 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-08-18 16:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9f0073ef7dac2837c45e7960d1157d4a69046b3c

Modified Files
--------------
src/backend/commands/indexcmds.c       | 23 ++++++++----
src/test/regress/expected/indexing.out | 66 +++++++++++++++++++++++++++++++++-
src/test/regress/sql/indexing.sql      | 15 +++++++-
3 files changed, 96 insertions(+), 8 deletions(-)



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

* pgsql: Fix subtly-incorrect matching of parent and child partitioned in
@ 2022-08-18 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-08-18 16:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/commands/indexcmds.c       | 23 ++++++++----
src/test/regress/expected/indexing.out | 66 +++++++++++++++++++++++++++++++++-
src/test/regress/sql/indexing.sql      | 15 +++++++-
3 files changed, 96 insertions(+), 8 deletions(-)



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

* pgsql: Fix subtly-incorrect matching of parent and child partitioned in
@ 2022-08-18 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-08-18 16:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/116f20f926564cd4645f8d2f49fd0dfd0ad1f897

Modified Files
--------------
src/backend/commands/indexcmds.c       | 23 ++++++++----
src/test/regress/expected/indexing.out | 66 +++++++++++++++++++++++++++++++++-
src/test/regress/sql/indexing.sql      | 15 +++++++-
3 files changed, 96 insertions(+), 8 deletions(-)



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


end of thread, other threads:[~2022-08-18 16:12 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18 16:12 pgsql: Fix subtly-incorrect matching of parent and child partitioned in Tom Lane <tgl@sss.pgh.pa.us>
2022-08-18 16:12 pgsql: Fix subtly-incorrect matching of parent and child partitioned in Tom Lane <tgl@sss.pgh.pa.us>
2022-08-18 16:12 pgsql: Fix subtly-incorrect matching of parent and child partitioned in Tom Lane <tgl@sss.pgh.pa.us>
2022-08-18 16:12 pgsql: Fix subtly-incorrect matching of parent and child partitioned in Tom Lane <tgl@sss.pgh.pa.us>
2022-08-18 16:12 pgsql: Fix subtly-incorrect matching of parent and child partitioned in Tom Lane <tgl@sss.pgh.pa.us>
2022-08-18 16:12 pgsql: Fix subtly-incorrect matching of parent and child partitioned in Tom Lane <tgl@sss.pgh.pa.us>

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