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 79.16667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.21%. Comparing base (bac1468) to head (7d35f4d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/parser/mod.rs 83.33% 0 Missing and 3 partials ⚠️
src/ast/mod.rs 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2841   +/-   ##
=======================================
  Coverage   83.20%   83.21%           
=======================================
  Files          42       42           
  Lines       36471    36489   +18     
  Branches    36471    36489   +18     
=======================================
+ Hits        30345    30363   +18     
+ Misses       2632     2630    -2     
- Partials     3494     3496    +2     

☔ 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
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