Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCREATE TABLE - default-values on columns #1022
Comments
|
I was looking into this but things got more complecated than I thought.
If someone write a new NextValExpression(), place it to the comment above. CREATE TABLE T1 (isok boolean DEFAULT true);
CREATE TABLE T1 (isok boolean DEFAULT false);will work due to this change (copy from a working branch, all test passed), but then I realized default value can be expressions. as in the mysql manual: CREATE TABLE t1 (
-- literal defaults
i INT DEFAULT 0,
c VARCHAR(10) DEFAULT '',
-- expression defaults
f FLOAT DEFAULT (RAND() * RAND()),
b BINARY(16) DEFAULT (UUID_TO_BIN(UUID())),
d DATE DEFAULT (CURRENT_DATE + INTERVAL 1 YEAR),
p POINT DEFAULT (Point(0,0)),
j JSON DEFAULT (JSON_ARRAY())
);In the latest change there's a SimpleExpression() seems to fit, but unfortunately default exprs can't have refference to user or system variables. |
|
Thank you for your thoughts, I didn't have the time to handle it myself because it is so complex. But I have placed a marker branch with a simple test case ... there are several syntax variants of nextval out there and other expressions may be allowed as well, as you have already noticed. |
Default-Values not supported currently