Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUH7s-0005v7-1d for pgsql-committers@arkaria.postgresql.org; Wed, 07 Apr 2021 22:58:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUH7p-0005WV-Hu for pgsql-committers@arkaria.postgresql.org; Wed, 07 Apr 2021 22:58:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUH7o-0005WO-PZ for pgsql-committers@lists.postgresql.org; Wed, 07 Apr 2021 22:58:17 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUH7h-0006Yg-Qk for pgsql-committers@lists.postgresql.org; Wed, 07 Apr 2021 22:58:15 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 561AB5C0066; Wed, 7 Apr 2021 18:58:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 07 Apr 2021 18:58:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=uZKd/esoRn5auT062it+smHlQR6 lilP8dn07RYMXLVw=; b=DCql1a+UQriVQh/GCJfnEzcx1W8ENBkNYbpYMMVjjmc n+kSaZy+4iikkr1c5xrOZSnC42e365LHBe/XNyAHvTvEvIkQZlRHqqRua554Vboj HgncJpF0fcOQLZZruLRuzywISCXBWHZlQYsnGuP7weJsmQtSJFLEP/GZdrlQHWJ5 RXwasA8ZyJNMnehFpPPmGZ2n72e3fq+/ibwXRjxxQ21dyxYqBKD2ElYs8/ciYA9c T0e9Czu8lxtw711An4aB3c3HGDjO1buiK5z2/joY6YYubxiBbQr9OF7mmmrZgwWn raX1Yvf6NwUGExrUGxSW7n3vEWcx1RZATh7FHZja8cQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=uZKd/e soRn5auT062it+smHlQR6lilP8dn07RYMXLVw=; b=tEz6npQ39hijVpr/rJZgFO +s9ArGjCfea+/FWtGgQ5YGrVH8/9n4uYbxMMV9Hwvkpeog2NHmuz05m/qtkmOxtx TWTbJzWRUzFr+YuR084uB1hWUDf3JVIL3cI6RjA5UmhlOz6l298P8F5GlDYyxoKT GO62yJ9c8ISO+cbZDFQYtZhoF6nW+UA2rD4QiXAFxFCfnW7Clt+cFDOaBh6Z2mn2 P81aF9WWiIqQ/uirufyQteTKtCEpRAjUEjeiU9NZoqjXZaIxudqx+Yy69meQu6bz qou5AbkZRuE7BqQ1wnn6J44Z/7z74wx8NuTmI6TthDwdf5YBs0uHikgAoRJkW7Cw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejkedgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpeetheehiefgudelhfevvddvtdejheehkeelteekveeggeduieelieduuefg fedtjeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppedutdejrd dugedvrdeffedruddtfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Received: from intern.anarazel.de (107-142-33-103.lightspeed.sntcca.sbcglobal.net [107.142.33.103]) by mail.messagingengine.com (Postfix) with ESMTPA id A24DE24005B; Wed, 7 Apr 2021 18:58:07 -0400 (EDT) Date: Wed, 7 Apr 2021 15:58:06 -0700 From: Andres Freund To: Peter Eisentraut Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: SQL-standard function body Message-ID: <20210407225806.majgznh4lk34hjvu@alap3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2021-04-07 19:53:35 +0000, Peter Eisentraut wrote: > SQL-standard function body > > This adds support for writing CREATE FUNCTION and CREATE PROCEDURE > statements for language SQL with a function body that conforms to the > SQL standard and is portable to other implementations. > > Instead of the PostgreSQL-specific AS $$ string literal $$ syntax, > this allows writing out the SQL statements making up the body > unquoted, either as a single statement: > > CREATE FUNCTION add(a integer, b integer) RETURNS integer > LANGUAGE SQL > RETURN a + b; > > or as a block > > CREATE PROCEDURE insert_data(a integer, b integer) > LANGUAGE SQL > BEGIN ATOMIC > INSERT INTO tbl VALUES (a); > INSERT INTO tbl VALUES (b); > END; > > The function body is parsed at function definition time and stored as > expression nodes in a new pg_proc column prosqlbody. So at run time, > no further parsing is required. > > However, this form does not support polymorphic arguments, because > there is no more parse analysis done at call time. > > Dependencies between the function and the objects it uses are fully > tracked. > > A new RETURN statement is introduced. This can only be used inside > function bodies. Internally, it is treated much like a SELECT > statement. > > psql needs some new intelligence to keep track of function body > boundaries so that it doesn't send off statements when it sees > semicolons that are inside a function body. > > Tested-by: Jaime Casanova > Reviewed-by: Julien Rouhaud > Discussion: https://www.postgresql.org/message-id/flat/1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com > > Branch > ------ > master > > Details > ------- > https://git.postgresql.org/pg/commitdiff/e717a9a18b2e34c9c40e5259ad4d31cd7e420750 This is turning the BF red: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=rhinoceros&dt=2021-04-07%2022%3A52%3A19 Might be force_parallel_mode=regress related. Greetings, Andres Freund