论坛上收集的PGSQL的json相关

Table "public.users"
Column | Type | Modifiers 
--------------+---------+------------
user_id | integer | not null 
user_name | text | 
user_profile | json | 

Better is that there are multiple JSON conversion functions, including row_to_json() and array_to_json(), which allow you to get the results of a query in JSON format.


select row_to_json(names) 
from ( select schemaname, relname from pg_stat_user_tables ) 
as names;

row_to_json 
-------------------------------------------
{"schemaname":"public","relname":"users"}

posted on 2013-04-08 14:41  neights  阅读(245)  评论(0编辑  收藏  举报

导航