| 1036 | } |
| 1037 | |
| 1038 | static void generateUUIDForTable(ASTCreateQuery & create) |
| 1039 | { |
| 1040 | if (create.uuid == UUIDHelpers::Nil) |
| 1041 | create.uuid = UUIDHelpers::generateV4(); |
| 1042 | |
| 1043 | /// If destination table (to_table_id) is not specified for materialized view, |
| 1044 | /// then MV will create inner table. We should generate UUID of inner table here, |
| 1045 | /// so it will be the same on all hosts if query in ON CLUSTER or database engine is Replicated. |
| 1046 | bool need_uuid_for_inner_table = !create.attach && create.is_materialized_view && !create.to_table_id; |
| 1047 | if (need_uuid_for_inner_table && create.to_inner_uuid == UUIDHelpers::Nil) |
| 1048 | create.to_inner_uuid = UUIDHelpers::generateV4(); |
| 1049 | } |
| 1050 | |
| 1051 | void InterpreterCreateQuery::assertOrSetUUID(ASTCreateQuery & create, const DatabasePtr & database) const |
| 1052 | { |
no test coverage detected