-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite3 bug handling column names that contain square braces #83833
Comments
Bit of an obscure bug this one. SQLite allows column names to contain [ and ] characters, even though those are often used as delimiters in SQLite. Here's how to create such a database with bash:
If you query that database from sqlite3 in Python, the
As you can see, it is missing from both But... if you query that database using SQLite directly (with
It looks to me like this is a bug in Python's SQLite3 module. This was first reported here: simonw/sqlite-utils#86 |
Thanks for reporting this issue, I have a PR here #18533 but that still needs some clarification, because there were some tests that were actually testing that we were stripping everything after the square brackets. P.D. this is my first contribution :) |
Oh how interesting - yes it looks like this is deliberate behavior introduced in this commit: 0e3f591 |
ghaering/pysqlite@f3d452f should probably give more context than that huge svnmerge commit :) (Removed older Python versions since even if decide to change the behavior from 2006, it may break third-party programs that are relying on it.) |
It was originally introduced in ghaering/pysqlite@780a76d. I think that original column names should be returned when PARSE_COLNAMES is not set. Working on a PR. |
Sorry Raul, but I already have a PR written. It includes minor refactoring, better error handling in the nearby code, improved tests, fixed documentation and comments which incorrectly described the current behavior. It took time to determine what parts should be fixed, and unless you have found all this in your PR it would take much more time to explain to you what details should be checked than check and fix them myself. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: