Unable to import to tables in postgresql

I had this question after viewing postgresql problem - script to create tables does not run.

I created the tables and then attempted to import the attached file.  (Note: please rename the file to delete the .pdf)

No luck.

an error window opens:

ERROR: value too long for type character varying(15)
CONTEXT: COPY address_alias, line 1, column address_alias_pid: "ADDRESS_ALIAS_PID"

I am unable to resolve this problem.
Who is Participating?
Terry WoodsConnect With a Mentor IT GuruCommented:
It looks like the COPY command has an option HEADER that you can add to ignore the first line as a header. That would achieve the same end without changing the file contents.
Terry WoodsIT GuruCommented:
Without checking the previous question, have you tried deleting the first line of the file? If it was trying to load the header as an actual record, it would explain the error.
gregfthompsonAuthor Commented:
Thanks I tried that but it would not accept the tick in the box.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Pawan KumarDatabase ExpertCommented:
Can you post the command you are using to import the file. What kind of file you are importing.

I have updated the pdf file to export. Here you can use attached or you can ignore the first row of the pdf file you have attached.

Your column size is of 15 and in the headertext is way long that why we have this error.  

If you want to export the file with header only then use CSV Header option to ignore the first row.

Command -

COPY TableName (col1,col2...) FROM 'Pawan.csv' CSV HEADER;

Open in new window

gregfthompsonAuthor Commented:
I renamed the file extension to .csv and it imported (with the header ticked).

Thanks heaps.
Pawan KumarDatabase ExpertCommented:
Great to hear that it worked. !! Excellent.
gregfthompsonAuthor Commented:
Thank you. Great assistance.
All Courses

From novice to tech pro — start learning today.