v.24.9New Feature
Add create_if_not_exists setting for default IF NOT EXISTS behavior in CREATE statements
Addcreate_if_not_existssetting to default toIF NOT EXISTSbehavior during CREATE statements. #68164 (Peter Nguyen).
Why it matters
This feature prevents errors fromCREATE statements when the target object (like a table or database) already exists. It simplifies script execution and automates idempotency by avoiding the need to manually add IF NOT EXISTS to every CREATE statement.How to use it
Enable the feature by settingcreate_if_not_exists to 1 in the session or query settings. For example:SET create_if_not_exists = 1;
-- Now all CREATE statements will behave as if <code>IF NOT EXISTS</code> is specified
CREATE TABLE example_table (...);This applies to all
CREATE queries executed under this setting.