Re: updates for handling optional argument in system functions

From: Rui Zhao <zhaorui126(at)gmail(dot)com>
To: Mark Wong <markwkm(at)gmail(dot)com>
Cc: Tristan Partin <tristan(at)partin(dot)io>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: updates for handling optional argument in system functions
Date: 2026-09-25 16:43:19
Message-ID: CAHWVJhEdWgWT=RSHyR4Y7EJeuzgOLkVmov8ptnfYQ3-LpG4yQA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Mark,

I should have been clearer about points 1 and 2 in my last mail:

> 1. Every existing call form behaves the same as before.
>
> 2. pg_upgrade from an unpatched cluster works for views over these
> functions: afterwards the view trees reference pg_proc OIDs
> 2504/2505/2506 instead of 1573/1640/1641, and the views return the
> same rows as before the upgrade.

Those were confirmations that existing calls and views still work.
For the ACL failure later in point 2, I should have stated whether I
thought it needed special handling.

> Do I understand correctly that this is going to be considered an
> unusual and rare occurrence? That we will expect the user to manually
> handle the privileges instead of having pg_upgrade recognize that.

Yes, I think manual handling is reasonable here. I manually restored
the default privileges on pg_get_ruledef(oid) in the old cluster, then
reran pg_upgrade to v10. The upgrade completed.

> Am I misunderstanding?

I meant this as a reminder for developers, especially C extension
authors, when updating their code for the new major version. I'm not
asking you to preserve compatibility with the old C calls.

The macro changes will be caught when rebuilding, but an unchanged
DirectFunctionCall2(pg_get_expr, ...) still compiles with v10 headers;
I checked with -Werror. It needs the explicit third argument, just as
decompile_conbin() now passes BoolGetDatum(false) in
DirectFunctionCall3(). Recompiling alone doesn't fix that call.

I rebuilt and retested v10. LGTM.

One small comment remains: pg_get_indexdef() still says "In the extended
version, there is a colno argument as well as pretty bool." There is
only one version now, so that sentence could describe the arguments
without the "extended version" distinction.

Regards,
Rui

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-09-25 16:46:46 Re: ON CONFLICT DO SELECT returns rows hidden by a view
Previous Message Thom Brown 2026-09-25 16:28:12 REPACK (CONCURRENTLY) can lose data in pg_dump output