This PR adds support for the DEFAULT clause with literal values when creating a new table or adding a column.
The SHOW CREATE TABLE statement now includes the specified default values.
These defaults are respected in INSERT and MERGE operations.
Non-literal expressions such as <datetime value function>, USER, and similar are not supported in this PR.
Can default value be null? If so, should we check it here against the non-null constraint, or only fail if the default value is actually used? What does the spec say?
ebyhr12 days ago (edited 12 days ago)
The spec allows null as the default value. I intentionally avoided supporting null to minimize the scope of this PR.
<default option> ::=
...
| <implicitly typed value specification>
<implicitly typed value specification>
<implicitly typed value specification> ::=
<null specification>
| <empty specification>
<null specification> ::=
NULL
kasiafi12 days ago
If null is allowed by the spec, then I think we should support it right away. Otherwise we might create inconsistent user experience.
Description
This PR adds support for the DEFAULT clause with literal values when creating a new table or adding a column.
The SHOW CREATE TABLE statement now includes the specified default values.
These defaults are respected in INSERT and MERGE operations.
Non-literal expressions such as <datetime value function>, USER, and similar are not supported in this PR.
Release notes