[Bug]: cannot insert with default UUID() as primary key #18895
Labels
kind/bug
Something isn't working
phase/testing
severity/s0
Extreme impact: Cause the application to break down and seriously affect the use
Milestone
Is there an existing issue for the same bug?
Branch Name
main
Commit ID
f9b2b29
Other Environment Information
Actual Behavior
mysql> CREATE TABLE namelists (
-> id UUID DEFAULT uuid() PRIMARY KEY, -- the id field is of UUID type, and the default value is the UUID value generated by the uuid() function as the primary key
-> name VARCHAR NOT NULL -- the name field is of type VARCHAR and cannot be empty
-> );
Query OK, 0 rows affected (0.04 sec)
mysql> INSERT INTO namelists (name) VALUES ('Tom'), ('Jane'), ('Bob');
ERROR 20101 (HY000): internal error: panic runtime error: invalid memory address or nil pointer dereference:
runtime.panicmem
/usr/local/go/src/runtime/panic.go:262
runtime.sigpanic
/usr/local/go/src/runtime/signal_unix.go:900
github.com/matrixorigin/matrixone/pkg/sql/plan.ConstantFold
/Users/eric/github/matrixone/pkg/sql/plan/utils.go:1109
github.com/matrixorigin/matrixone/pkg/sql/plan.getPkValueExpr
/Users/eric/github/matrixone/pkg/sql/plan/build_insert.go:872
github.com/matrixorigin/matrixone/pkg/sql/plan.buildInsertPl
Expected Behavior
The test case is the example from official document. https://docs.matrixorigin.cn/en/1.1.0/MatrixOne/Reference/Data-Types/uuid-type/#examples
-- Create a table named namelists with two fields, id and name
CREATE TABLE namelists (
id UUID DEFAULT uuid() PRIMARY KEY, -- the id field is of UUID type, and the default value is the UUID value generated by the uuid() function as the primary key
name VARCHAR NOT NULL -- the name field is of type VARCHAR and cannot be empty
);
INSERT INTO namelists (name) VALUES ('Tom'), ('Jane'), ('Bob');
mysql> select * from namelists;
+--------------------------------------+--------+
| id | name |
+--------------------------------------+--------+
| 61400e9c-1bbc-11ee-b512-5ad2460dea50 | Tom |
| 61400ea6-1bbc-11ee-b512-5ad2460dea50 | Jane |
| 61400ea6-1bbc-11ee-b513-5ad2460dea50 | Bob |
+--------------------------------------+--------+
3 rows in set (0.00 sec)
Steps to Reproduce
Additional information
No response
The text was updated successfully, but these errors were encountered: