Skip to content

PostgreSQL: Support string bodies in CREATE PROCEDURE - #2841

Open
MrBisonte wants to merge 2 commits into
apache:mainfrom
MrBisonte:feat/postgres-procedure-string-body
Open

MrBisonte wants to merge 2 commits into
apache:mainfrom
MrBisonte:feat/postgres-procedure-string-body

Conversation

@MrBisonte

Copy link
Copy Markdown

Dialects: PostgreSQL, Generic

CREATE PROCEDURE insert_data(a integer, b integer) LANGUAGE SQL AS $$ INSERT INTO tbl VALUES (a); INSERT INTO tbl VALUES (b); $$, the first example of https://www.postgresql.org/docs/current/sql-createprocedure.html, failed with Expected: an SQL statement, found: $$ .... parse_create_procedure read everything after AS as statements, the MSSQL form, so a single quoted body, AS 'definition', failed the same way.

A string after AS now becomes CreateProcedureBody::AsString { body, link_symbol }, read by the code that already reads a CREATE FUNCTION string body, moved into parse_definition_string. LANGUAGE may also follow the string, and prints before AS, as it does for CREATE FUNCTION. Any other token after AS keeps the statement path.

CREATE OR REPLACE PROCEDURE is still rejected, and will follow in its own PR.

Written with an AI coding assistant.

@codecov-commenter

codecov-commenter commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.25%. Comparing base (2ddee55) to head (477cf3b).

Files with missing lines Patch % Lines
src/parser/mod.rs 83.33% 0 Missing and 3 partials ⚠️
src/ast/mod.rs 60.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2841      +/-   ##
==========================================
+ Coverage   83.23%   83.25%   +0.01%     
==========================================
  Files          42       42              
  Lines       36524    35363    -1161     
  Branches    36524    35363    -1161     
==========================================
- Hits        30402    29442     -960     
+ Misses       2628     2473     -155     
+ Partials     3494     3448      -46     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/parser/mod.rs Resolved
Comment thread tests/sqlparser_common.rs Resolved
@LucaCappelletti94 LucaCappelletti94 added enhancement New feature or request api change waiting on contributor The review needs further refinements by its author labels Nov 7, 2026

@LucaCappelletti94 LucaCappelletti94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase it, but besides it seems ready to merge.

@MrBisonte
MrBisonte force-pushed the feat/postgres-procedure-string-body branch from 7d35f4d to 477cf3b Compare November 12, 2026 20:20
@MrBisonte
MrBisonte force-pushed the feat/postgres-procedure-string-body branch from 477cf3b to 06eb115 Compare November 14, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change enhancement New feature or request PostgreSQL waiting on contributor The review needs further refinements by its author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants