-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can Ceresdb support default value for columns? #210
Comments
It is still not supported now , are you interested to make it? |
It's a very useful feature, and we will support it in the near future. |
Does it means we need support default value which is an The grammar may be like: |
Yes, that gramma looks great! (only we don't support |
Let me have a try :D |
In this statement, |
I almost finish most of it, but submiting a simple implement is also ok to me. I will submit a pr today or tomorrow. |
It will be surely great if you have made it. |
I thought of one corner case when default value defined in expression
MySQL only allow to reference a column defined before it, how will you avoid this? |
Yes, it is a problem. So circle reference is not allowed here, we can check and return error when create table.
We can reorder the missing columns, the simple columns will run first, and other columns which depends it will run after. for example: CREATE TABLE t(c1 string tag not null,
ts timestamp not null,
c3 uint32 Default c4,
c4 uint32 Default c5,
c5 uint32 Default 0, timestamp key(ts),primary key(c1, ts)) \
ENGINE=Analytic WITH (ttl='70d',update_mode='overwrite',arena_block_size='1KB')"
Insert into t(c1, ts) values(xx, xxx); The original order of the missing column is Maybe the behavior of mysql is also an alternative, because the full implement maybe a little complex like @ShiKaiWi says. |
Yep, I think we can follow what MySQL does, leave circle reference detect/reorder for future work. A tracking issue can be created to discuss those optimization. |
I create a tracking issue #252. |
For now, this feature is ready for basic use, so closing. CREATE TABLE `test` (
`ts` timestamp TIMESTAMP KEY NOT NULL,
`t1` string default "hello",
`ts2` timestamp default now()
) with (
enable_ttl = 'false'
);
insert into `test` (ts)
values (123);
select * from `test` Wii return
|
Describe This Problem
Can Ceresdb support default value for columns something like
timestamp = now()
Proposal
Additional Context
No response
The text was updated successfully, but these errors were encountered: