From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Floris Van Nee <florisvannee(at)Optiver(dot)com> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: postgres reorders expressions when inlining |
Date: | 2022-12-29 15:14:32 |
Message-ID: | 553278.1672326872@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Floris Van Nee <florisvannee(at)Optiver(dot)com> writes:
> I recently ran into some behavior with inlining that seemed strange to me. I managed to break it down into a small reproducible example that I've added. I originally ran into it in more complicated queries that involved inlining of SQL functions instead of subqueries, but it reproduces with subqueries too so that's the example I've added. Tested on v15.
> create table t1 as select a, b from generate_series(0, 5) a, generate_series(0, 10) b;
> select * from (
> select a, b, c
> from t1
> left join lateral
> (
> select 1 / b as c
> ) c on true
> where b <> 0
> ) as o
> where o.c is not null
> The SELECT query leads to a division by zero. Plan:
This is not a bug. We make no ordering guarantees about WHERE clause
execution; if we did, it would cripple the planner's ability to
optimize.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-12-29 17:22:58 | Re: BUG #17717: Regression in vacuumdb (15 is slower than 10/11 and possible memory issue) |
Previous Message | David G. Johnston | 2022-12-29 14:02:28 | Re: postgres reorders expressions when inlining |