其解决方案就是使用hstore类型,使用它,先得创建对应的扩展。下面只列出简单的使用示例:iihero=# create extension hstore;
CREATE EXTENSION
iihero=#
iihero=# select "a=>1,b=>2"::hstore;
hstore
--------------------
"a"=>"1", "b"=>"2"
(1 row)iihero=# insert into tjson values(1, "a=>1, b=>2, c=>3"::hstore);
INSERT 0 1
iihero=# insert into tjson values(2, "a=>2, b=>3, c=>4"::hstore);
INSERT 0 1
iihero=# select * from tjson where col2 @>"a=>1";
id | col2
----+------------------------------
1 | "a"=>"1", "b"=>"2", "c"=>"3"
(1 row)iihero=# select * from tjson where col2 @>"a=>1" and col2 @>"b=>2";
id | col2
----+------------------------------
1 | "a"=>"1", "b"=>"2", "c"=>"3"
(1 row)所不同的,只是语法表现形式的不同。还可以充分利用索引。Oracle同义词的创建与删除ORA-04062ORA-04068 错误解决相关资讯 PostgreSQL PostgreSQL9.2 json存储
- Ubuntu 16.04 下安装 PostgreSQL (08月14日)
- PostgreSQL 发布全系安全更新 (02月12日)
- 开源的轻量级JSON存储Kinto介绍 (01月02日)
| - Linux下RPM包方式安装PostgreSQL (03月04日)
- PostgreSQL9.5新特性之行级安全性 (01月19日)
- 使用pg_basebackup搭建PostgreSQL (12/30/2015 09:00:29)
|
本文评论 查看全部评论 (0)