Solved

Unable to import to tables in postgresql

Posted on 2016-10-08
7
84 Views
Last Modified: 2016-10-08
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.
ACT_ADDRESS_ALIAS_psv.psv.pdf
0
Comment
Question by:gregfthompson
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

Expert Comment

by:Terry Woods
ID: 41834936
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.
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 41834942
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.
0
 

Author Comment

by:gregfthompson
ID: 41834944
Thanks I tried that but it would not accept the tick in the box.
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41834945
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

UpdatedFile.pdf
0
 

Author Comment

by:gregfthompson
ID: 41834951
I renamed the file extension to .csv and it imported (with the header ticked).

Thanks heaps.
0
 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41834952
Great to hear that it worked. !! Excellent.
0
 

Author Closing Comment

by:gregfthompson
ID: 41834953
Thank you. Great assistance.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question