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 1viTr1-007XE8-11 for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Jan 2026 08:46:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1viTqz-0060fs-1c for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Jan 2026 08:46:17 +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 1viTqz-0060fY-0e for pgsql-hackers@lists.postgresql.org; Wed, 21 Jan 2026 08:46:17 +0000 Received: from mail-dy1-x1329.google.com ([2607:f8b0:4864:20::1329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1viTqv-001gZk-1f for pgsql-hackers@lists.postgresql.org; Wed, 21 Jan 2026 08:46:16 +0000 Received: by mail-dy1-x1329.google.com with SMTP id 5a478bee46e88-2b6f5a9cecaso2861389eec.0 for ; Wed, 21 Jan 2026 00:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768985171; x=1769589971; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GAN9vWYBjvHB7Ivyj4rYAC5mx7+E8cZIb5Tubu+BE18=; b=NdSMKNu1/JCcOHKpnbOiGKtmnTCwDcukO5WaLGFQeFFoT6iXItq683dgisZf/DV9Fo 9WZ7aVFFlxV0aBBlwobzSjLxqQ81dYoeYsnDKwvs331rwAalelVxTS+VmNowsmixl/gx d+YNhxWRUrZcOItbwB6gFCWMqqFyMJZrvOyBRgKKXDW7O61dqjGlkwTayie+qRnTpX61 2w2a9YCyxkqJtC+kDADmun4tg9PuqYT0CgqOZTB1BYEoYE4dvQQjQ6DTwJJJMOa7gmEu Ha2t4Ht2udw+QDgEUSoS23XhrsS0/KWEDV1yU8lBQJfYKVhYK6jQIfmRdZ4MCVBXM0aS djZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768985171; x=1769589971; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GAN9vWYBjvHB7Ivyj4rYAC5mx7+E8cZIb5Tubu+BE18=; b=oDaXTlHkbFg+zxOhZS42nDJxaSjXb6TV+mn79sfzal6k9uRE4KuwDH5xjMPWzRazm8 KD9bat9rgGZERiXNaOrbSqmh9lnj6oFS5rwF1qvcMFdGug6KHnlErppOq+PP1jTTk2LY uaU7/9Lj84YlQW+cGTOsdvz/oTzj+wpG+RAToXP8H0pwXFU9p+FnDqFTE0qlVFqUAGUo 80JAH5WGHXye7U2pg7OztkcSgmumcidWvktrMsD9B7GTkfHJ9ruYhps5Ac3oBQZyC2/w 26837xRnZ5+GteVjr3rIHIhgNF2Taq1FuR9hu0Vk5yITQAECMJxWsz15QVfU58N1UA/S TRZg== X-Gm-Message-State: AOJu0YyJMdxoPKTvRBdle4on2bYqxteqk5vPJvvDtfT9efA3XBOMD7ye dlc2OAjwMzfmI+i1pu/EMSBvXcAp2XEiBd0foY23jy9prQ/pa/X/7ior X-Gm-Gg: AZuq6aJqF3561Rg9tvko8ZwQclX+K9CHzSP85VKNrtrVjjS0By/iXYQZH75YBsOs408 8xfBsvc0CFaC8TcWv1w34oLUaCJTBWm7l+YWVICo1+XR09QejzlyF2fXql3Sn/Cfj/PfrLv5K5X x/KLz8NhkCvqos+ndM9j9orebxxHRNrg0Kw+L4G9TfO0j6rlZ9SibcIV2/KHDjRQa8e14KN8vHD irtm6MF9JYf80MOc04kVl/rVrUXxID6iNEX+o6dunLAYJLswYmJDmVtJeNPWA9m6iYRUGbJCThI jvhTupq3Wzxp/voJA3oVRR/tU0RRiZ4jvQgQC7zyt3O5sli8s8rJjDdJ0gEmBlHPfNkTmzJdUSL jxX5WiNcgV9/2pNY9EOjLKZppJh5ZPGmPGBUa+MVkU5s0a4sgEMG+J7hObi+ONvuf+62MuinvBG 9s95MpN/lRneckVU56Vl8n X-Received: by 2002:a05:7300:b913:b0:2b0:6a03:b597 with SMTP id 5a478bee46e88-2b6fd623be5mr2675194eec.8.1768985171363; Wed, 21 Jan 2026 00:46:11 -0800 (PST) Received: from smtpclient.apple ([196.247.24.158]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b6b34c1177sm22880619eec.7.2026.01.21.00.46.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jan 2026 00:46:10 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: updates for handling optional argument in system functions From: Chao Li In-Reply-To: Date: Wed, 21 Jan 2026 16:45:35 +0800 Cc: pgsql-hackers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <0604F7D7-EABE-47CA-A58A-231CBD0DA659@gmail.com> References: To: Mark Wong X-Mailer: Apple Mail (2.3864.300.41.1.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jan 21, 2026, at 02:15, Mark Wong wrote: >=20 > Hi everyone, >=20 > On Tue, Dec 09, 2025 at 03:28:59PM -0800, Mark Wong wrote: >> Hi everyone, >>=20 >> 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. >>=20 >> 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. >>=20 >> Perhaps the most interesting thing to share is the total reduction of >> the lines of code, although system_functions.sql only grows: >>=20 >> 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(-) >>=20 >>=20 >> Is that something we want? >=20 > 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. >=20 > Regards, > Mark >=20 > [1] https://cirrus-ci.com/task/6109065824174080 > -- > Mark Wong > EDB https://enterprisedb.com > = Hi Mark, Thanks for the patch. After reviewing it, I have mixed feelings. =46rom = one side, it removes some redundant code, which is good. In the other = side, I doubt if we should delete proc entries from pg_proc.c? Say, = there is a view that uses a proc to be deleted, the proc OID is stored = with the view, then after an upgrade, the view would be broken. =46rom = this perspective, should we retain the old proc entries and only point = them to the new functions? Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/