From: Elvis Pranskevichus <elprans@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #16368: Incorrect function inlining in the presence of a window function
Date: Wed, 15 Apr 2020 18:17:30 -0700
Message-ID: <7058335.0AJ8ntve86@hammer.magicstack.net> (raw)
In-Reply-To: <2039.1586996045@sss.pgh.pa.us>
References: <16368-0dd1d5ab02a3cbc0@postgresql.org>
<CAKFQuwZk1focovkoLbgzWcoMnn09CrnmoHXVYKuPNnSoxwNkuQ@mail.gmail.com>
<2039.1586996045@sss.pgh.pa.us>
On Wednesday, April 15, 2020 5:14:05 P.M. PDT Tom Lane wrote:
> In point of fact, there are many ways in which CASE and related
> constructs fail to guarantee evaluation order, as noted in
> https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-EX
> PRESS-EVAL
>
> The particular case mentioned there seems to be about the same as
> here: constant-folding happens even in CASE arms that will never be
> reached at runtime.
Yes, but function arguments aren't constants are they? At least the
documentation makes no effort to mention that.
> would be quite unhappy with the performance impact of de-optimizing
> CASE that way.
I'm not arguing for the general de-optimization for CASE, just for not
treating arguments of inlined functions as constants in the CASE
statement. For arguments of a prepared statement this optimization
makes even less sense.
Elvis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: elprans@gmail.com, david.g.johnston@gmail.com, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16368: Incorrect function inlining in the presence of a window function
In-Reply-To: <7058335.0AJ8ntve86@hammer.magicstack.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox