Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iELre-0005v8-9p for pgsql-general@arkaria.postgresql.org; Sat, 28 Sep 2019 23:10:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iELrc-0001Ff-S5 for pgsql-general@arkaria.postgresql.org; Sat, 28 Sep 2019 23:10:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iELrc-00019n-DP for pgsql-general@lists.postgresql.org; Sat, 28 Sep 2019 23:10:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iELrW-0007Ec-2h for pgsql-general@lists.postgresql.org; Sat, 28 Sep 2019 23:10:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x8SNAg9d026052; Sat, 28 Sep 2019 19:10:42 -0400 From: Tom Lane To: Andrew Gierth cc: Alastair McKinley , "pgsql-general\@lists.postgresql.org" Subject: Re: Possible bug: SQL function parameter in window frame definition In-reply-to: <87mueom8km.fsf@news-spur.riddles.org.uk> References: <87tv8wmn1i.fsf@news-spur.riddles.org.uk> <32758.1569703063@sss.pgh.pa.us> <87mueom8km.fsf@news-spur.riddles.org.uk> Comments: In-reply-to Andrew Gierth message dated "Sat, 28 Sep 2019 22:30:59 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26050.1569712242.1@sss.pgh.pa.us> Date: Sat, 28 Sep 2019 19:10:42 -0400 Message-ID: <26051.1569712242@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andrew Gierth writes: > "Tom" == Tom Lane writes: > Tom> Now probably this is never called on utility statements, and maybe > Tom> there is never a reason for anyone to examine or mutate > Tom> SortGroupClauses, GroupingSets, or RowMarkClauses, but I'm not > Tom> sure it's any business of this module to assume that. > I think the logic that query_tree_walker is specifically there to walk > places that might contain _expressions_ is reasonably valid. That said, > the fact that we do have one caller that finds it necessary to > explicitly walk some of the places that query_tree_walker omits suggests > that this decision may have been a mistake. I'm okay with assuming that these functions aren't used on utility statements (but maybe we should add Assert(query->utilityStmt == NULL)?). I'm a bit uncomfortable with skipping the other lists. Admittedly, there's probably not huge value in examining SortGroupClauses in a vacuum (that is, without knowing which list they appear in). The only application I can think of offhand is extracting dependencies, which is already covered by that one caller you mention. However, we need to fix this in all active branches, and I definitely agree with minimizing the amount of change to back branches. The fact that the minimal change breaks (or exposes an oversight in) assign_collations_walker makes it very plausible that it will also break somebody's third-party code. If we push the API change further we increase the risk of breaking stuff. That seems OK in HEAD but not in back branches. regards, tom lane