Skip site navigation (1) Skip section navigation (2)

Re: Migrating Data from MySQL to PostgreSQL

From: "Lacey L(dot) Powers" <lacey(dot)leanne(at)gmail(dot)com>
To: pdxpug(at)postgresql(dot)org
Subject: Re: Migrating Data from MySQL to PostgreSQL
Date: 2011-05-06 00:27:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pdxpug
On 05/05/2011 05:08 PM, Rich Shepard wrote:
> On Thu, 5 May 2011, Lacey L. Powers wrote:
>> In all of the times where I've migrated data from MySQL to PostgreSQL,
>> this is all I have needed, for example:
>> COPY table (col1,col2,col3,col4) FROM stdin;
> Lacey,
>   The data are not coming from stdin but from files on the disk.
>   I have at the bottom of the DDL file lines such as these:
> COPY comments FROM 'comments.csv' WITH DELIMITER '|';
> COPY experts FROM 'experts.csv' WITH DELIMITER '|';
> and the first couple of lines of comments.csv are:
> 7|J. D. Hardy|animal|1996-06-13 14:51:08|1996-06-17
> 8|J. D. Hardy|annelida|1996-06-13 14:51:08|1996-06-17
> I could add WITH NULL AS "" to the commands.
> Thanks,
> Rich

Oh, apologies, then, Rich. I missed the part where they were in separate 

You can still do that, but it runs with the permissions of the postgres 
user, then, so you would need to make sure that wherever you stored 
those files was accessable by the postgres user.

Additionally, I've always had to give a fully qualified path to the 
files in question, since it doesn't deal well with relative paths. =(

Keeping those things in mind, from there, it shouldn't give you any 
trouble. =)

Hope that helps. =)


In response to

pdxpug by date

Next:From: David E. WheelerDate: 2011-05-06 03:54:22
Subject: Re: Any Excel Experts
Previous:From: David E. WheelerDate: 2011-05-06 00:08:16
Subject: Re: Any Excel Experts

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group