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 1viGGC-001q19-2j for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 18:15:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1viGGB-002EGC-0W for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 18:15: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 1viGGA-002EG0-2L for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 18:15:23 +0000 Received: from mail-dy1-x1330.google.com ([2607:f8b0:4864:20::1330]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1viGG8-001Z9o-1L for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 18:15:22 +0000 Received: by mail-dy1-x1330.google.com with SMTP id 5a478bee46e88-2ae38f81be1so6368785eec.0 for ; Tue, 20 Jan 2026 10:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768932918; x=1769537718; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eX6SSHe325As1Soa+MTpDI8rAxIMKKjVYPYzVy89XNk=; b=KBvsL6B6Wcg+6pxzSMI0es8R6ntJkbqPhPhws5z095PdcVnDoprczeVduwoGEtDgjV ysqeDHo59dLDXvUpUXNurPTtSasFpxmCaYPblMFfdYaqmsYGO09YicW+sZ/t0ItXhOEw p+Smua+SBkx4CecKD3IO46OaNHc5YVAtP6MlyWUekWqaoNfgOZv78cjdOQJbF0He25eR LXJPV0mqn5GTY4iKe/i1AQrhPnhpE+zdoh8TlqpeHNlgBqw23vCrdZUAZAYNnQDEs403 07Hp1pUpzh24NXkASD0keROnerrNYpRWLFVPoNWPeTUIGOdj2ZMTrRsswF3fPjlrimzR VfZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768932918; x=1769537718; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=eX6SSHe325As1Soa+MTpDI8rAxIMKKjVYPYzVy89XNk=; b=WQ5XbRkADVnH8gEmHPFfCcT/FPLlSJMUl4gOyseQboNAss4d2K8bfXQXR+6JjJog0W XHwOvsUXleurykX80QRJ1DvvICfEGtin2PgDjwB640xuq5DGk9B2ayR2Z2nN+Y6lrkAj q+iUFZLSpttDNQeQQHPXwATl19p6wf/eBLEUVw9n9pr7wiNYco9GUNVta3zC0rSMQTUA ehNNpyExJwoaodCWnIHbixCQ7TJl6PgzXneFHzPB6qgXhkRetubJLBFyDSRMMLqkRaxA tZGVO/Ub+qOB+WcD802P/ocOZ0mi0feOlqKIZi5uOAs8txJu29w2VCfiE7U1Yo/+/cco Ohzw== X-Gm-Message-State: AOJu0YwTpxpJKAIATrVwe1sh2rwmqTPsLgdXbhajNZ7UsR5L4oumHWa4 CvZLkfwCZOM4zbFi9hMM7JIds+yXfm8TmRp5GQf5VXxGt3/sGlZaLQXyTqFK7oF3 X-Gm-Gg: AZuq6aLcTq2y54WljEHyfzIGdbQv+z6NELVXXQuMvK1mhjbg0pFWDfV+l8+zx0JmwbT 4DQNNXtCbjfErpIW+zQBeyqbUju8bhtksI/8WyqeSZDWHJd31fJR4IhJ3t36UrDMRFKkZ0dxZ5s xT9S+isHSRzbXLtrAPa+BlWfgeM+0eoYsWxZImhlRkivRR1MXVoREvLVdwIStzwusVp7LSZqt5b 5/CUeA4eq5lgYAhOeTQ5s0oK9LVaNy9S/phtv8Tuu2qLazvGLfAtq1dhCgDj0A8nnSeUgzZpeuH pyd8Tq9TO3vmxWhAc96UkqpMLKekd1YDOMomeUbl8576rHxS/LTnbU//kViuPfwmrwHf91b5r5C I+2UQDJJ2ZEhAkYsIHd0kxf2qiup1d8K34oAsh88vP5F/oMuo0Ue68VhAlYj47dI+w2wzIiqPjg sBEvuQhSDLydHAlQexF7WPPLmJgjvztg== X-Received: by 2002:a05:7300:541:b0:2ac:21b5:f43c with SMTP id 5a478bee46e88-2b6b4e8a488mr11693038eec.20.1768932916921; Tue, 20 Jan 2026 10:15:16 -0800 (PST) Received: from o (71-34-92-171.ptld.qwest.net. [71.34.92.171]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b70b3c8ea3sm1022215eec.22.2026.01.20.10.15.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 10:15:15 -0800 (PST) Date: Tue, 20 Jan 2026 10:15:13 -0800 From: Mark Wong To: pgsql-hackers@lists.postgresql.org Subject: Re: updates for handling optional argument in system functions Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3/nz5wg6+DYwHsLU" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --3/nz5wg6+DYwHsLU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi everyone, On Tue, Dec 09, 2025 at 03:28:59PM -0800, Mark Wong wrote: > Hi everyone, > > I noticed how it was preferred to define optional arguments with the > system functions in system_functions.sql instead of defining them in > pg_proc.dat. > > I took a gross stab at updating the ones that ended in _ext, which > turned out to be 7 declarations across 6 system functions, and created a > patch per system function, hoping it would be easier to review. > > Perhaps the most interesting thing to share is the total reduction of > the lines of code, although system_functions.sql only grows: > > src/backend/catalog/system_functions.sql | 49 ++++++++ > src/backend/utils/adt/ruleutils.c | 130 ---------------------- > src/include/catalog/pg_proc.dat | 36 ++---- > 3 files changed, 56 insertions(+), 159 deletions(-) > > > Is that something we want? I fixed an error caught by the address sanitizer in CI [1] and am uploading a new patchset. The only change is to 2 lines in v2-0005-Handle-pg_get_expr-default-args-in-system_functio.patch to update a call to pg_get_expr with the correct number of arguments in tablecmds.c. Regards, Mark [1] https://cirrus-ci.com/task/6109065824174080 -- Mark Wong EDB https://enterprisedb.com --3/nz5wg6+DYwHsLU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-Handle-pg_get_ruledef-default-args-in-system_func.patch"