Fix network subset support with custom operator classes

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix network subset support with custom operator classes
Date: 2026-11-24 09:18:47
Message-ID: CALdSSPhn0S37joM-0cenTUybYKFGeOeZ8r-rpZmK9RvR58s_-w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The planner support function for the inet << and <<= operators
rewrites the predicate into range clauses of the form

key >= network_scan_first(C) AND key <= network_scan_last(C)

which only works when opfamily is same as network_cmp_internal().
Since be1cc9aaf5b [0] this is actually not checked. [0] commit message
says that

To fix restore the opfamily == NETWORK_BTREE_FAM_OID check inside
match_network_subset.

A regression test with a masklen-ordered btree opclass over inet is
included as a separate patch. This case looks too narrow to spend CI
cycles on, OTOH this is real historical regression.

[0] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=be1cc9aaf5b79f07bc0483a0c95366c77a844d0a

--
Best regards,
Kirill Reshke

Attachment Content-Type Size
0001-fix-network-subset-support.patch application/octet-stream 747 bytes
0002-test-network-subset-support.patch application/octet-stream 2.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Geier 2026-11-24 09:19:31 Re: Assert failure in parallel query due to SubPlan double visit for hash join
Previous Message vignesh C 2026-11-24 09:09:29 Fix a wrong comment in UpdateDeadTupleRetentionStatus()