Solved

Unable to import to tables in postgresql

Posted on 2016-10-08
7
109 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 29

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 29

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 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