Re: convert text file to database - Mailing list pgsql-novice

From Szentpali Janos
Subject Re: convert text file to database
Date
Msg-id 20080422100050.M37253@easynet.ro
Whole thread Raw
In response to convert text file to database  (e-letter <inpost@gmail.com>)
List pgsql-novice
> I amended a copy of my csv files as follows:
>
2,OnlineGame,wwwflyordiecom,yyyy/mm/dd,1,player1,player2,0-1,normal,yyyy/mm/dd,1200,1d4d5...33Bf3Rxe50-1
>

3,OnlineGame,wwwflyordiecom,yyyy/mm/dd,1,player1,player2,0-1,normal,yyyy/mm/dd,1,player1,player2,1200,1e4d52e5d4...Nxf2#0-1
> Compared to my original csv file, I had to remove the field names that...

You can insert the full url with no special formating needed if you respect
the csv standard: it says strings should be enclosed in pairs of double quote
characters. So if you change

2,OnlineGame,wwwflyordiecom,yyyy/mm/dd,1,player1,player2,0-1,normal,yyyy/mm/dd,1200,1d4d5...33Bf3Rxe50-1
to


2,"OnlineGame","http://www.flyordie.com/","yyyy/mm/dd",1,"player1","player2","0-1","normal","yyyy/mm/dd",1200,"1d4d5...33Bf3Rxe50-1"

it will work. You can use other characters than double quote (") for string
delimiters; in that case you should use the QUOTE option of the CSV option to
specify the new string delimiter. If a string delimiter exists in the string,
it can be "escaped" by doubling it:

x said "Go away"

could be written as

"x said ""Go away"""

--
Szentpáli János



--------------------------------------------------

easynet.ro - Best free webmail service hosted by Idilis
.........................................................
Idilis - Internet Provider :: www.idilis.net
Inchiriem conexiuni radio si in zone neracordate la coloana - Broadband Wireless Idilis -



pgsql-novice by date:

Previous
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: Remote / network connection fails
Next
From: Nils Zierath
Date:
Subject: Re: Remote / network connection fails