-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve error message for typo in IF NOT EXISTS (#3817)
* refactor: improve error message for typo in IF NOT EXISTS Signed-off-by: tison <[email protected]> * support table name 'if' Signed-off-by: tison <[email protected]> * add sqlness cases Signed-off-by: tison <[email protected]> --------- Signed-off-by: tison <[email protected]>
- Loading branch information
Showing
3 changed files
with
93 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
40 changes: 40 additions & 0 deletions
40
tests/cases/standalone/common/create/create_if_not_exists.result
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
CREATE TABLE IF NOT EXIST t(); | ||
|
||
Error: 2000(InvalidSyntax), Unexpected token while parsing SQL statement: CREATE TABLE IF NOT EXIST t();, expected: 'EXISTS', found: EXIST: sql parser error: Expected EXISTS, found: EXIST at Line: 1, Column 21 | ||
|
||
CREATE TABLE IF NOT t(); | ||
|
||
Error: 2000(InvalidSyntax), Unexpected token while parsing SQL statement: CREATE TABLE IF NOT t();, expected: 'EXISTS', found: t: sql parser error: Expected EXISTS, found: t at Line: 1, Column 21 | ||
|
||
CREATE TABLE IF EXISTS t(); | ||
|
||
Error: 1001(Unsupported), SQL statement is not supported: CREATE TABLE IF EXISTS t();, keyword: EXISTS | ||
|
||
CREATE TABLE IF NOT EXISTS t(); | ||
|
||
Error: 2000(InvalidSyntax), Missing time index constraint | ||
|
||
CREATE TABLE t(); | ||
|
||
Error: 2000(InvalidSyntax), Missing time index constraint | ||
|
||
CREATE TABLE t(ts TIMESTAMP TIME INDEX); | ||
|
||
Affected Rows: 0 | ||
|
||
CREATE TABLE IF(); | ||
|
||
Error: 2000(InvalidSyntax), Missing time index constraint | ||
|
||
CREATE TABLE IF(ts TIMESTAMP TIME INDEX); | ||
|
||
Affected Rows: 0 | ||
|
||
DROP TABLE t; | ||
|
||
Affected Rows: 0 | ||
|
||
DROP TABLE IF; | ||
|
||
Affected Rows: 0 | ||
|
19 changes: 19 additions & 0 deletions
19
tests/cases/standalone/common/create/create_if_not_exists.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE TABLE IF NOT EXIST t(); | ||
|
||
CREATE TABLE IF NOT t(); | ||
|
||
CREATE TABLE IF EXISTS t(); | ||
|
||
CREATE TABLE IF NOT EXISTS t(); | ||
|
||
CREATE TABLE t(); | ||
|
||
CREATE TABLE t(ts TIMESTAMP TIME INDEX); | ||
|
||
CREATE TABLE IF(); | ||
|
||
CREATE TABLE IF(ts TIMESTAMP TIME INDEX); | ||
|
||
DROP TABLE t; | ||
|
||
DROP TABLE IF; |