Skip to content
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

feat: improve error message for typo in IF NOT EXISTS #3817

Merged
merged 3 commits into from
Apr 28, 2024

Conversation

tisonkun
Copy link
Contributor

@tisonkun tisonkun commented Apr 26, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

This closes #3471.

Result:

public=> CREATE TABLE IF NOT EXIST t();
ERROR:  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
public=> CREATE TABLE IF NOT t();
ERROR:  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
public=> CREATE TABLE IF EXISTS t();
ERROR:  SQL statement is not supported: CREATE TABLE IF EXISTS t();, keyword: EXISTS
public=> CREATE TABLE IF EXIST t();
ERROR:  Missing time index constraint
public=> CREATE TABLE t();
ERROR:  Missing time index constraint
public=> CREATE TABLE t(ts TIMESTAMP TIME INDEX);
OK 0
public=> CREATE TABLE IF();
ERROR:  Missing time index constraint
public=> CREATE TABLE IF(ts TIMESTAMP TIME INDEX);
OK 0
public=> DROP TABLE t;
OK 0
public=> DROP TABLE IF;
OK 0

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@tisonkun tisonkun requested a review from a team as a code owner April 26, 2024 16:43
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Apr 26, 2024
@tisonkun tisonkun changed the title refactor: improve error message for typo in IF NOT EXISTS feat: improve error message for typo in IF NOT EXISTS Apr 26, 2024
Copy link

codecov bot commented Apr 26, 2024

Codecov Report

Attention: Patch coverage is 83.87097% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 85.32%. Comparing base (e410192) to head (0c4282d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3817      +/-   ##
==========================================
- Coverage   85.60%   85.32%   -0.29%     
==========================================
  Files         955      955              
  Lines      163104   163125      +21     
==========================================
- Hits       139625   139181     -444     
- Misses      23479    23944     +465     

Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some sqlness cases?

Signed-off-by: tison <[email protected]>
@tisonkun
Copy link
Contributor Author

@killme2008 added. The sample queries above are added as a new sqlness case create_if_not_exists.sql

@waynexia waynexia added this pull request to the merge queue Apr 28, 2024
Merged via the queue into GreptimeTeam:main with commit 1bbde15 Apr 28, 2024
19 checks passed
@tisonkun tisonkun deleted the issue-3471 branch April 28, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading error message for SQL typo
4 participants