Re: Script for reading flat file without delimiters

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: Mehdi Aboulkassim <mehdi10ab(at)yahoo(dot)fr>, pgsql-general(at)postgresql(dot)org
Subject: Re: Script for reading flat file without delimiters
Date: 2006-06-29 14:36:12
Message-ID: 44A3E55C.7070904@wildenhain.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mehdi Aboulkassim schrieb:
> If I had to write it in java, I wouldn't mail this issue.
>
> I somewhat a Neophyte in Postrgres that's why I need your help.
>
> I've searched in the netbut I haven't found a script in Plpgsql that can
> read a file.
> Can you tell me if we can do this in Plpgsql?

No you cant read in a file like that with psql. You cant
access filesystem with plpgsql either (quick check
in the docs would have tell you that...)

I was suggesting you write at least a converter program
in whatever language you are confortable with. May it
be java or whatever.

In that script you either access the database directly
(usual JDBC stuff) either via ordinary INSERT INTO ...
statements or if you feel desparete with COPY FROM STDIN
and then streaming.

IF thats too hard for you, just write a converter which reads
your file and outputs a regular CSV file. You can then use
psql command line tool to pull this into the database
(via its COPY function) or via backend with the COPY SQL
command.

If thats all too complex for you, I'm sorry you should stay
away from coding...

Regards
Tino Wildenhain

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-06-29 15:07:28 Re: [GENERAL] UUID's as primary keys
Previous Message Robert Treat 2006-06-29 14:35:49 Re: phppgadmin