Skip to content

Structure SQL Server routine operations and table return types - #2593

Merged
manticore-projects merged 3 commits into
JSQLParser:masterfrom
minleejae:feat/sqlserver-routine-declarations
Sep 11, 2026
Merged

Structure SQL Server routine operations and table return types#2593
manticore-projects merged 3 commits into
JSQLParser:masterfrom
minleejae:feat/sqlserver-routine-declarations

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

Fixes #1978. Fixes #715.

Under Dialect.SQLSERVER, CREATE, ALTER and CREATE OR ALTER FUNCTION/PROCEDURE share one declaration path. CreateFunctionalStatement.getOperation() exposes the operation, and FunctionReturnType structures scalar returns, inline RETURNS TABLE, and named return tables with ordered columns and constraints. Return tables reuse existing TableElement models, traversal and deparsing, so AST edits and custom expression visitors affect emitted SQL.

The reported function and procedure examples are covered. Function capture balances nested blocks and CASE expressions without consuming the next statement. Procedure definitions preserve their entire batch, including statements after END, transactions and TRY/CATCH. Parse procedures one batch at a time; client-side GO splitting is not added. Parameters, options and bodies remain token lists, and other dialects retain the existing representation. Table discovery still rejects opaque routine bodies.

Validation: full Gradle check and Maven verify, including operation capability checks, table constraints, AST mutation, visitor context, custom deparsing, script boundaries, original examples and existing function/procedure regressions.

References: CREATE FUNCTION, CREATE PROCEDURE.

@manticore-projects
manticore-projects merged commit d18de82 into JSQLParser:master Sep 11, 2026
9 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants