Skip to content

PostgreSQL: Accept CREATE EXTENSION options without WITH and in any order - #2742

Open
LucaCappelletti94 wants to merge 4 commits into
mainfrom
upstream/create-extension-schema
Open

LucaCappelletti94 wants to merge 4 commits into
mainfrom
upstream/create-extension-schema

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

CREATE EXTENSION hstore SCHEMA exts failed to parse under PostgreSqlDialect with Expected: end of statement, found: SCHEMA, and so did options written out of order, such as CREATE EXTENSION pgcrypto WITH VERSION '1.3' SCHEMA exts. PostgreSQL makes WITH optional and takes SCHEMA, VERSION and CASCADE in any order (https://www.postgresql.org/docs/current/sql-createextension.html). PostgreSQL 18 accepts both statements and rejects an option given twice with conflicting or redundant options.

Some of these valid syntaxes look rather odd, but I did verify that each works.

parse_create_extension now reads an optional WITH and then the options in any order, rejecting a repeated one. CreateExtension gains a with_keyword field so both spellings round-trip. The options stay in the existing schema, version and cascade fields, so Display writes them in that order.

@LucaCappelletti94 LucaCappelletti94 added the enhancement New feature or request label Oct 27, 2026
@codecov-commenter

codecov-commenter commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.57%. Comparing base (9f66d76) to head (cff51ad).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2742      +/-   ##
==========================================
+ Coverage   82.54%   82.57%   +0.02%     
==========================================
  Files          42       42              
  Lines       35556    35562       +6     
  Branches    35556    35562       +6     
==========================================
+ Hits        29349    29364      +15     
+ Misses       2672     2670       -2     
+ Partials     3535     3528       -7     

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

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/create-extension-schema branch from 20a5001 to cff51ad Compare October 30, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants