| 246 | } |
| 247 | |
| 248 | func getTemporaryMaterializedView(name string, columns []string) string { |
| 249 | var parts []string |
| 250 | for _, col := range columns { |
| 251 | parts = append(parts, fmt.Sprintf("1 AS `%s`", col)) |
| 252 | } |
| 253 | // For materialized views, we create a temporary regular view as a placeholder |
| 254 | // since the actual materialized view will be created later with the full definition. |
| 255 | stmt := fmt.Sprintf("CREATE VIEW `%s` AS SELECT\n %s;\n", name, strings.Join(parts, ",\n ")) |
| 256 | return fmt.Sprintf(tempMaterializedViewStmtFmt, name, stmt) |
| 257 | } |
| 258 | |
| 259 | // TableSchema describes the schema of a table or view. |
| 260 | type TableSchema struct { |