-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix panic when dealing with empty sql ident #1808
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,10 @@ func TestParse(t *testing.T) { | |
testData := []struct { | ||
sql string | ||
}{ | ||
// TODO(tschottdorf): shouldn't these below error? | ||
{``}, | ||
{`VALUES ("")`}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, good to know. I'll update the comments in a future commit. |
||
|
||
{`CREATE DATABASE a`}, | ||
{`CREATE DATABASE IF NOT EXISTS a`}, | ||
{`CREATE TABLE a ()`}, | ||
|
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 postgres grammar allows empty statements so that multiple semicolons in statement lists are ignored. For example,
SELECT a FROM b; ; SELECT c FROM d;
. Would be easy to call out an empty statement list as an error inParse()
.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.
ok, will do.