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(sql): add DROP ALL TABLES #3438

Merged
merged 33 commits into from
Jul 6, 2023
Merged

feat(sql): add DROP ALL TABLES #3438

merged 33 commits into from
Jul 6, 2023

Conversation

marregui
Copy link
Contributor

@marregui marregui commented Jun 1, 2023

New supported syntax:

DROP ALL TABLES [;]

Each table (with the exception of tables with prefix sys. or telemetry) is treated with the same semantics as:

for each name in tables list:
    DROP TABLE IF EXISTS name

so that non existing table names do not break the statement execution.
In case of failure (table is busy), an exception is thrown to communicate back to the client, however the method is greedy in that it will try to delete all the tables in the list, and report at the end in case of any failure.

@marregui marregui self-assigned this Jun 1, 2023
@marregui marregui changed the title feat(sql): add DROP TABLES name0, name1... feat(sql): add DROP ALL TABLES Jun 12, 2023
@ideoma
Copy link
Collaborator

ideoma commented Jul 4, 2023

[PR Coverage check]

😍 pass : 84 / 85 (98.82%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/SqlCompiler.java 83 84 98.81%
🔵 io/questdb/cairo/CairoEngine.java 1 1 100.00%

@bluestreak01 bluestreak01 merged commit 07af59e into master Jul 6, 2023
21 checks passed
@bluestreak01 bluestreak01 deleted the ma/sqlancer branch July 6, 2023 10:59
// expected syntax: DROP TABLE [ IF EXISTS ] name [;]
CharSequence tok = SqlUtil.fetchNext(lexer);
if (tok == null || !SqlKeywords.isTableKeyword(tok)) {
return unknownDropStatement(executionContext, tok);
Copy link
Contributor

Choose a reason for hiding this comment

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

This change broke enterprise version as both the unknownDropStatement and unknownDropTableSuffix methods were used there. @marregui could you check DropTableTest there and fix it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have created https://github.com/questdb/questdb-enterprise/pull/70 with a propossed fix

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.

None yet

10 participants