Question:
I am trying to export a column type jsonb using the copy command as follow:Answer:
You’ve chosen CSV output format, which escapes quotes that way.COPY
does not produce JSON.Do not use
COPY
to get the output, rather see store postgresql result in bash variable or How to return a value from psql to bash and use it?:If you have better answer, please add a comment about this, thank you!