(t *testing.T)
| 118 | } |
| 119 | |
| 120 | func TestClickHouseFinalWithWhere(t *testing.T) { |
| 121 | sql := `SELECT * FROM orders FINAL WHERE id > 5` |
| 122 | tree, err := parser.ParseWithDialect(sql, keywords.DialectClickHouse) |
| 123 | if err != nil { |
| 124 | t.Fatalf("unexpected error parsing FINAL with WHERE: %v", err) |
| 125 | } |
| 126 | if len(tree.Statements) == 0 { |
| 127 | t.Fatal("expected at least one statement") |
| 128 | } |
| 129 | sel, ok := tree.Statements[0].(*ast.SelectStatement) |
| 130 | if !ok { |
| 131 | t.Fatalf("expected SelectStatement, got %T", tree.Statements[0]) |
| 132 | } |
| 133 | if len(sel.From) == 0 || !sel.From[0].Final { |
| 134 | t.Error("expected FINAL=true on first TableReference") |
| 135 | } |
| 136 | if sel.Where == nil { |
| 137 | t.Error("expected WHERE clause to be set") |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func TestClickHouseFinalWithAlias(t *testing.T) { |
| 142 | t.Run("ExplicitAlias", func(t *testing.T) { |
nothing calls this directly
no test coverage detected