on is only propagated to one side of JOIN
Hi, using `PostgreSQL 16. 2 (Debian 16. 2-1. pgdg120+2) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 12. 2. 0-14) 12. 2. 0, 64-bit`, I've observed the
following behavior: – keep in mind that this example is as simplified as
possible, the original
On 25/08/2024 19:28, Tom Lane wrote:
For this particular case, you could probably get somewhere by
writing
SELECT * FROM view1 WHERE site_id = 1
UNION ALL
SELECT * FROM view1 WHERE site_id IS NULL;
Thank you for your suggestion, Tom.
Unfortunately, as I now understand, nothing *except* `var
Tobias Hoffmann writes:
> A more complete example might look more like this:
> CREATE VIEW "subview1" AS
> SELECT tbl1.site_id, ... JOIN ... ON tbl1.site_id = tbl2.site_id
> WHERE ...;
> CREATE VIEW "view1" AS
> SELECT site_id, ... FROM subview1 -- maybe even: WHERE site_id IS
> NOT NUL
On 25/08/2024 17:35, David G. Johnston wrote:
On Sunday, August 25, 2024, Tobias Hoffmann
wrote:
3) Problematic example:
# EXPLAIN SELECT * FROM tbl1 JOIN tbl2 ON tbl2.site_id =
tbl1.site_id WHERE tbl1.site_id = 1 OR tbl1.site_id IS NULL;
The “is null” predicate in this query
"David G. Johnston" writes:
> On Sunday, August 25, 2024, Tobias Hoffmann
> wrote:
>> 3) Problematic example:
>>
>> # EXPLAIN SELECT * FROM tbl1 JOIN tbl2 ON tbl2.site_id = tbl1.site_id
>> WHERE tbl1.site_id = 1 OR tbl1.site_id IS NULL;
> The “is null” predicate in this query is doing nothing a
On Sunday, August 25, 2024, Tobias Hoffmann
wrote:
>
> 3) Problematic example:
>
> # EXPLAIN SELECT * FROM tbl1 JOIN tbl2 ON tbl2.site_id = tbl1.site_id
> WHERE tbl1.site_id = 1 OR tbl1.site_id IS NULL;
The “is null” predicate in this query is doing nothing as your next comment
alludes to; you
Hi,
using `PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit`, I've observed the
following behavior:
– keep in mind that this example is as simplified as possible, the
original query involves foreign tables, and the failure to