Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ALTER COLUMN with ALIAS #56493

Merged
merged 1 commit into from Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Storages/AlterCommands.cpp
Expand Up @@ -1148,7 +1148,7 @@ void AlterCommands::validate(const StoragePtr & table, ContextPtr context) const
/// The change of data type to/from Object is broken, so disable it for now
if (command.data_type)
{
const GetColumnsOptions options(GetColumnsOptions::AllPhysical);
const GetColumnsOptions options(GetColumnsOptions::All);
const auto old_data_type = all_columns.getColumn(options, column_name).type;

if (command.data_type->getName().contains("Object")
Expand Down
@@ -0,0 +1 @@
CREATE TABLE default.t\n(\n `c0` DateTime,\n `c1` DateTime,\n `a` DateTime ALIAS c1\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192
8 changes: 8 additions & 0 deletions tests/queries/0_stateless/02908_alter_column_alias.sql
@@ -0,0 +1,8 @@
CREATE TABLE t (
c0 DateTime,
c1 DateTime,
a DateTime alias toStartOfFifteenMinutes(c0)
) ENGINE = MergeTree() ORDER BY tuple();

ALTER TABLE t MODIFY COLUMN a DateTime ALIAS c1;
SHOW CREATE t;