TestAcceptILIKEDefaultDialect checks that ILIKE works when no dialect is set (default is treated as PostgreSQL for backward compatibility).
(t *testing.T)
| 352 | // TestAcceptILIKEDefaultDialect checks that ILIKE works when no dialect is set |
| 353 | // (default is treated as PostgreSQL for backward compatibility). |
| 354 | func TestAcceptILIKEDefaultDialect(t *testing.T) { |
| 355 | sql := "SELECT * FROM users WHERE name ILIKE '%alice%'" |
| 356 | // When no dialect is set (p.dialect == ""), the gate should not fire. |
| 357 | p := NewParser() // dialect == "" |
| 358 | tkz, err := tokenizer.NewWithDialect(keywords.DialectPostgreSQL) |
| 359 | if err != nil { |
| 360 | t.Fatal(err) |
| 361 | } |
| 362 | tokens, err := tkz.Tokenize([]byte(sql)) |
| 363 | if err != nil { |
| 364 | t.Fatal(err) |
| 365 | } |
| 366 | result, err := p.ParseFromModelTokens(tokens) |
| 367 | if err != nil { |
| 368 | t.Fatalf("ILIKE should be valid with default (empty) dialect, got error: %v", err) |
| 369 | } |
| 370 | if result == nil { |
| 371 | t.Fatal("expected non-nil AST") |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | // --------------------------------------------------------------------------- |
| 376 | // Backtick and bracket reserved-word regression tests (DIALECT-1, DIALECT-2) |
nothing calls this directly
no test coverage detected