TestRejectTopInPostgreSQL checks that TOP is rejected when dialect is PostgreSQL.
(t *testing.T)
| 248 | |
| 249 | // TestRejectTopInPostgreSQL checks that TOP is rejected when dialect is PostgreSQL. |
| 250 | func TestRejectTopInPostgreSQL(t *testing.T) { |
| 251 | sql := "SELECT TOP 10 id, name FROM users" |
| 252 | _, err := ParseWithDialect(sql, keywords.DialectPostgreSQL) |
| 253 | if err == nil { |
| 254 | t.Fatal("expected error: TOP should be rejected in PostgreSQL dialect") |
| 255 | } |
| 256 | if !containsAny(err.Error(), "TOP", "postgresql", "LIMIT") { |
| 257 | t.Errorf("error should mention TOP or PostgreSQL, got: %v", err) |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // TestAcceptTopInSQLServer checks that TOP is accepted in SQL Server dialect. |
| 262 | func TestAcceptTopInSQLServer(t *testing.T) { |
nothing calls this directly
no test coverage detected