Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9nSy-001kqu-1R for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 17:10:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9nSw-00AiWY-2x for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 17:10:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9nSw-00AiWP-0F for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 17:10:23 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9nSt-00000000vt7-0zFu for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 17:10:22 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 49CB0EC0406; Mon, 6 Apr 2026 13:10:17 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-06.internal (MEProxy); Mon, 06 Apr 2026 13:10:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1775495417; x=1775581817; bh=HgV2JaW0Y5AXNotfymzxYl0mRf0BSyPawzRPEvInbFY=; b= bHGZg0mD+wmdVJCOyKBE2OKhkfnCfuFYVqnWC4havi0qP2c2uhQCeFOV+0jF66J2 6USVQQhbRzAdQeacebaRZ19Lf8hSupBnTlUp2jRWm7L5tA5ky1p/yERlBYL1pwSI cyxQHzTLm2o9z6GxHMCJXxoVL6RTLjgPTRZwZ4LU9USHZQL59UWVTMo4DxmW/1US ODK9hxfS0u1de3OvMyGqyDRxdmUAzx2f/eF9AN4EOKiLVgmwQ7mGR8qdCHkIDk3m bvyexVEvrO6Sknhk9fkjDMEJNExyyCaSzK25IBMO3Kf+C7G602Zbe7WhJqDutQ54 vZHjjkBFT16w1IffV0mnCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1775495417; x= 1775581817; bh=HgV2JaW0Y5AXNotfymzxYl0mRf0BSyPawzRPEvInbFY=; b=f y78/+qG4/0EljLpEnSnWS8wMF8AxLDz9co7TZLYAMdDlDUE+mp2Z1BFp3TRkGiUP 5WLfxNbJAGc8yPNvH+dWCR/qzeLQJZfZn5PNPEEj6ftc5mZaL1dg5yFYr9Zs8/SR 2fJSxN7OeXa9rVcTrOyfgaAVHwyL5Vp3Q6mFsCmemflHFvcnyBsd2Plhhp/9WtWc DlH+Lf8Z7G8GXiROezkrjGUBHO5Gfw43GCvwL10FDK6n0eqJZDaAmyeFXxFbcPRm R2tCAy4kr6hxq7niEOY9Ec71yY8CUnY4QbYsA3VX9+J4IvlF5k5CFIZ/bVDBsE3m D6IPzYlhPMeMCDiMRTy/A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddukedvlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvvefkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfguhhlvghr ucfvrghvvghirhgrfdcuoegvuhhlvghrsegvuhhlvghrthhordgtohhmqeenucggtffrrg htthgvrhhnpeelvefgieelgeffgfelgfeffeffgefhfedvfedtuddvffeiieejffduleei hfdvveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepvghulhgvrhesvghulhgv rhhtohdrtghomhdpnhgspghrtghpthhtohepjedpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtoheprghnughrvgifseguuhhnshhlrghnvgdrnhgvthdprhgtphhtthhopegurghv ihgurdhgrdhjohhhnhhsthhonhesghhmrghilhdrtghomhdprhgtphhtthhopehjrghpih hnlhhisehhohhtmhgrihhlrdgtohhmpdhrtghpthhtohepphhoshhtghhrvghssehjvghl thgvfhdrnhhlpdhrtghpthhtoheprghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvpd hrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghs qhhlrdhorhhgpdhrtghpthhtohepiihsohhlthdrphgrrhhrrghgihesphgvrhgtohhnrg drtghomh X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 985F1182007A; Mon, 6 Apr 2026 13:10:16 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AmclnrQ3QCH- Date: Mon, 06 Apr 2026 14:09:55 -0300 From: "Euler Taveira" To: "Jelte Fennema" , "Andrew Dunstan" Cc: "David G. Johnston" , japin , "Zsolt Parragi" , =?UTF-8?Q?=C3=81lvaro_Herrera?= , "PostgreSQL Hackers" Message-Id: <6ecd7573-850d-424a-9794-3ee1f73851c0@app.fastmail.com> In-Reply-To: References: <202603201311.yhtqmvektawm@alvherre.pgsql> <8ec9b67d-939e-4b22-8d56-a5129f92d32d@app.fastmail.com> <555cdee4-c024-4872-9d96-82ef4216239c@dunslane.net> <34dc4d59-fec8-43c2-aa7b-38917b3ce0aa@dunslane.net> Subject: Re: pg_get__*_ddl consolidation Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 6, 2026, at 12:24 PM, Jelte Fennema-Nio wrote: > The thing I'm questioning is whether we need a new way of providing > key+value pairs as optional arguments to functions. IMO we already had a > perfectly fine one. Introducing another adds complexity (both to the > code and to the user) and I don't see any compelling reason to do so. > I did the same question when reviewing one of these patches. My first reaction was if we want flexibility to cover various use cases and maintainability to add/deprecate new options, we need a mechanism to avoid breaking compatibility or even overloading the function (complexity). My natural choice was key-value pair arguments. It needs new support code (although we already use this style in some of the backend functions -- e.g. pg_logical_slot_*_changes()). > Attached is a patch with roughly what I have in mind instead. By doing > this we can also make the functinos STRICT, so that we don't have to > worry about handling NULL values for the first argument. > That's a good point. > Afaict this named parameter approach only has benefits over the VARIADIC > argument one. But if I'm wrong about that, please let me know. > I also consider your approach but decided not to use it. The argument against named arguments is that you cannot add new argument *without* a DEFAULT value; if you do, all existing functions will fail. You also need to create another function with a different list of arguments to support a new option. If we are fine with this restriction, your proposal seems ok to me. One point in favor of your proposal is that the named arguments seems more intuitive than the key-value pair arguments. The first impression is that interchanging key and value is harder to figure out that the named argument notation. Of course, documentation and some examples can help the user to write these function calls. That's not the first function that uses this key-value argument approach. -- Euler Taveira EDB https://www.enterprisedb.com/