MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestRejectTopInMySQL

Function TestRejectTopInMySQL

pkg/sql/parser/dialect_test.go:238–247  ·  view source on GitHub ↗

--------------------------------------------------------------------------- TOP dialect gate --------------------------------------------------------------------------- TestRejectTopInMySQL checks that TOP is rejected when dialect is MySQL.

(t *testing.T)

Source from the content-addressed store, hash-verified

236
237// TestRejectTopInMySQL checks that TOP is rejected when dialect is MySQL.
238func 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.
250func TestRejectTopInPostgreSQL(t *testing.T) {

Callers

nothing calls this directly

Calls 4

containsAnyFunction · 0.85
ParseWithDialectFunction · 0.70
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected