0

I have some big .csv files and I am trying to put it into database. I am using this construction:

COPY table_name(column1, column2, column..., columnN) FROM stdin;
column1 column2 column... column N
column1 column2 column... column N
column1 column2 column... column N
column1 column2 column... column N
\.

But after use \i function in CLI I got that:

ERROR:  end-of-copy marker corrupt

This is not a problem with end marker, but with encoding. If I open this file in VIM and will save it again, everything is OK, but without this operations I got this error all the time. What can I do in PHP (with PHP I create those files) to fix that? If this is for sure problem with encoding?

2 Answers 2

1

Is there also a newline after the \. ? Check the example in the PHP-manual for pg_put_line() as well and take notice of the \n at the end.

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

Comments

0

There is a easy solution for this, you only need to press "Enter" after "\." and then save your file and try again, it will resolve your issue.

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.