Skip to content

Backport #8873: Qualify and quote the support function in ALTER FUNCTION .. SUPPORT (release-13.2) - #8910

Merged
ibrahim halatci (ihalatci) merged 1 commit into
bp-8818-release-13.2from
bp-8873-release-13.2
Oct 21, 2026
Merged

ibrahim halatci (ihalatci) merged 1 commit into
bp-8818-release-13.2from
bp-8873-release-13.2

Conversation

@ihalatci

Copy link
Copy Markdown
Contributor

Backports #8873 (commit bfb8600) to release-13.2.

Description

Qualify and quote the support function in \ALTER FUNCTION .. SUPPORT.

  • \QualifyAlterFunctionStmt\ resolves the support function using \LookupFuncName\ and qualifies it with its schema.
  • The deparser prints the name with \NameListToQuotedString.

Validation

Tested locally on PostgreSQL 17 with regression test \ unction_propagation.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (bp-8818-release-13.2@2fa6ffb). Learn more about missing BASE report.

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@                   Coverage Diff                   @@
##             bp-8818-release-13.2    #8910   +/-   ##
=======================================================
  Coverage                        ?   29.15%           
=======================================================
  Files                           ?      289           
  Lines                           ?    64353           
  Branches                        ?     8066           
=======================================================
  Hits                            ?    18762           
  Misses                          ?    43398           
  Partials                        ?     2193           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ihalatci
ibrahim halatci (ihalatci) changed the base branch from release-13.2 to bp-8818-release-13.2 October 14, 2026 07:35
…8873)

DESCRIPTION: Fixes ALTER FUNCTION .. SUPPORT with a user-defined support
function

`ALTER FUNCTION f SUPPORT my_support` on a distributed function sends
the support function name to the workers exactly as the user typed it.
The workers run the command without the coordinator's `search_path`, so
this only works when the support function is in `public` or
`pg_catalog`. Here the support function exists on every node, in the
same schema as `f`:

```
ALTER FUNCTION func_with_support_2(int, int) SUPPORT my_support;
ERROR:  function my_support(internal) does not exist
CONTEXT:  while executing command on localhost:57638
```

A name that needs quoting also fails, because `AppendDefElemSupport`
prints it with `defGetString`:

```
ALTER FUNCTION func_with_support(int, int) SUPPORT "Support Func";
ERROR:  syntax error at or near "Func"
```

#5849 (for #5844) made the command valid by assuming the support
function exists on the workers. This PR keeps that assumption and
changes two things:

- `QualifyAlterFunctionStmt` resolves the support function the same way
postgres does (`LookupFuncName` with a single `internal` argument) and
qualifies it with its schema.
- The deparser prints the name with `NameListToQuotedString`.

**Test.** I added cases to `function_propagation.sql` for an unqualified
support function in the test schema and for a quoted support function
name. They check `prosupport` on the workers.

- On `main` @ c267b0b, both `ALTER`s fail as shown above and the workers
keep `generate_series_int8_support`.
- With the fix, the workers show `function_propagation_schema."Support
Func", function_propagation_schema.my_support`.

I ran this on PG 17.11 in Docker with `make check-custom-schedule`
(minimal cluster setup + `function_propagation`). `uncrustify` with the
citus-style config reports no changes.

This PR was prepared with an AI coding agent (Claude) working for the
breken-ai account. I reviewed the change and the test output.

(cherry picked from commit bfb8600)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d89d1f43-18ea-4405-bd1b-5c3129e391a9
@ihalatci
ibrahim halatci (ihalatci) merged commit 4a0803c into release-13.2 Oct 21, 2026
352 of 453 checks passed
@ihalatci
ibrahim halatci (ihalatci) deleted the bp-8873-release-13.2 branch October 21, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants