我有一个users
带有列的表user_id
,例如。user_name
user_phone
如果我做:
select hstore(u) from users u
结果是:
"user_id" => "1", "user_name" => "McEnroe", "user_phone" => "xxx"
如果我做:
select hstore(u) from (select user_id, user_name, user_phone from users) u
结果是:
"f1" => "1", "f2" => "McEnroe", "f3" => "xxx"
我失去了列的名称。
如何使用第二个示例并拥有正确的列名?