Re: Export tab delimited from mysql to postgres.

From: Theo Galanakis <Theo(dot)Galanakis(at)lonelyplanet(dot)com(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Export tab delimited from mysql to postgres.
Date: 2004-10-12 23:56:01
Message-ID: 82E30406384FFB44AFD1012BAB230B5505F40D46@shiva.au.lpint.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Thankyou all for your advice,

Looking further into the issue I have realised that "data and formatting"
lines are denoted by the same CR/LF symbols. So if I where to replace all
CR/LF symbols it would create a file with one line... I have replace the
CR/LF for reading purposes below with \r\n or alternatively 0D 0A (hex):

columnA columnB
1 What a day!\r\n
2 What a week it has\r\n
been!\r\n
3 What the!\r\n

What this means that it is impossible to move line three back to line two to
look something like this:

columnA columnB
1 What a day!\r\n
2 What a week it has\rbeen!\r\n
3 What the!\r\n

I was thinking of writing code that checked each line to see if correct
number of tab delimited elements in this case 2 elements, if this was not
the case replace the \r\n with \r.

Theo

-----Original Message-----
From: Harald Fuchs [mailto:hf0722x(at)protecting(dot)net]
Sent: Wednesday, 13 October 2004 1:38 AM
To: Theo Galanakis
Subject: Re: Export tab delimited from mysql to postgres.

>         Could you provide a example of how to do this?

Depends on what exactly your dump file contains. Probably something like

sed 's/\\\r/\\r/g'

This means: replace all carriage returns preceded by a backslash by '\r'.

______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright. If you
have received this email in error, please advise the sender and delete
it. If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone. You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.

Browse pgsql-sql by date

  From Date Subject
Next Message Lori 2004-10-13 00:20:28 help with to_date and to_char
Previous Message Peter Eisentraut 2004-10-12 17:37:47 Re: Information about the command SQL " create synonym".