RE: Skipping NULL keys when uniqueifying a semijoin's RHS - Mailing list pgsql-hackers

From William Bernbaum
Subject RE: Skipping NULL keys when uniqueifying a semijoin's RHS
Date
Msg-id PH0PR18MB4443D4EB1C4166BDB91D1366A6A92@PH0PR18MB4443.namprd18.prod.outlook.com
Whole thread
In response to Re: Skipping NULL keys when uniqueifying a semijoin's RHS  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
List pgsql-hackers
Hi Ilmari,

Thanks for the review - v2 attached.

> [use foreach_node for the loop over join_info_list]

Done.

> [and for the loop over semi_rhs_exprs]

This one I couldn't take as written, so I used foreach_ptr
instead.

Two further changes:

First, I dropped this guard:

    /* Nothing reads the whole RHS unless it can be unique-ified */
    if (!sjinfo->semi_can_btree && !sjinfo->semi_can_hash)
        continue;

The check was unreachable. compute_semijoin_info() assigns
sjinfo->semi_rhs_exprs only after it has already returned early on
!(all_btree || all_hash), so semi_rhs_exprs is NIL whenever both flags
are false.

Second, I added a strictness check:

    /* A non-strict operator can match a NULL key */
    if (!op_strict(opno))
        continue;

compute_semijoin_info() requires each operator to be hashjoinable or
mergejoinable, but nothing requires it to be strict.

Thanks,
Will

Attachment

pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: [PATCH] Release replication slot on error in SQL-callable slot functions
Next
From: Ewan Young
Date:
Subject: Re: Use pg_neg_s*_overflow() for open-coded negation overflow checks