Hi all,
I have come across this apparently common issue COPY-ing json and wondering if there is potentially a better solution.
I am copying data into a jsonb column originating from a 3rd party API. The data may have literal \r,\t,\n and also double backslashes.
I discovered that I can cast this data to a jsonb value directly but I can't COPY the data without pre-processing.
The example below illustrates my issue (only with \r, but the problem extends to other \X combinations).
do $$ Is there any other solution with COPY that doesn't require manual implementation of search/replace to handle these edge cases?
Why does ::jsonb work but COPY doesn't? It seems a bit inconsistent.
Best regards,
Alastair
|