postgres创建表把源表所有属性复制过来
创建表:
postgres=> create table t123(id int primary key,it int);
CREATE TABLE
postgres=> \d t123
Table "public.t123"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
id | integer | | not null |
it | integer | | |
Indexes:
"t123_pkey" PRIMARY KEY, btree (id)
复制:
postgres=> create table tb12 ( like t123 INCLUDING ALL );
CREATE TABLE
postgres=> \d |tb12
Table "public.tb12"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
id | integer | | not null |
it | integer | | |
Indexes:
"tb12_pkey" PRIMARY KEY, btree (id)
INCLUDING 相关参数:
INCLUDING DEFAULTS
INCLUDING CONSTRAINTS
INCLUDING INDEXES
INCLUDING STORAGE
INCLUDING COMMENTS
INCLUDING ALL