-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-133439: Fix dot commands with trailing spaces are mistaken for multi-line sqlite statements in the sqlite3 command-line interface #133440
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
gh-133439: Fix dot commands with trailing spaces are mistaken for multi-line sqlite statements in the sqlite3 command-line interface #133440
Conversation
d756211
to
0d89da8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sqlite3 CLI supports also space after dot:
sqlite> . version
SQLite 3.45.1 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257ccalt1
zlib version 1.3
gcc-13.3.0 (64-bit)
But not before dot:
sqlite> .version
...>
To be conforming with it, we should check if the first character is a dot, and if it is, use source[1:].strip()
as the command. No stripping is needed for the SQL statement.
0d89da8
to
3543c33
Compare
Thank you for your review! I have modified the code to use |
3543c33
to
a4498ab
Compare
Misc/NEWS.d/next/Library/2025-05-05-22-11-24.gh-issue-133439.LpmyFz.rst
Outdated
Show resolved
Hide resolved
cbea2b1
to
487aafc
Compare
487aafc
to
b473fe9
Compare
Sorry for the overlook, now the empty source and unknown dot commands are handled. I have improved the news entry. |
36b4a16
to
caf47bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
Head branch was pushed to by a user without write access
Thanks @tanloong for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440) (cherry picked from commit ebd4881) Co-authored-by: Tan Long <tanloong@foxmail.com>
GH-133738 is a backport of this pull request to the 3.14 branch. |
@serhiy-storchaka no 3.13 backports? |
This is borderline between minor bug fix and minor feature. It improves the quality of life a little, but most people won't notice anything. If anyone wants to backport to 3.13, please do. If not, no problem either. |
I will do that. |
GH-133765 is a backport of this pull request to the 3.13 branch. |
@tanloong, I meant any of the core developers. It's as simple as adding a label. Someone just has to want to do it. |
Ah, sorry, I misunderstood. |
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440) (cherry picked from commit ebd4881)
pass | ||
case _ as unknown: | ||
self.write("Error: unknown command or invalid arguments:" | ||
f' "{unknown}".\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error messages do not end with a '.' e.g.:
Python 3.15.0a0 (heads/main:c81fa2b9cd1, May 8 2025, 16:38:25) [GCC 15.1.1 20250425 (Red Hat 15.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> test
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
test
NameError: name 'test' is not defined
Issue: sqlite3 CLI does not recognize dot commands with trailing spaces #133439