[Bug]: panic occurs when multi table JOIN, one has PRIMARY KEY, another not.
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Environment
- Version or commit-id (e.g. v0.1.0 or 8b23a93):
- Hardware parameters:
- OS type:
- Others:
Actual Behavior
Table Structure : DROP TABLE IF EXISTS t; DROP TABLE IF EXISTS t1; CREATE TABLE t( id INT PRIMARY KEY, name VARCHAR(20) ); CREATE TABLE t1( id INT );
DML stmt : INSERT INTO t VALUES(1,'tomm'),(2, 'hia'),(3, 'berea'); SELECT * FROM t,t1 WHERE t.id = t1.id; INSERT INTO t1 VALUES(1),(NULL),(NULL); SELECT * FROM t,t1 WHERE t.id = t1.id;
The problematic SQL stmt : SELECT * FROM t JOIN t1 ON t.id = t1.id WHERE id BETWEEN 1 AND 4;
It's return value is : ERROR 20101 (HY000): internal error: panic runtime error: invalid memory address or nil pointer dereference: runtime.panicmem /usr/local/go/src/runtime/panic.go:260 runtime.sigpanic /usr/local/go/src/runtime/signal_unix.go:835 github.com/matrixorigin/matrixone/pkg/sql/parsers/tree.(*FmtCtx).PrintExpr /home/mo/matrixone/pkg/sql/parsers/tree/format.go:78 github.com/matrixorigin/matrixone/pkg/sql/parsers/tree.(*RangeCond).Format /home/mo/matrixone/pkg/sql/parsers/tree/expr.go:730 github.com/matrixorigin/matrixone/pkg/sql/par
Expected Behavior
No response
Steps to Reproduce
No response
Additional information
No response
The column 'id' in where clause is ambiguous, but panic info should not be output
mysql> SELECT * FROM t JOIN t1 ON t.id = t1.id WHERE id BETWEEN 1 AND 4; ERROR 20301 (HY000): invalid input: ambiguouse column reference to 'id'