diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-13 10:52:00 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-14 12:51:58 -0400 |
| commit | 94a1c523984e2082bb16d784cf8615061ba9d49a (patch) | |
| tree | 73892187edabbfa4a371631c3407510cfdea9313 /lib/sqlalchemy/dialects | |
| parent | de7f14104d5278987fa72d6866fa39569e56077e (diff) | |
| download | sqlalchemy-94a1c523984e2082bb16d784cf8615061ba9d49a.tar.gz | |
Support DEFAULT VALUES and VALUES(DEFAULT) individually
Fixed regression where the introduction of the INSERT syntax "INSERT...
VALUES (DEFAULT)" was not supported on some backends that do however
support "INSERT..DEFAULT VALUES", including SQLite. The two syntaxes are
now each individually supported or non-supported for each dialect, for
example MySQL supports "VALUES (DEFAULT)" but not "DEFAULT VALUES".
Support for Oracle is still not enabled as there are unresolved issues
in using RETURNING at the same time.
Fixes: #6254
Change-Id: I47959bc826e3d9d2396ccfa290eb084841b02e77
Diffstat (limited to 'lib/sqlalchemy/dialects')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 5 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/oracle/base.py | 4 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/sqlite/base.py | 5 |
4 files changed, 17 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 3966126e2..b576fa959 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2534,6 +2534,11 @@ class MySQLDialect(default.DefaultDialect): supports_for_update_of = False # default for MySQL ... # ... may be updated to True for MySQL 8+ in initialize() + # MySQL doesn't support "DEFAULT VALUES" but *does* support + # "VALUES (DEFAULT)" + supports_default_values = False + supports_default_metavalue = True + supports_sane_rowcount = True supports_sane_multi_rowcount = False supports_multivalues_insert = True diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py index 11ad61675..c25cfb781 100644 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@ -1453,7 +1453,11 @@ class OracleDialect(default.DefaultDialect): requires_name_normalize = True supports_comments = True + + # Oracle supports these syntaxes but I'm not able to get them + # to work with RETURNING which we usually need supports_default_values = False + supports_default_metavalue = True supports_empty_insert = False statement_compiler = OracleCompiler diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index d0915a0c9..c6f71c00c 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -3079,6 +3079,9 @@ class PGDialect(default.DefaultDialect): supports_comments = True supports_default_values = True + + supports_default_metavalue = True + supports_empty_insert = False supports_multivalues_insert = True default_paramstyle = "pyformat" diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index 83c2a8ea7..17cd37b49 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -1791,7 +1791,12 @@ class SQLiteDialect(default.DefaultDialect): supports_alter = False supports_unicode_statements = True supports_unicode_binds = True + + # SQlite supports "DEFAULT VALUES" but *does not* support + # "VALUES (DEFAULT)" supports_default_values = True + supports_default_metavalue = False + supports_empty_insert = False supports_cast = True supports_multivalues_insert = True |
