pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Paragon Corporation <lr@pcorp.us>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
Date: Sun, 22 Mar 2015 10:46:00 -0400
Message-ID: <14130.1427035560@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZtQxTcEQRpXk4Je9=1XSUSA40=BTi62M+GNH96P6dDgg@mail.gmail.com>
References: <001c01d0647a$397bb260$ac731720$@pcorp.us>
	<CAKFQuwZtQxTcEQRpXk4Je9=1XSUSA40=BTi62M+GNH96P6dDgg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Sunday, March 22, 2015, Paragon Corporation <lr@pcorp.us> wrote:
>> SELECT  v[1] As v1, v[2] As v2, v[3] As v3
>> FROM
>> (SELECT dummy_notice(1,2,3) As v) As t;

> I suspect Tom's optimization:
> http://git.postgresql.org/pg/commitdiff/f4abd0241de20d5d6a79b84992b9e88603d44134
> is flattening the array returning function into the select-list of the
> outer query so it effectively reads:
> Select Dummy_notice(1,2,3)[1], dummy_notice(1,2,3)[2], etc...

Yeah.  You could put "OFFSET 0" into the sub-select if you want to ensure
it will not be flattened.

> The flatten would work if the result could be cached...it is defined to
> be immutable...but that would not be reliable generally...

Note that "immutable" effectively means "having no side-effects of
interest", so emitting a NOTICE from such a function is really cheating.
Another solution would be to mark the function VOLATILE.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (13+ messages)  latest in thread

Message-ID: <14130.1427035560@sss.pgh.pa.us>
Permalink:  ../14130.1427035560@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14130.1427035560@sss.pgh.pa.us

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, lr@pcorp.us
  Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
  In-Reply-To: <14130.1427035560@sss.pgh.pa.us>
  References: <001c01d0647a$397bb260$ac731720$@pcorp.us> <CAKFQuwZtQxTcEQRpXk4Je9=1XSUSA40=BTi62M+GNH96P6dDgg@mail.gmail.com> <14130.1427035560@sss.pgh.pa.us>

* 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