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 1vs6Qc-005o1G-02 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 21:46:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vs6Qa-00656l-2f for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 21:46:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vs6Qa-00656U-1i for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 21:46:48 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vs6QY-00000000xO8-0LF3 for pgsql-hackers@postgresql.org; Mon, 16 Feb 2026 21:46:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 61GLkaFR1185288; Mon, 16 Feb 2026 16:46:36 -0500 From: Tom Lane To: Andrew Dunstan cc: Andres Freund , PostgreSQL-development Subject: Re: generating function default settings from pg_proc.dat In-reply-to: <4bb703bc-833f-4b53-a313-ae0b72afe2a5@dunslane.net> References: <183292bb-4891-4c96-a3ca-e78b5e0e1358@dunslane.net> <1166845.1771269225@sss.pgh.pa.us> <1172935.1771272123@sss.pgh.pa.us> <4bb703bc-833f-4b53-a313-ae0b72afe2a5@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Mon, 16 Feb 2026 15:31:25 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1185286.1771278396.1@sss.pgh.pa.us> Date: Mon, 16 Feb 2026 16:46:36 -0500 Message-ID: <1185287.1771278396@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > On 2026-02-16 Mo 3:02 PM, Tom Lane wrote: >> Who's going to work on this? I'm happy to take a swing at it, >> but don't want to duplicate someone else's effort. > Go for it. I'm happy to review. After a little bit of thought, I propose the following sketch for what to do in the bootstrap backend: In InsertOneValue(), add a special case for typoid == PG_NODE_TREEOID. pg_node_tree_in() would just fail anyway so this isn't removing any useful functionality. The special-case code would check which column we are entering a value for and dispatch to appropriate code: if (typoid == PG_NODE_TREEOID) { if (RelationGetRelid(boot_reldesc) == ProcedureRelationId && i == Anum_pg_proc_proargdefaults - 1) values[i] = ConvertOneProargdefaultsValue(value); else ... maybe other cases later else elog(ERROR, "can't handle pg_node_tree input"); return; } This framework would permit special-casing other catalog columns in future, if we feel a need for that. Andres was concerned about not having access to the other columns of pg_proc, but I think that's mistaken: bootstrap.c's values[] array should hold the already-parsed values of all earlier columns for the current entry. So ISTM that we should have enough data to interpret an input that just looks like an array of input-value strings and construct a List of Const nodes from that, then flatten it to a nodetree string. So with that we'd have enough infrastructure to allow writing something like proargdefaults => '{1,2,true}' This seems orthogonal to Andres' suggestion about refactoring the pg_proc.dat representation of arguments to not be parallel arrays but a list of hashes. I think that's likely a good idea, but I don't want to implement it because I'm not a great Perl programmer. Do you want to pick up that part? regards, tom lane