pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] Attempt to reword a comment.
1+ messages / 1 participants
[nested] [flat]

* [PATCH] Attempt to reword a comment.
@ 2026-08-21 08:21  Antonin Houska <ah@cybertec.at>
  0 siblings, 0 replies; 1+ messages in thread

From: Antonin Houska @ 2026-08-21 08:21 UTC (permalink / raw)

In particular, the phrase "so every output row satisfies them" seems
problematic because an output row of a semijoin is NULL-extended, so the
output row usually does not satisfy the join clauses.
---
 src/backend/optimizer/path/uniquekeys.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/backend/optimizer/path/uniquekeys.c b/src/backend/optimizer/path/uniquekeys.c
index f9d9c37f447..34b2507d6b7 100644
--- a/src/backend/optimizer/path/uniquekeys.c
+++ b/src/backend/optimizer/path/uniquekeys.c
@@ -538,9 +538,14 @@ populate_joinrel_uniquekeys(PlannerInfo *root, RelOptInfo *joinrel,
 	if (jointype == JOIN_SEMI || jointype == JOIN_ANTI)
 	{
 		/*
-		 * A semijoin emits an LHS row only when some RHS row satisfied the
-		 * join clauses, so every output row satisfies them.  An antijoin
-		 * emits exactly the rows that no RHS row matched.
+		 * A semijoin emits a row only when the LHS satisfied the join clauses
+		 * (for at least one RHS row). Given that all the current unique keys
+		 * originate from the LHS, it's possible that rows having NULL in any
+		 * unique key attribute are filtered out by the join clauses.
+		 *
+		 * (An antijoin emits exactly the rows that do not satisfy the join
+		 * clauses, so rows having NULL in the unique key are not filtered
+		 * out.)
 		 */
 		if (jointype == JOIN_SEMI)
 			strengthen_uniquekeys_for_join(root, joinrel, restrictlist);
-- 
2.52.0


--=-=-=--






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


only message in thread

Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-21 08:21 [PATCH] Attempt to reword a comment. Antonin Houska <ah@cybertec.at>

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