0

I'd like to copy from with csv file with Postgres.

That csv file has array literal whose delimiter is ;.

example: a,b,c,{1;2;3}

I did that with replacing delimiter of csv file , to | and set option delimiter | and replacing delimiter of array literal ; to ,.

example: a|b|c|{1,2,3}

I think there may be option to set delimiter of array literal.
If so, I don't have to replace delimiter of csv file.

Are there any smarter way?

1

1 Answer 1

1

There is no option to configure the separator between the elements of an array in its text representation.

But if you have any control over how the CSV file is generated, you can escape the array literal:

a,b,c,"{1,2,3}"

That would work fine with COPY.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.