复合类型定义: postgres=# create type complex as(r double precision,i double precision); CREATE TYPE postgres=# create type persion as(name text,age int,sex boolean); CREATE TYPE postgres=# 使用复合类型创建表: postgres=# create table testfh(id complex,people persion); CREATE TABLE postgres=# postgres=# insert into testfh values ((1,2),('李明','27','1')); INSERT 0 1 postgres=# select * from testfh; id | people -------+------------- (1,2) | (李明,27,t) (1 row) postgres=# select (people).name from testfh; name ------ 李明 (1 row) postgres=# update testfh set people.name='李大明'; UPDATE 1 postgres=# select (people).name from testfh; name -------- 李大明 (1 row) postgres=#
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。