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

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: (view raw, whole thread or download thread mbox)
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
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.


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

pgsql-sql by date

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

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