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 1wAHoW-002El7-3B for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 01:34:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAHoU-003lBK-1V for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 01:34:38 +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 1wAHoU-003lBA-0a for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 01:34:38 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAHoS-000000018Ud-0vgz for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 01:34:37 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2addb31945aso40260705ad.1 for ; Tue, 07 Apr 2026 18:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775612075; x=1776216875; 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=x+B7m1dmmY4VlzEp0voM7YGzxqpzDF0qTUi5bn9SwYU=; b=diMh0ZW2EBFMZsGg2xMBZBW4QZCroOEXjKN+0nuPZeloyAcjOd0u70nkt9rJNdoRRV pRcbDMtPma27s9AbuEEGZBNG4APNW338diaKY4dHztWfRo7bLpxgC1C5i7KILZn1PoWt mEEEOFvHEL2b9yOehHQY3o7dRuT81Nvjxey1x05iFgzmW6NnsOvFyHvcF4kUShEHssmf ojmLb5G4AZW2xos7KbPEeJB3hrg/CgIKKoFinWXf0NegPd7EAHZqThOHoQeozJlrGYvP 3r0SgK0zz49F+oImcNd1wDI8dvieuQhE7B2kyZY5BE5vkCoQguNXCh2g3oAv9R+GsmkN Jz3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775612075; x=1776216875; 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=x+B7m1dmmY4VlzEp0voM7YGzxqpzDF0qTUi5bn9SwYU=; b=NHClLGOvGTe8eCPlwHCbwa2IGFuS331sBFCqsPYAxQ3+IR5xiWqjSCvWqEmvJysq6H TI3rd4/8LWcfiIwXSpGt2E4SPYC7iiDcelgxqh8zCxM/B3on2OKLg9fpSpgnZJAV5mCj EXuNkeLFLOGBiGD6s5omDqFbEnaSyfKVdNjHZ3Jv7bkMt1mWNaQBz+rngf7QV6FfZ9Dm Jlmhr5T/LP3iEIE3nuzipWaKG0DKAPmUPYMS0Db2sw8yVvCNSfgV76/Y2KJmWW/gtL2F iuA0X0EDsuV2XSgGLmAk1SvPkcTz5d36SZCPZFl5MXiSWB2oKjmmtiMgRTccZRb0pzPj aa8A== X-Forwarded-Encrypted: i=1; AJvYcCWq3haUse+LqZGDszfdhH23Vv7pXytuMvTTA8/bULU8AaGsnjx/Q8f0kcOBdMv5tPw3UKDflZ2S9+RbJ5kd@lists.postgresql.org X-Gm-Message-State: AOJu0YxbiSOpBASXl54CSim/b96k3a7zNn12s5Hts3NwtA0fVg3crhQa hagGTURSGyhkf5RDH0kmNqQ614KNUjKBxhPn1gOk2/eu9UXjlHLtL22EvcbZnPh8G3yx/g== X-Gm-Gg: AeBDieu1hRkg0KqY2FJ0ZM9DeLzRIEWoSPV4O1z1uc08J5QbRqQlNnqnx48j9TFNtsF INURPzuYqTYBQ3DUSSFnQFqd0NRW2FNWAEEM5/5KpcIlNw1pze5qEhU8dBVJJzVJzDj7OUxvQAf vO6cSXJ9yuQ3B/C/Ntcp2/jsRjfkhjvsKRoRQ7vf6gLlf7GagGPkjfkf70fxHpS3ezx3tCgNixE R09/+YIHRKz4N9KpbA0jfLgnlCkub7Pz/hZyr+4NM2iLCBi0ZBm2vfoKJ0mR78Dd2GGe6O09g0T BkgsZrXvwIaQQJho4LRrFG4IBAGlXQO8enw1yk1yw1N+TyzXeXgo1MUVjgersl9/vP3c/nsJxH2 DfbwAzGyu/qc1nSA04SsURUKOwYaVJKp+BYZzPz0mTBnVkCxJ+gHXUtu0aEMmbuWacsVpQL8Z3+ 0XglgQH+RBhB6iKW4uMTftkutiFjnqPZw= X-Received: by 2002:a17:903:2c05:b0:2b2:5840:809c with SMTP id d9443c01a7336-2b281828136mr202428755ad.1.1775612075535; Tue, 07 Apr 2026 18:34:35 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b274757fa7sm182018365ad.21.2026.04.07.18.34.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2026 18:34:34 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: updates for handling optional argument in system functions From: Chao Li In-Reply-To: Date: Wed, 8 Apr 2026 09:33:56 +0800 Cc: Andreas Karlsson , pgsql-hackers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <576EE368-AFB1-4375-BB77-A04CE92CC2A4@gmail.com> References: <6de20662-36fd-4e00-a0b0-75d1e9deb5c8@proxel.se> <9e3ad0f4-c4ef-436b-a5a1-28f600d76a61@proxel.se> To: Mark Wong X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Apr 8, 2026, at 07:44, Mark Wong wrote: >=20 > On Wed, Apr 08, 2026 at 01:28:29AM +0200, Andreas Karlsson wrote: >> On 4/8/26 12:26 AM, Andreas Karlsson wrote: >>> On 4/2/26 8:36 PM, Mark Wong wrote: >>>> I've attached v5, simply a needed rebase due to some other churn in >>>> pg_proc.dat. >>>=20 >>> Nice, I like the patch. The code changes looks good and I like the=20= >>> removal of these duplicate functions and use of default arguments. = But I=20 >>> think the names of the arguments should be aligned with the names we=20= >>> have in the documentation. And that may mean that we should change = the=20 >>> documentation. >> Forgot to attach rebased patches. >=20 > Another rebase needed so quickly? :) Thanks for the assist! >=20 > Regards, > Mark I still have the question as I raised previously. Let=E2=80=99s use 0001 = as an example. 0001 removes function 1573. Say, an existing view depends on 1573: ``` evantest=3D# CREATE VIEW v_ruledef AS evantest-# SELECT pg_get_ruledef(oid) AS ruledef evantest-# FROM pg_rewrite evantest-# WHERE rulename =3D '_RETURN'; CREATE VIEW ``` The view is stored as: ``` _RETURN | v_ruledef | ({QUERY :commandType 1 :querySource 0 :canSetTag = true :utilityStmt <> :resultRelation 0 :forPortionOf <> :hasAggs false = :hasWindowFuncs false :hasTargetSRFs false :hasSubLinks false = :hasDistinctOn false :hasRecursive false :hasModifyingCTE false = :hasForUpdate false :hasRowSecurity false :hasGroupRTE false :isReturn = false :cteList <> :rtable ({RANGETBLENTRY :alias <> :eref {ALIAS = :aliasname pg_rewrite :colnames ("oid" "rulename" "ev_class" "ev_type" = "ev_enabled" "is_instead" "ev_qual" "ev_action")} :rtekind 0 :relid 2618 = :inh true :relkind r :rellockmode 1 :perminfoindex 1 :tablesample <> = :lateral false :inFromCl true :securityQuals <>}) :rteperminfos = ({RTEPERMISSIONINFO :relid 2618 :inh true :requiredPerms 2 :checkAsUser = 0 :selectedCols (b 8 9) :insertedCols (b) :updatedCols (b)}) :jointree = {FROMEXPR :fromlist ({RANGETBLREF :rtindex 1}) :quals {OPEXPR :opno 93 = :opfuncid 62 :opresulttype 16 :opretset false :opcollid 0 :inputcollid = 950 :args ({VAR :varno 1 :varattno 2 :vartype 19 :vartypmod -1 = :varcollid 950 :varnullingrels (b) :varlevelsup 0 :varreturningtype 0 = :varnosyn 1 :varattnosyn 2 :location -1} {CONST :consttype 19 = :consttypmod -1 :constcollid 950 :constlen 64 :constbyval false = :constisnull false :location -1 :constvalue 64 [ 95 82 69 84 85 82 78 0 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]}) :location -1}} = :mergeActionList <> :mergeTargetRelation 0 :mergeJoinCondition <> = :targetList ({TARGETENTRY :expr {FUNCEXPR :funcid 1573 :funcresulttype = 25 :funcretset false :funcvariadic false :funcformat 0 :funccollid 100 = :inputcollid 0 :args ({VAR :varno 1 :varattno 1 :vartype 26 :vartypmod = -1 :varcollid 0 :varnullingrels (b) :varlevelsup 0 :varreturningtype 0 = :varnosyn 1 :varattnosyn 1 :location -1}) :location -1} :resno 1 = :resname ruledef :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk = false}) :override 0 :onConflict <> :returningOldAlias <> = :returningNewAlias <> :returningList <> :groupClause <> :groupDistinct = false :groupByAll false :groupingSets <> :havingQual <> :windowClause <> = :distinctClause <> :sortClause <> :limitOffset <> :limitCount <> = :limitOption 0 :rowMarks <> :setOperations <> :constraintDeps <> = :withCheckOptions <> :stmt_location -1 :stmt_len -1}) ``` We can clearly see ":expr {FUNCEXPR :funcid 1573 =E2=80=9C. With this patch, will that view break? How would users find all such = broken views? Maybe PostgreSQL already has some recommended way to = handle this kind of situation that I am not aware of? Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/