--------------------------------------------------------------------------- TOP dialect gate --------------------------------------------------------------------------- TestRejectTopInMySQL checks that TOP is rejected when dialect is MySQL.
(t *testing.T)
| 236 | |
| 237 | // TestRejectTopInMySQL checks that TOP is rejected when dialect is MySQL. |
| 238 | func TestRejectTopInMySQL(t *testing.T) { |
| 239 | sql := "SELECT TOP 10 id, name FROM users" |
| 240 | _, err := ParseWithDialect(sql, keywords.DialectMySQL) |
| 241 | if err == nil { |
| 242 | t.Fatal("expected error: TOP should be rejected in MySQL dialect") |
| 243 | } |
| 244 | if !containsAny(err.Error(), "TOP", "mysql", "LIMIT") { |
| 245 | t.Errorf("error should mention TOP or MySQL, got: %v", err) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // TestRejectTopInPostgreSQL checks that TOP is rejected when dialect is PostgreSQL. |
| 250 | func TestRejectTopInPostgreSQL(t *testing.T) { |
nothing calls this directly
no test coverage detected