Skip to content

Commit 1b145e4

Browse files
committed
tests,sqlsmith: skip st_snap in TestRandomSyntaxSQLSmith
There is a known issue with `st_snap` that causes a crash in geos, so we avoid generating a stmt with this builtin for now. Additionally, I noticed some random stmts that always will hit an error because ORDER BY clause contains a type that doesn't define an ordering, so this commit also adjusts the sqlsmith generation for REFCURSOR, JSONPATH, and PGVECTOR (to match `ensureColumnOrderable`). Release note: None
1 parent 7a7aab5 commit 1b145e4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pkg/internal/sqlsmith/relational.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,12 +1790,19 @@ func (s *Smither) makeHaving(refs colRefs) *tree.Where {
17901790
}
17911791

17921792
func (s *Smither) isOrderable(typ *types.T) bool {
1793+
if typ.Family() == types.ArrayFamily {
1794+
typ = typ.ArrayContents()
1795+
}
1796+
if typ.Family() == types.RefCursorFamily || typ.Family() == types.JsonpathFamily {
1797+
// These types don't define an ordering function in PG.
1798+
return false
1799+
}
17931800
if s.postgres {
17941801
// PostGIS cannot order box2d types.
17951802
return typ.Family() != types.Box2DFamily
17961803
}
17971804
switch typ.Family() {
1798-
case types.TSQueryFamily, types.TSVectorFamily:
1805+
case types.TSQueryFamily, types.TSVectorFamily, types.PGVectorFamily:
17991806
// We can't order by these types - see #92165.
18001807
return false
18011808
default:

pkg/sql/tests/rsg_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,10 @@ func TestRandomSyntaxSQLSmith(t *testing.T) {
758758
return err
759759
}, func(ctx context.Context, db *verifyFormatDB, r *rsg.RSG) error {
760760
s := smither.Generate()
761+
if strings.Contains(s, "st_snap(") {
762+
// TODO(#151103): unskip st_snap.
763+
return nil
764+
}
761765
err := db.exec(t, ctx, s)
762766
if c := (*crasher)(nil); errors.As(err, &c) {
763767
if err := db.exec(t, ctx, "USE defaultdb"); err != nil {

0 commit comments

Comments
 (0)