DROP TABLE IF EXISTS Syntax Errors
Symptom
The syntax of a DROP TABLE IF EXISTS statement is incorrect and deletes the wrong table.
Possible Causes
The operations performed by DROP TABLE IF EXISTS are as follows:
- Check whether a table exists on the current CN.
- If it does, deliver the DROP command to other CNs and DNs. If it does not, no operations are required.
A misunderstanding is as follows:
- Deliver DROP TABLE IF EXISTS to all CNs and DNs.
- Each CN or DN drops the table (if it exists).
Solution
If some table definitions exist in only part of the CNs/DNs, do not use the DROP TABLE IF EXISTS statement.
Perform the following operations instead:
- Use the CREATE TABLE IF NOT EXISTS statement to complete the table definition on all the CNs and DNs.
- If the table is no longer necessary, use the DROP TABLE statement on the CN to delete the table definition on all CNs and DNs.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.