我有一个postgresql sql,它返回存储在列中的列表元素:
这是我的sql:
SELECT quote_literal(value) AS cluster_values
FROM process_configuration pc
WHERE pc.parameter='CLUSTER_DATA_ELEMENT';
这个请求给了我这个值:
cluster_values
----------------------------
'Gender,ResidenceAddress'
我想得到的价值是:每个元素的引用:'性别','住宅地址'
cluster_values
----------------------------
'Gender','ResidenceAddress'
Plz有人可以帮我修复此事先谢谢你
答案 0 :(得分:2)
SELECT regexp_replace(value, '([^,]+)', '''\1''', 'g') AS cluster_values
FROM process_configuration pc
WHERE pc.parameter = 'CLUSTER_DATA_ELEMENT';
cluster_values
-----------------------------
'Gender','ResidenceAddress'
(1 row)