Re: postgres reorders expressions when inlining

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
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 14:02:28
Message-ID: CAKFQuwZCG+pTQmHfQQeiuOLjSKYQt1QH4z2tPLgiyjzF9YcHjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thursday, December 29, 2022, Floris Van Nee <florisvannee(at)optiver(dot)com>
wrote:
>
>
> Is it expected that Postgres reorders these expressions? I'd think that,
> even though Postgres decides to inline a query, it should at least evaluate
> the expressions of the inner-part before the outer part to avoid the
> division by zero.
>
>
Yes, this is working as intended, expression order is not something that is
recognized by the system . In this case protect your division with a case
expression.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-12-29 15:14:32 Re: postgres reorders expressions when inlining
Previous Message Frank Reppin 2022-12-29 11:21:30 Re: BUG #17733: ERROR: could not load library "/Users/frank/postgres/postgresql-13.9/lib/postgresql/llvmjit.so": dl