lightdb 支持以任何顺序指定建表选项
背景
lightdb 在为了兼容 oracle 和 mysql 语法,,在 postgresql 原有的建表选项上新增了一些选项并自定义了一些选项:
- compress/nocompress
- logging/nologging
- with primary key
- distributed by
- engine=innodb/myisam
- default charset=…
- collate=…
- comment=…
- with update current_timestamp
- storage (…)
这些选项在使用上有顺序要求,给用户带来了十分不好的体验。在 lightdb 23.3 版本后,允许这些选项可以以任何顺序出现在原有 PG 建表选项的后面。为了向后兼容,还允许 tablespace
选项以任意顺序指定。
用例
搭建数据库环境
\! mkdir /tmp/foo
create tablespace tbs_foo location '/tmp/foo';
create table pfoo(pa int);
建表语句如下:
-- ok
create table foo2(a int) using heap storage(INITIAL 8M MAXSIZE 1G);
-- -- lightdb options can be specified in any order
create table foo3(a int) compress logging;
create table foo4(a int) compress with primary key;
create table foo5(a int) compress engine=innodb;
create table foo6(a int) compress default charset=utf8;
create table foo7(a int) compress collate=utf8;
create table foo8(a int) compress comment='';
create table foo9(a int) compress with update current_timestamp;
create table foo10(a int) compress storage(INITIAL 8M MAXSIZE 1G);
create table foo11(a int) comment='' collate=utf8 default charset=utf8 engine=innodb with primary key storage(INITIAL 8M MAXSIZE 1G) logging compress;
create table foo12(a int) using heap tablespace tbs_foo compress nologging;
这里不再列出其他组合情况,用户可自测。
标签:
lightdb-features
posted on 2023-08-04 17:10 winter-loo 阅读(23) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通