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
create table mx(A Int64) Engine=MergeTree order by A;
alter table mx add column B Int64 default 111, modify order by (A,B);
DB::Exception: Newly added column B has a default expression, so adding expressions that use it to the sorting key is forbidden.
This behaviour has no sense. I don't see a reason why it's forbidden.
Moreover there is a workaround:
alter table mx add column B Int64 , modify order by (A,B);
alter table mx modify column B default 111;
The text was updated successfully, but these errors were encountered:
Hi: I have an application that requires adding new columns with Constant Default Values and these columns are used for order-by key expression. Given the above comment on "Constant DEFAULTs actually may be allowed.", can the current code in MergeTreeData.cpp, https://github.com/ClickHouse/ClickHouse/blob/master/src/Storages/MergeTree/MergeTreeData.cpp#L364, be fixed to reflect the above logic, that is, if the default expression of the column only contains constant expression, then no exception gets thrown. Currently, the code has:
if (new_metadata.columns.getDefaults().count(col)) throw Exception("Newly added column " + backQuoteIfNeed(col) + " has a default expression, so adding " "expressions that use it to the sorting key is forbidden", ErrorCodes::BAD_ARGUMENTS)
If the fix is feasible, when can I get it from the future ClickHouse release?
This behaviour has no sense. I don't see a reason why it's forbidden.
Moreover there is a workaround:
The text was updated successfully, but these errors were encountered: