I am trying to export data from MySQL table and import that data into the PgSQl database.
EXPORT Script from MySQL
select column_names from from table_name LIMIT 2
INTO OUTFILE 'E:/CSV_files/record_main.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY ';'
PgSQL IMPORT script
COPY record_main("column_names ") FROM 'E:/CSV_files/record_main.csv'
WITH DELIMITER ',' NULL '\N' ESCAPE ';' CSV
The above code is working fine for me when i am trying to export and import the CSV.
But while i am increasing the selection limit 1 to 2 or any , It causes error.
ERROR: extra data after last expected column CONTEXT: COPY record_main, line 1: >""12635","55025","1","ASCS","P","5320700","2015-01-01 >00:00:00",\N,\N,\N,\N,\N,\N,"DEED",\N,\N,\N,\N,..."
Then opened the CSV file and i manually separated the one row of data in to two row of data.
And i removed the semicolon from the end of each line.
This time it is working fine.
I think error in the line separator. My question is how can i say to the PgSQl to the line separator is this. like i given the DELIMITER