代码拉取完成,页面将自动刷新
1940
建表时使用not null约束
已合并
【标题】(请简要描述下实现的内容)
建表时使用not null约束
【实现内容】:
create table table_name of type_name可以直接使用not null约束或者default,兼容pg。
【根因分析】:
【修改方案】:
- xxx
- xxx
【关联issue】:
#I55D36:create table table_name of type_name 使用not null约束,建表失败
【开发自验报告】:
- 请附上自验结果(内容或者截图)
============== shutting down postmaster ==============
stop postmaster now!
=======================
All 719 tests passed.
Total Time: 974.833746s
=======================
openGauss=# create type person_type as(id int, name text);
CREATE TYPE
openGauss=# create table person3 of person_type(primary key(id), name not null default '');
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "person3_pkey" for table "person3"
CREATE TABLE
openGauss=# create table person5 of person_type(primary key(id), name not null);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "person5_pkey" for table "person5"
CREATE TABLE
openGauss=# create table person6 of person_type(primary key(id), name default '');
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "person6_pkey" for table "person6"
CREATE TABLE
openGauss=# \d person3
Table "public.person3"
Column | Type | Modifiers
--------+---------+-----------
id | integer | not null
name | text | not null
Indexes:
"person3_pkey" PRIMARY KEY, btree (id) TABLESPACE pg_default
Typed table of type: person_type
openGauss=# \d person6
Table "public.person6"
Column | Type | Modifiers
--------+---------+-----------
id | integer | not null
name | text |
Indexes:
"person6_pkey" PRIMARY KEY, btree (id) TABLESPACE pg_default
Typed table of type: person_type
openGauss=# insert into person6 values(1);
INSERT 0 1
openGauss=# select * from person6;
id | name
----+------
1 |
(1 row)
openGauss=# create table person7 of person_type(primary key(id), name default 'default');
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "person7_pkey" for table "person7"
CREATE TABLE
openGauss=# insert into person7 values(1);
INSERT 0 1
openGauss=# select * from person7;
id | name
----+---------
1 | default
(1 row)
openGauss=# \d person7
Table "public.person7"
Column | Type | Modifiers
--------+---------+-------------------------
id | integer | not null
name | text | default 'default'::text
Indexes:
"person7_pkey" PRIMARY KEY, btree (id) TABLESPACE pg_default
Typed table of type: person_type
- 是否可以添加fastcheck测试用例,如是,请补充fastcheck用例
- 是否涉及资料修改,如是,在docs仓库补充资料
- 是否考虑支撑升级和在线扩容等扩展场景
- 是否考虑异常场景/并发场景/前向兼容/性能场景
- 是否对其他模块产生影响