pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix semijoin unique-ification for child relations
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix semijoin unique-ification for child relations
@ 2025-08-29 04:14  Richard Guo <rguo@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Guo @ 2025-08-29 04:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix semijoin unique-ification for child relations

For a child relation, we should not assume that its parent's
unique-ified relation (or unique-ified path in v18) always exists.  In
cases where all RHS columns that need to be unique-ified are equated
to constants, the unique-ified relation/path for the parent table is
not built, as there are no columns left to unique-ify.  Failing to
account for this can result in a SIGSEGV crash during planning.

This patch checks whether the parent's unique-ified relation or path
exists and skips unique-ification of the child relation if it does
not.

Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49MOdLW2c+qbLHHBt8VBu=4ONpM91D19=AWeW93eFUF6A@mail.gmail.com
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/97b0f36bde9a08bc6f004438ff8fc0afbcb418c0

Modified Files
--------------
src/backend/optimizer/plan/planner.c |  9 ++++++
src/test/regress/expected/join.out   | 60 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql        | 37 ++++++++++++++++++++++
3 files changed, 106 insertions(+)



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

* pgsql: Fix semijoin unique-ification for child relations
@ 2025-08-29 04:17  Richard Guo <rguo@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Guo @ 2025-08-29 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix semijoin unique-ification for child relations

For a child relation, we should not assume that its parent's
unique-ified relation (or unique-ified path in v18) always exists.  In
cases where all RHS columns that need to be unique-ified are equated
to constants, the unique-ified relation/path for the parent table is
not built, as there are no columns left to unique-ify.  Failing to
account for this can result in a SIGSEGV crash during planning.

This patch checks whether the parent's unique-ified relation or path
exists and skips unique-ification of the child relation if it does
not.

Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49MOdLW2c+qbLHHBt8VBu=4ONpM91D19=AWeW93eFUF6A@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/58ea074f1433abdd5de792e47ae84c1e56c263f9

Modified Files
--------------
src/backend/optimizer/util/pathnode.c |  9 ++++++
src/test/regress/expected/join.out    | 60 +++++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql         | 37 +++++++++++++++++++++
3 files changed, 106 insertions(+)



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


end of thread, other threads:[~2025-08-29 04:17 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-29 04:14 pgsql: Fix semijoin unique-ification for child relations Richard Guo <rguo@postgresql.org>
2025-08-29 04:17 pgsql: Fix semijoin unique-ification for child relations Richard Guo <rguo@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