| From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | aman(at)stack-auth(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19965: btree_gist index on timetz returns too few rows for <, > and <> |
| Date: | 2026-12-02 18:21:38 |
| Message-ID: | CALdSSPgqJGUrnnHQJws_N2dMWjoCiTe_eWFVkWvLttoEfqvcqA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Wed, 2 Dec 2026 at 21:58, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > A btree_gist index on a timetz column returns too few rows for <, > and
> > <> when a stored value is the same UTC time as the comparison value with
> > a different time zone offset, such as 09:00+00 and 10:00+01.
>
> Interesting. Seems we need something like the attached.
Tested attached with regular and internal pages - it works on
unpatched binary GiST can miss a whole subtree of values.
> The only other "inexact" opclass in btree_gist is the inet one,
> which presumably is broken in a similar way. But that's so thoroughly
> broken (because convert_network_to_scalar doesn't represent inet's
> sort order faithfully) that this would not be enough to help it much.
>
> regards, tom lane
>
FTWW GiST + inet doesn't work in this case.
CREATE TABLE t (a inet);
INSERT INTO t VALUES
('1:1:1:1::1/128'),
('1:1:1:1::2/128');
SELECT a FROM t WHERE a < '1:1:1:1::2/128';
-- 2001:db8:abcd:1::1/128
CREATE INDEX ON t USING gist (a gist_inet_ops);
SET enable_seqscan = off;
SET enable_bitmapscan = off;
SELECT a FROM t WHERE a < '1:1:1:1::2/128';
-- no rows
If apply a similar fix to gbt_inet_consistent - some queries would
start to work - the case above would. Cases where ip address is
greater that another address by convert_network_to_scalar but lesses
in how 'inet' compares (network bytes + mask + whole addr) - not
fixed.So, ok, agree that these is a little value in fixing inet this
way
--
Best regards,
Kirill Reshke
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayush Tiwari | 2026-12-02 18:29:28 | Re: BUG #19967: ecpg crashes after "cursor does not exist" on FETCH or MOVE |
| Previous Message | Tom Lane | 2026-12-02 18:03:40 | Re: Regex fails to capture group consisting of empty string in non-greedy case |