pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Vecernik <vecernik@aon.at>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: CSV import
Date: Tue, 28 Jan 2003 15:46:07 +0100
Message-ID: <3E3697AF.2030509@aon.at> (raw)

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
2. text fields are surrounded by double quotes

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']
    [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





view thread (12+ messages)  latest in thread

Message-ID: <3E3697AF.2030509@aon.at>
Permalink:  ../3E3697AF.2030509@aon.at/
Also on:    postgresql.org/message-id/3E3697AF.2030509@aon.at

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vecernik@aon.at
  Subject: Re: CSV import
  In-Reply-To: <3E3697AF.2030509@aon.at>

* 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