diff --git a/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.cpp b/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.cpp index 70251a940cc..befabe42e32 100644 --- a/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.cpp +++ b/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.cpp @@ -326,6 +326,15 @@ ASTPtr StorageMaterializedPostgreSQL::getColumnDeclaration(const DataTypePtr & d if (which.isDecimal256()) return make_decimal_expression("Decimal256"); } + + if (which.isDateTime64()){ + auto ast_expression = std::make_shared(); + + ast_expression->name = "DateTime64"; + ast_expression->arguments = std::make_shared(); + ast_expression->arguments->children.emplace_back(std::make_shared(UInt32(6))); + return ast_expression; + } return std::make_shared(data_type->getName()); } diff --git a/src/Storages/StoragePostgreSQL.cpp b/src/Storages/StoragePostgreSQL.cpp index faed14f941a..1f28f4f19f9 100644 --- a/src/Storages/StoragePostgreSQL.cpp +++ b/src/Storages/StoragePostgreSQL.cpp @@ -236,7 +236,7 @@ public: else if (which.isDateTime()) nested_column = ColumnUInt32::create(); else if (which.isDateTime64()) { - nested_column = ColumnDecimal::create(0, 6); + nested_column = ColumnDecimal::create(0, 6); } else if (which.isDecimal32()) {