pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix runtime partition pruning for HASH partitioned tables
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix runtime partition pruning for HASH partitioned tables
@ 2023-10-12 12:12 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2023-10-12 12:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
master

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

Modified Files
--------------
src/backend/executor/execPartition.c          | 53 +++++++++++++++------------
src/test/regress/expected/partition_prune.out | 22 ++++++++++-
src/test/regress/sql/partition_prune.sql      | 21 ++++++++++-
3 files changed, 69 insertions(+), 27 deletions(-)



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

* pgsql: Fix runtime partition pruning for HASH partitioned tables
@ 2023-10-12 12:13 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2023-10-12 12:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/595db9e9cc41a59c43e1c63bf4a4d4b9862d893c

Modified Files
--------------
src/backend/executor/execPartition.c          | 53 +++++++++++++++------------
src/test/regress/expected/partition_prune.out | 22 ++++++++++-
src/test/regress/sql/partition_prune.sql      | 21 ++++++++++-
3 files changed, 69 insertions(+), 27 deletions(-)



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

* pgsql: Fix runtime partition pruning for HASH partitioned tables
@ 2023-10-12 12:13 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2023-10-12 12:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1e81d3e6e0a0e35e52e109742c5ce3738c3e87c6

Modified Files
--------------
src/backend/executor/execPartition.c          | 53 +++++++++++++++------------
src/test/regress/expected/partition_prune.out | 22 ++++++++++-
src/test/regress/sql/partition_prune.sql      | 21 ++++++++++-
3 files changed, 69 insertions(+), 27 deletions(-)



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

* pgsql: Fix runtime partition pruning for HASH partitioned tables
@ 2023-10-12 12:14 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2023-10-12 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/executor/execPartition.c          | 29 ++++++++++++++++-----------
src/test/regress/expected/partition_prune.out | 22 +++++++++++++++++++-
src/test/regress/sql/partition_prune.sql      | 21 +++++++++++++++++--
3 files changed, 57 insertions(+), 15 deletions(-)



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

* pgsql: Fix runtime partition pruning for HASH partitioned tables
@ 2023-10-12 12:14 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2023-10-12 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/890a73ba3ac0ea9ec2ad6a828ffe03ca12b11564

Modified Files
--------------
src/backend/executor/execPartition.c          | 29 ++++++++++++++++-----------
src/test/regress/expected/partition_prune.out | 22 +++++++++++++++++++-
src/test/regress/sql/partition_prune.sql      | 21 +++++++++++++++++--
3 files changed, 57 insertions(+), 15 deletions(-)



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

* pgsql: Fix runtime partition pruning for HASH partitioned tables
@ 2023-10-12 12:15 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2023-10-12 12:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/executor/execPartition.c          | 29 ++++++++++++++++-----------
src/test/regress/expected/partition_prune.out | 24 +++++++++++++++++++++-
src/test/regress/sql/partition_prune.sql      | 24 ++++++++++++++++++++--
3 files changed, 62 insertions(+), 15 deletions(-)



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

* pgsql: Fix runtime partition pruning for HASH partitioned tables
@ 2023-10-12 12:15 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2023-10-12 12:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2759924f33a6b7021f68dda05bb34b10bb4579e2

Modified Files
--------------
src/backend/executor/execPartition.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)



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


end of thread, other threads:[~2023-10-12 12:15 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-10-12 12:12 pgsql: Fix runtime partition pruning for HASH partitioned tables David Rowley <drowley@postgresql.org>
2023-10-12 12:13 pgsql: Fix runtime partition pruning for HASH partitioned tables David Rowley <drowley@postgresql.org>
2023-10-12 12:13 pgsql: Fix runtime partition pruning for HASH partitioned tables David Rowley <drowley@postgresql.org>
2023-10-12 12:14 pgsql: Fix runtime partition pruning for HASH partitioned tables David Rowley <drowley@postgresql.org>
2023-10-12 12:14 pgsql: Fix runtime partition pruning for HASH partitioned tables David Rowley <drowley@postgresql.org>
2023-10-12 12:15 pgsql: Fix runtime partition pruning for HASH partitioned tables David Rowley <drowley@postgresql.org>
2023-10-12 12:15 pgsql: Fix runtime partition pruning for HASH partitioned tables David Rowley <drowley@postgresql.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