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 1kBXUp-0003XO-9N for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Aug 2020 06:04:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kBXUl-0007bA-Bf for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Aug 2020 06:04:15 +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 1kBXUl-0007Xp-08 for pgsql-hackers@lists.postgresql.org; Fri, 28 Aug 2020 06:04:15 +0000 Received: from forward5-smtp.messagingengine.com ([66.111.4.239]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBXUd-0005HK-OL for pgsql-hackers@postgresql.org; Fri, 28 Aug 2020 06:04:13 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 7A47D19415A0; Fri, 28 Aug 2020 02:04:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 28 Aug 2020 02:04:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=fm3; bh=HL0SCmXroaPAiNVWuS0gMexIX3ZUmrsEUu6Ua12qN fE=; b=NLET3pFd+8fLsxoOWZWLWPLtUhl8BftRfFu7vPzhvJSr6r822UBgYVD8v IiZdzi0wmoyyOi3yuETybUcAz82kkDoUcd2Ik8KPEgcm1B2IET1c1cqjuofOmdf8 aqneC7ws3YA7FppJcKcy3EIh64U9ClAP6EZ8AzdSvI8ML+12WV/LqbGz2KDqGVYR AsRxxa8fQV8lX15QT1MUE1pI4wzMPWVQy0EzJED6JHoF4KyC1qZ0b1sda+cSSkWQ d0mYUagxHx5EEi8A22/PkiBjSk1/W4kd/n2DLhUdC7IUyqjte1JphLBHX/+XBKuG WE+StiB/gQLFjtDD0c1djEbyslbkw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedruddviedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhfhokffffgggjggtgfesthejredttdefjeenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnh guqhhurggurhgrnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpedtveeghedtjedvvedv leejueevjeejtdellefgkeelfeeikeejlefgkedtudeuvdenucffohhmrghinhepvdhnug hquhgrughrrghnthdrtghomhenucfkphepkeejrddujeejrdejjedrledtnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghish gvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhm X-ME-Proxy: Received: from april.pezone.net (p57b14d5a.dip0.t-ipconnect.de [87.177.77.90]) by mail.messagingengine.com (Postfix) with ESMTPA id 2E09F30600A3; Fri, 28 Aug 2020 02:04:05 -0400 (EDT) Subject: Re: Support for OUT parameters in procedures To: Robert Haas References: <2b8490fe-51af-e671-c504-47359dc453c5@2ndquadrant.com> Cc: pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <7c2aa288-74fd-fe0a-58bb-d77055315047@2ndquadrant.com> Date: Fri, 28 Aug 2020 08:04:04 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-08-27 15:56, Robert Haas wrote: > On Thu, Aug 27, 2020 at 4:34 AM Peter Eisentraut > wrote: >> For a top-level direct call, you can pass whatever you want, since all >> OUT parameters are presented as initially NULL to the procedure code. >> So you could just pass NULL, as in CALL test_proc(5, NULL). > > Is that actually how other systems work? I would think that people > would expect to pass, say, a package variable, and expect that it will > get updated. The handling of results of SQL statements executed at the top level (a.k.a. direct SQL) is implementation-specific and varies widely in practice. More interesting in practice, in terms of functionality and also compatibility, are nested calls in PL/pgSQL as well as integration in JDBC. We already support INOUT parameters in procedures, so the method of returning the value of output parameters after the CALL already exists. This patch doesn't touch that at all, really. If we had or would add other places to put those results, such as package variables, then they could be added independently of this patch. Of course, feedback from those more knowledgeable in other systems than me would be welcome. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services