From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Adrian Garcia Badaracco <adrian(at)adriangb(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Wrapping a where clause to preserve rows with nulls |
Date: | 2024-12-19 04:14:43 |
Message-ID: | CAKFQuwa2jcBnsZxHmNn7_1MjcmOZx_fU93epBx9+orw3yMNgKw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wednesday, December 18, 2024, Adrian Garcia Badaracco <
adrian(at)adriangb(dot)com> wrote:
>
> Is there any way to include the rows where the predicate evaluates to null
> while still using an index?
>
That seems quite unlikely. Your definition of equality is incompatible
with the system’s standard definition while requiring that the standard
equals operator be used in the query. Null values and non-null values are
not considered equal, or, put another way, always considered distinct from
each other. A btree index, which handles =, can’t be told to behave
differently and so cannot fulfill your desire to produce rows where the
stored value is null; it can only produce those equal to 5000.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-12-19 04:38:08 | Re: Wrapping a where clause to preserve rows with nulls |
Previous Message | Adrian Garcia Badaracco | 2024-12-19 04:12:36 | Re: Wrapping a where clause to preserve rows with nulls |