Skip to content

PostgreSQL: Accept a signed CONNECTION LIMIT in CREATE ROLE and ALTER ROLE - #2731

Merged
LucaCappelletti94 merged 2 commits into
mainfrom
upstream/pg-signed-connection-limit
Oct 27, 2026
Merged

LucaCappelletti94 merged 2 commits into
mainfrom
upstream/pg-signed-connection-limit

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

CREATE ROLE a CONNECTION LIMIT -1 and ALTER ROLE a CONNECTION LIMIT -1 failed to parse under PostgreSqlDialect. PostgreSQL's role grammar takes a signed integer after CONNECTION LIMIT, and -1 is the documented way to remove the limit (https://www.postgresql.org/docs/current/sql-createrole.html). PostgreSQL 18 accepts both statements and stores -1.

Both sites read the limit with parse_number_value, which only takes an unsigned literal. They now call parse_number, which takes an optional sign and returns Expr::UnaryOp for a signed value. CreateRole::connection_limit and RoleOption::ConnectionLimit already hold an Expr, so the AST is unchanged. Range checking stays with the engine, since PostgreSQL rejects other negative values only after parsing.

@LucaCappelletti94 LucaCappelletti94 added bug Something isn't working PostgreSQL labels 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.32%. Comparing base (23e9e88) to head (4345af1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2731      +/-   ##
==========================================
+ Coverage   82.30%   82.32%   +0.02%     
==========================================
  Files          42       42              
  Lines       35294    35294              
  Branches    35294    35294              
==========================================
+ Hits        29047    29056       +9     
+ Misses       2690     2682       -8     
+ Partials     3557     3556       -1     

☔ 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

Copy link
Copy Markdown
Contributor Author

cc @alamb I will proceed to merge this one because it only simplifies, fixes a bug and adds tests to avoid their regression.

@LucaCappelletti94
LucaCappelletti94 added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 4c82c3a Oct 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants