使用inherits来进行表继承:
create table t (id int ,name varchar(100),info varchar(300));
create table t1 () inherits(t);
create table t2 (j_ext jsonb) inherits(t);
解除继承:
alter table t2 no inherit t;
查询父表时会把父表中子表的数据也查出来,反之则不行。所有父表的检查约束和非空约束都会自动被子表继承,不过其他类型的约束(唯一,主键,外键)不会被继承
只想查父表的数据(加一个only):
select * from only t;