Fix ALTER COLUMN with ALIAS

This commit is contained in:
Nikolay Degterinsky 2023-11-09 07:07:41 +00:00
parent e33dc02c8c
commit 4ac3dcc417
3 changed files with 10 additions and 1 deletions

View File

@ -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")

View File

@ -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

View File

@ -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;