From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Oliver Vecernik <vecernik@aon.at>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: CSV import
Date: Tue, 28 Jan 2003 17:01:23 -0200 (GMT+2)
Message-ID: <Pine.LNX.4.44.0301281700010.15743-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <3E3697AF.2030509@aon.at>
On Tue, 28 Jan 2003, Oliver Vecernik wrote:
> Hi again!
>
> After investigating a little bit further my CSV import couldn't work
> because of following reasons:
>
> 1. CSV files are delimited with CR/LF
See below
> 2. text fields are surrounded by double quotes
in vi
:1,$ s/"//g
>
> Is there a direct way to import such files into PostgreSQL?
>
> I would like to have something like MySQL provides:
>
> LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
> [REPLACE | IGNORE]
> INTO TABLE tbl_name
> [FIELDS
> [TERMINATED BY '\t']
> [[OPTIONALLY] ENCLOSED BY '']
> [ESCAPED BY '\\' ]
> ]
> [LINES TERMINATED BY '\n']
make it
[LINES TERMINATED BY '\r\n']
> [IGNORE number LINES]
> [(col_name,...)]
>
> Has anybody written such a function already?
>
> Regards,
> Oliver
>
> --
> VECERNIK Datenerfassungssysteme
> A-2560 Hernstein, Hofkogelgasse 17
> Tel.: +43 2633 47530, Fax: DW 50
> http://members.aon.at/vecernik
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-10-8981112
fax: +30-10-8981877
email: achill@matrix.gatewaynet.com
mantzios@softlab.ece.ntua.gr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: achill@matrix.gatewaynet.com, vecernik@aon.at
Subject: Re: CSV import
In-Reply-To: <Pine.LNX.4.44.0301281700010.15743-100000@matrix.gatewaynet.com>
References: <3E3697AF.2030509@aon.at> <Pine.LNX.4.44.0301281700010.15743-100000@matrix.gatewaynet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox