You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, adding a new column with a casted default value fails with a NotImplementedException, even if the underlying value is a simple constant.
ALTERTABLEducklake.public.default_test ADD COLUMN e varchar DEFAULT 'dv'::varchar ;
Not implemented Error: We cannot add a column with a non-literal default value. Add the column and then explicitly set the default for new values using "ALTER ... SET DEFAULT"
This happens because 'dv'::varchar has type of ExpressionType::OPERATOR_CAST, not VALUE_CONSTANT:
shared_ptr<DuckLakeFieldData> DuckLakeFieldData::SetDefault(const DuckLakeFieldData &field_data, FieldIndex field_index,
const ColumnDefinition &new_col, bool add_column) {
auto result = make_shared_ptr<DuckLakeFieldData>();
auto new_default =
new_col.HasDefaultValue() ? optional_ptr<const ParsedExpression>(new_col.DefaultValue()) : nullptr;
if (new_default && new_default->type != ExpressionType::VALUE_CONSTANT && add_column) {
throwNotImplementedException("We cannot add a column with a non-literal default value. Add the column and ""then explicitly set the default for new values using \"ALTER ... SET DEFAULT\"");
}
...
This limitation looks inconsistent, as creating a table with a cast as a default value is already supported and works fine:
CREATETABLEducklake.public.default_test (a integer, b text DEFAULT 'foo'::text, c integer, d bool DEFAULT true);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Currently, adding a new column with a casted default value fails with a NotImplementedException, even if the underlying value is a simple constant.
This happens because 'dv'::varchar has type of ExpressionType::OPERATOR_CAST, not VALUE_CONSTANT:
This limitation looks inconsistent, as creating a table with a cast as a default value is already supported and works fine:
All reactions