MMa*_*acD 2 postgresql postgresql-9.2 hstore
我需要按对象 id 从 postgres 9.2+postgis 2.1 数据库中提取(复制)所有 hstore 标签到一个外部文件中进行后处理。由于每条记录的键和值各不相同,而且我不知道键或值是什么,因此我必须使用通配符。
遗憾的是,我的秘密解码器环似乎让我失望了,因为我尝试过的一切都没有奏效,可能是因为我所有的专业知识都在 vanilla sql 和 mysql/mariadb 上。
非常感谢您的帮助。
您正在寻找的skeys
功能:
select skeys(hstore_column)
from the_table;
Run Code Online (Sandbox Code Playgroud)
如果您还需要每个键的值:
select (a).key, (a).value
from (
select each(hstore_column) as a
from the_table
) t;
Run Code Online (Sandbox Code Playgroud)
手册中的更多详细信息:http : //www.postgresql.org/docs/current/static/hstore.html
归档时间: |
|
查看次数: |
2926 次 |
最近记录: |