v.24.9New Feature

Add create_if_not_exists setting for default IF NOT EXISTS behavior in CREATE statements

Add create_if_not_exists setting to default to IF NOT EXISTS behavior during CREATE statements. #68164 (Peter Nguyen).
Introduces the create_if_not_exists setting which enables IF NOT EXISTS behavior by default during CREATE statements.

Why it matters

This feature prevents errors from CREATE 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 setting create_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.