Repository navigation
PostgreSQL: Reject string literals as aliases - #2668
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2668 +/- ##
=======================================
Coverage 81.25% 81.25%
=======================================
Files 42 42
Lines 33910 33917 +7
Branches 33910 33917 +7
=======================================
+ Hits 27553 27560 +7
Misses 2792 2792
Partials 3565 3565 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LucaCappelletti94
force-pushed
the
upstream/postgres-no-string-alias
branch
from
October 17, 2026 18:36
836cd19 to
34037e1
Compare
LucaCappelletti94
added this pull request to stack #2670
October 17, 2026 19:00
Contributor
Author
|
Merging, thanks @s5dsn-eqee for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostgreSQL does not accept a single-quoted string as a column or table alias. The
SELECTreference defines both as identifiers (https://www.postgresql.org/docs/current/sql-select.html), and PostgreSQL 16 rejectsSELECT 1 AS 'x',SELECT 1 'x',SELECT a FROM t AS 'y'andSELECT a FROM t 'y'with a syntax error. The parser accepted a string alias in every dialect.A new dialect method,
supports_string_literal_alias, defaults totrueso the other dialects are unchanged, andPostgreSqlDialectsets it tofalse. Tests check the exact errors for column and table aliases in PostgreSQL and that every other dialect still accepts both.