| From: | Michael Nolan <htfoot(at)gmail(dot)com> |
|---|---|
| To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
| Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Bypassing NULL elements in row_to_json function |
| Date: | 2016-04-10 04:48:24 |
| Message-ID: | CAOzAquJkczwhT5iV5a-SU54SeVxHXfMUV86jQ8f8F9HArSV70A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
2nd Followup: It turns out that loading a table from a JSON string is more
complicated than going from a table to JSON, perhaps for good reason.
There does not appear to be a direct inverse to the row_to_json() function,
but it wasn't difficult for me to write a PHP program that takes the JSON
file I created the other day and converts it back to a series of inserts,
recreating the original table.
Of course this simple program does NO validation (not that this file needed
any), so if the JSON string is not well-formed for any of a number of
reasons, or if it is not properly mapped to the table into which the
inserts are made, an insert could fail or result in incorrect data.
--
Mike Nolan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Durumdara | 2016-04-10 07:07:34 | Re: Really unique session ID - PID + connection timestamp? |
| Previous Message | Tom Lane | 2016-04-09 15:25:51 | Re: max_stack_depth problem though query is substantially smaller |