Search Postgresql Archives

Re: inserting a text file via json

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Did you mean something like...?:

postgres=# \! echo "{\"menu\": { \"id\": \"file\" }}" > /opt/pgdata/exampl.json
postgres=# select pg_read_file('/opt/pgdata/exampl.json');
        pg_read_file       
----------------------------
 {"menu": { "id": "file" }}+
 
(1 row)

postgres=# select pg_read_file('/opt/bdr/bdr1/exampl.json')::json;
        pg_read_file       
----------------------------
 {"menu": { "id": "file" }}+
 
(1 row)

postgres=# create table json_exam as select pg_read_file('/opt/bdr/bdr1/exampl.json')::json as jsonColumn;
SELECT 1
postgres=# \d json_exam 
   Table "public.json_exam"
   Column   | Type | Modifiers
------------+------+-----------
 jsoncolumn | json |

2014-09-05 20:51 GMT-03:00 john.tiger <john.tigernassau@xxxxxxxxx>:
we want to store markdown text files into our json fields - can this be done ?  I guess we could have a separate json field and bytea field for the markdown file but this might be difficult when it comes to our REST response - anyone do something like this ?


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
--
Emanuel Calvo http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux