Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YZiro-0005TU-Qt for pgsql-bugs@arkaria.postgresql.org; Sun, 22 Mar 2015 16:36:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YZirn-0007jP-Bq for pgsql-bugs@arkaria.postgresql.org; Sun, 22 Mar 2015 16:36:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YZirl-0007jG-CJ for pgsql-bugs@postgresql.org; Sun, 22 Mar 2015 16:36:45 +0000 Received: from mail.pcorp.us ([204.51.253.130]) by magus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YZirc-0005Mj-LS for pgsql-bugs@postgresql.org; Sun, 22 Mar 2015 16:36:44 +0000 Received: from R (50-78-240-110-static.hfc.comcastbusiness.net [50.78.240.110]) by mail.pcorp.us ; Sun, 22 Mar 2015 12:36:32 -0400 From: "Paragon Corporation" To: "'David G. Johnston'" , "'Tom Lane'" Cc: References: <001c01d0647a$397bb260$ac731720$@pcorp.us> <14130.1427035560@sss.pgh.pa.us> <14986.1427037326@sss.pgh.pa.us> In-Reply-To: Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch Date: Sun, 22 Mar 2015 12:36:33 -0400 Message-ID: <000401d064be$5bfd11a0$13f734e0$@pcorp.us> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Content-Language: en-us Thread-Index: AQIsS8w/PfkIE5LGw+gCOrb8ZPezLQGoZKH1ANggLwQB/ufkmgHn2dACArCrmU+cKCCs8A== X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org >While I trust your judgement actual knowledge is nice. The fact that Post= GIS is raising the complaint should make us rethink those assumptions; and = nothing in their code or the minimal > example strikes me as being improper. That said, I am surprised you didn= 't recommend that the function should be moved to a FROM clause - though I = believe the code could still optimize > that way without the offset 0. > The PostGIS example involves constructing geometries from a definition. = I suspect that is not cheap, which suggests that maybe we could recommend i= ncreasing the cost of the function above > the default and refusing to flatten a function if the cost is sufficient= ly high? Guys I tried increasing cost with the ST_Reclass function to 2000 and it di= dn't help. The function is called for every single output. The only thi= ng that helps is setting this to VOLATILE as Tom suggests. I guess we can = do that as some sort of fix for these kinds of functions though I'm not sur= e if that would cause other issues. > As for claiming that this is broken and should be reverted: nyet. In the > first place, there is certainly no PG documentation anywhere that promises > single evaluation of a function written in the manner shown here.=20=20 > But what does the typical user expect? That should be the digested stand= ard: whether it is documented should be secondary. It is not documented th= at the given query will be multiply=20 > evaluated either - and the fact that the query, as written, only include = the function call once would suggest the user expect that it will only be e= valuated once, A good chunk of PostGIS functions are very costly and return a raster, geom= etry, geography object which is then further acted on in queries. As David= noted, the general user -- partly because of observation I guess assumed t= he behavior that a function such as that would only be called once. I supp= ose if we were to change all such things to VOLATILE, that would be fine, b= ut I'm concerned about the vast number of PostGIS users who further wrap th= e PostGIS functions and don't know to do this. =20 > I cannot help but feel there is a patch here that allows us to negate the= regression while keeping the benefits - but it's beyond my skills to prove= that let alone write it. > David J. Does this change affect any function that takes a complex object and then h= as that complex object return another complex object? If that is the case,= this would be disastrous for PostGIS users upgrading to 9.5 unless we chan= ge all the functions we have that have this behavior to VOLATILE. I would = be okay with that as long as it doesn't cause performance issues for older = versions of PostgreSQL and doesn't cause performance issues elsewhere. Thanks, Regina =20 --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs