Skip to content

fix: handle statements with only semicolons/whitespace#500

Open
SAY-5 wants to merge 2 commits into
crate:mainfrom
SAY-5:fix-499-empty-stmt
Open

fix: handle statements with only semicolons/whitespace#500
SAY-5 wants to merge 2 commits into
crate:mainfrom
SAY-5:fix-499-empty-stmt

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 11, 2026

Fixes #499.

Entering ; at the crash prompt crashed with IndexError: list index out of range. The first token of the parsed statement is a Punctuation, and re.findall(r'[\w]+', ';')[0] indexes an empty list. Skip empty statements in _process_sql and harden stmt_type to return '' when the statement has no word tokens. Regression test added in CommandUtilsTest.test_stmt_type_punctuation_only_does_not_crash.

SAY-5 added 2 commits May 11, 2026 14:56
Input consisting solely of ';' produced a statement whose first token
is Punctuation. stmt_type then called re.findall(r'[\w]+', ';')[0],
raising IndexError. Skip empty statements in _process_sql and harden
stmt_type to return '' when the statement contains no word tokens.

Fixes crate#499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash crashes when handling a statement with semicolons only

1 participant