feat: add CREATE PROCEDURE grammar support#355
Merged
matthias-Q merged 3 commits intoDerekStride:mainfrom Feb 11, 2026
Merged
Conversation
Add `create_procedure` statement rule supporting: - PostgreSQL: dollar-quoted bodies, OR REPLACE, LANGUAGE, SECURITY - T-SQL: AS BEGIN...END with optional DECLARE - MySQL/MariaDB: DEFINER clause, IF NOT EXISTS Also adds: - `drop_procedure` with IF EXISTS and CASCADE support - COMMENT ON PROCEDURE support (resolves TODO in comment.js) - Test corpus with 10 test cases across dialects Closes DerekStride#354 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 10, 2026
- integer type: use (int (keyword_int)) instead of (keyword_integer) - INSERT: add (keyword_values) node, remove (term value:) wrapper - DELETE: split into (delete)/(from) siblings instead of nesting - SELECT: move (from) out of (select) as sibling under (statement) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The object_reference grammar rule uses field('schema', ...) and
field('name', ...) for schema-qualified identifiers. The test
expectations for schema-qualified procedure names (public.refresh_cache,
dbo.GetUsers, etc.) were missing these field labels.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
Fixed the 4 failing corpus tests ( The issue was that test expectations for schema-qualified procedure names (e.g. |
matthias-Q
approved these changes
Feb 11, 2026
Collaborator
matthias-Q
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the PR.
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.
Summary
create_procedurestatement rule with support for PostgreSQL (dollar-quoted bodies, OR REPLACE, LANGUAGE, SECURITY), T-SQL (AS BEGIN...END with optional DECLARE), and MySQL/MariaDB (DEFINER clause, IF NOT EXISTS)drop_procedurewith IF EXISTS and CASCADE support// TODO: procedureincomment.jsby adding COMMENT ON PROCEDURE supportContext
Filed as #354 — the original issue reported both CREATE PROCEDURE and CREATE TRIGGER as missing, but after examining the grammar, CREATE TRIGGER is already fully implemented. The real gap was CREATE PROCEDURE only (the issue has been updated with this correction).
Implementation
Mirrors the existing
create-function.jspattern:grammar/statements/create-procedure.jswithcreate_procedure,procedure_body, and_tsql_procedure_body_statementrulesprocedure_bodyreuses_function_body_statementandfunction_declarationfrom the function grammarTest plan
tree-sitter generatesucceeds with no new warningstest/corpus/procedures.txtcovering:integertype: use(int (keyword_int))consistent with existing function tests(keyword_values)node, bare field references in list (notermwrapper)fromas sibling ofdelete/selectunderstatement, matchingdelete.txtandselect.txtpatternsCloses #354
🤖 Generated with Claude Code