Skip to content

Crash by Function DAYNAME #7039

Closed
dolthub/go-mysql-server
#2158

Description

@suyZhong

The following test case crashed go-mysql-server.

CREATE TABLE t0(c2 INT, c3 INT, PRIMARY KEY(c2));
INSERT INTO t0(c2) VALUES (1);
INSERT INTO t0(c2) VALUES (2);

SELECT c2 FROM t0 WHERE c2 ORDER BY DAYNAME(c3) ASC;

Here's my error trace:

panic: interface conversion: interface {} is nil, not time.Time

goroutine 611 [running]:
github.com/dolthub/go-mysql-server/sql/expression/function.(*DayName).Eval(0x0?, 0x0?, {0xc0017aebe0?, 0xc000d52e88?, 0xc000baf800?})
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/sql/expression/function/time.go:1198 +0x1e5
github.com/dolthub/go-mysql-server/sql/expression.(*Sorter).Less(0xc000fff810, 0x18?, 0x0?)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/sql/expression/sort.go:48 +0x17e
sort.insertionSort({0x30362e0, 0xc000fff810}, 0x0, 0x2)
        /home/suyang/go/src/sort/zsortinterface.go:12 +0xa7
sort.stable({0x30362e0, 0xc000fff810}, 0x2)
        /home/suyang/go/src/sort/zsortinterface.go:343 +0x6a
sort.Stable({0x30362e0, 0xc000fff810})
        /home/suyang/go/src/sort/sort.go:229 +0x34
github.com/dolthub/go-mysql-server/sql/rowexec.(*sortIter).computeSortedRows(0xc000fff680, 0xc000df0d20)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/sql/rowexec/rel_iters.go:1007 +0x248
github.com/dolthub/go-mysql-server/sql/rowexec.(*sortIter).Next(0xc000fff680, 0x58?)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/sql/rowexec/rel_iters.go:961 +0x25
github.com/dolthub/go-mysql-server/sql/rowexec.(*projectIter).Next(0xc000d34120, 0x1?)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/sql/rowexec/rel_iters.go:512 +0x29
github.com/dolthub/go-mysql-server/sql/rowexec.transactionCommittingIter.Next(...)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/sql/rowexec/transaction_iters.go:78
github.com/dolthub/go-mysql-server/sql/plan.(*trackedRowIter).Next(0xc000bc75c0, 0x100000000?)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/sql/plan/process.go:347 +0x24
github.com/dolthub/go-mysql-server/server.(*Handler).doQuery.func2()
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231121231446-0a2b90169f58/server/handler.go:286 +0x125
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /home/suyang/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 554
        /home/suyang/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96

I originally find this by building dolt from source version f400a12. It could also be reproduced in 1.26.1.

Activity

  1. changed the title [-]Crash by Function DAYTIME[/-] [+]Crash by Function DAYNAME[/+] on Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions