Re: Script for reading flat file without delimiters - Mailing list pgsql-general

From Tino Wildenhain
Subject Re: Script for reading flat file without delimiters
Date
Msg-id 44A3E55C.7070904@wildenhain.de
Whole thread Raw
In response to Script for reading flat file without delimiters  (Mehdi Aboulkassim <mehdi10ab@yahoo.fr>)
List 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

pgsql-general by date:

Previous
From: Robert Treat
Date:
Subject: Re: phppgadmin
Next
From: "Jasbinder Bali"
Date:
Subject: Database connectivity using a unix shell