Repository navigation
fix(postgres): Auto-quote mixed-case identifiers to prevent lowercase… - #11786
Closed
Nikhil172913832 wants to merge 4 commits into
Closed
Nikhil172913832 wants to merge 4 commits into
Nikhil172913832 wants to merge 4 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
|
🔒 Entelligence AI Vulnerability Scanner ✅ No security vulnerabilities found! Your code passed our comprehensive security analysis. 📊 Files Analyzed: 1 files |
Co-authored-by: entelligence-ai-pr-reviews[bot] <174136889+entelligence-ai-pr-reviews[bot]@users.noreply.github.com>
Author
|
Hi @ea-rus, just wanted to check if you could take a look at this PR when you get a chance. |
ea-rus
reviewed
Oct 29, 2025
| query = Select(targets=[Identifier("Test", alias=Identifier("Test2"))]) | ||
| rendered = SqlalchemyRender("postgres").get_string(query, with_failback=False) | ||
| assert rendered == "SELECT Test AS Test2" | ||
| assert rendered == 'SELECT "Test" AS "Test2"' |
Contributor
There was a problem hiding this comment.
we can't add quotes where they didn't existed before parsing
quotes should exist in input sql.
the problem is:
- if backticks are used in input sql - the query is rendered with doubleqoutes
- if doubleqoutes are used - the query doesn't have info about them and it is rendered without them
To fix it I came up to solution on the parser side: mindsdb/mindsdb_sql_parser#70
Contributor
|
This update is not required, we won't support double quotes as escape symbols |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
PostgreSQL folds unquoted identifiers to lowercase, causing "relation not found" errors when querying case-sensitive tables/columns created with quoted identifiers (e.g.,
CREATE TABLE "Notes"). This fix automatically quotes identifiers containing uppercase letters in the PostgreSQL dialect to preserve case according to PostgreSQL specification.Changes:
sqlalchemy_render.pyto auto-quote PostgreSQL identifiers with uppercase lettersFixes #11599
Type of change
(Please delete options that are not relevant)
Verification Process
To ensure the changes are working as expected:
tests/unit/render/test_sqlalchemyrender.pyCREATE TABLE "Notes" (id INT, content TEXT)SELECT * FROM NotesSELECT * FROM "Notes"(preserves case)python -m pytest tests/unit/render/test_sqlalchemyrender.py -vAdditional Media:
Checklist: