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: 4DC34057.50707@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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
files.

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. =)

Lacey

In response to

Browse pdxpug by date

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