Home > Software engineering >  Copy data PostgresSQL
Copy data PostgresSQL

Time:08-04

I can not copy data between a file and a data PostgresSQL

I have txt file

08.10.2020|pqgpardaql|куфожйэюхю|81720836|6,12517552|
11.03.2020|otsevjoqbe|ппыыдвпцёе|84094422|5,61357632|
06.05.2018|modjmucfmq|ювэючхптдв|64162072|19,81894589|

I have query

"COPY test FROM 'D:\\test\\unionFile.txt' DELIMITER '|'";

but i get error

ERROR:  extra data after last expected column
CONTEXT:  COPY address, line 1: "08.10.2020|pqgpardaql|куфожйэюхю|81720836|6,12517552|"

How can i go to the next line while copying?

CodePudding user response:

remove the pipe symbol in the last of every line

08.10.2020|pqgpardaql|куфожйэюхю|81720836|6,12517552 11.03.2020|otsevjoqbe|ппыыдвпцёе|84094422|5,61357632 06.05.2018|modjmucfmq|ювэючхптдв|64162072|19,81894589

i imported with this command

COPY test FROM 'D:\\test\\unionFile.txt' (DELIMITER('|'));

IT worked

  • Related