Re: postgres reorders expressions when inlining - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: postgres reorders expressions when inlining
Date
Msg-id CAKFQuwZCG+pTQmHfQQeiuOLjSKYQt1QH4z2tPLgiyjzF9YcHjg@mail.gmail.com
Whole thread Raw
In response to postgres reorders expressions when inlining  (Floris Van Nee <florisvannee@Optiver.com>)
List pgsql-bugs
On Thursday, December 29, 2022, Floris Van Nee <florisvannee@optiver.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.

pgsql-bugs by date:

Previous
From: Frank Reppin
Date:
Subject: Re: BUG #17733: ERROR: could not load library "/Users/frank/postgres/postgresql-13.9/lib/postgresql/llvmjit.so": dl
Next
From: Tom Lane
Date:
Subject: Re: postgres reorders expressions when inlining