Solved

Unable to import to tables in postgresql

Posted on 2016-10-08
7
49 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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 17

Expert Comment

by:Pawan Kumar Khowal
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 17

Expert Comment

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

Author Closing Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now