inherits

PostgreSQL从继承到分区(一)

孤街浪徒 提交于 2019-12-06 02:57:55
PostgreSQL从继承到分区 (pg_partman) PostgreSQL从继承到分区(一) http://my.oschina.net/lianshunke/blog/205296 PostgreSQL从继承到分区(二) http://my.oschina.net/lianshunke/blog/205296 PostgreSQL从继承到分区(三) http://my.oschina.net/lianshunke/blog/205316 一、Inheritance http://www.postgresql.org/docs/9.3/static/ddl-inherit.html 通过下面的简单例子说明什么是表继承: 1.1 单表继承 postgres=# CREATE DATABASE lsk; CREATE DATABASE postgres=# \c lsk You are now connected to database "lsk" as user "postgres". lsk=# CREATE TABLE t1(id int,name varchar(20)); CREATE TABLE lsk=# CREATE TABLE t2(age int) inherits(t1); CREATE TABLE {在子表中新添的字段会汇同父表的所有字段一起作为子表字段}