Conversation
…CEDURE
`SET name { TO | = } value, ...`, `SET name = DEFAULT` and `SET name
FROM CURRENT` are accepted among the other function options, before or
after the body. `create_function` and `create_procedure` take right
associativity so a trailing `SET` binds to the definition rather than
starting a new statement inside a T-SQL `WHILE ... BEGIN ... END`.
Closes DerekStride#364
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
DerekStride
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CREATE FUNCTION ... SET search_path = public, pg_temp AS $$ ... $$does not parse; #364 reports it. Any function that pinssearch_path(mostSECURITY DEFINERfunctions, and every function in pg_partman) fails at theSET.Solution
A
function_setoption:SET name { TO | = } value [, value ...], withDEFAULT,ONandOFFas values likeset_statement, plusSET name FROM CURRENT. It joins the other options oncreate_functionandcreate_procedure, so it is accepted before or after the body in any order.create_functionandcreate_procedureare nowprec.right. Without it a trailingSETinside a T-SQLWHILE cond BEGIN ... ENDbody, where statements have no terminating semicolon, could also be read as the next statement; right associativity keeps it with the definition, which is the PostgreSQL reading.Notes
tree-sitter test: 511 corpus tests onmain, 513 with this PR (one each infunctions.txtandprocedures.txt), plus the 2 highlight tests.scripts/test-keywords.shpasses; no new keywords.STATE_COUNT30622 → 30703 (+0.3%),parser.c41.6 MB → 41.7 MB.Closes #364