Skip to content

fix: quote function config_params values in CREATE FUNCTION SET - #1144

Open
hsusul wants to merge 1 commit into
supabase:masterfrom
hsusul:fix/function-config-params-quote
Open

fix: quote function config_params values in CREATE FUNCTION SET#1144
hsusul wants to merge 1 commit into
supabase:masterfrom
hsusul:fix/function-config-params-quote

Conversation

@hsusul

@hsusul hsusul commented Sep 4, 2026

Copy link
Copy Markdown

Summary

  • Fixes Function create/update fails for config_params like statement_timeout #1142: SET statement_timeout TO 5s (and similar) from functions.create / regenerate-on-update is invalid SQL.
  • Quote GUC values with literal(), split list GUCs like search_path into individually quoted items, and ident() the parameter name — aligned with role config quoting.
  • Also fixes the broken FROM CURRENT check (value[0] === 'FROM CURRENT' compared the first character, so it never matched).

Test plan

  • npx vitest run test/index.test.ts -t "create function with statement_timeout|retrieve, create, update, delete"
  • Studio: create a function with statement_timeout = 5s config

Unquoted values like statement_timeout TO 5s are invalid SQL. Quote
GUC values (and list items such as search_path) the same way roles do.
@hsusul
hsusul requested review from a team, avallete and soedirgo as code owners September 4, 2026 18:28
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.

Function create/update fails for config_params like statement_timeout

1 participant