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

From Michael Fuhr
Subject Re: Script for reading flat file without delimiters
Date
Msg-id 20060629133657.GA37181@winnie.fuhr.org
Whole thread Raw
In response to Script for reading flat file without delimiters  (Mehdi Aboulkassim <mehdi10ab@yahoo.fr>)
List pgsql-general
On Thu, Jun 29, 2006 at 03:10:03PM +0200, Mehdi Aboulkassim wrote:
>   I have to write a function that takes a flat file name in parameter
> and load a table with the file information.

Does it matter if this function runs on the server side or in the
client?

>   I think that it has to read the file line per line and parse each
> one to retreive each column data.
>
>   There is NO DELIMITERS between fields.

How are field boundaries recognized?  By column position?  By
patterns in the content?  This might be easiest with a language
like Perl, Python, Tcl, etc., whether on the client side or in a
server-side function written in one of those languages (PL/Perl,
PL/Python, PL/Tcl, etc.).  You could do it with SQL but other
languages are more suitable for text parsing.

--
Michael Fuhr

pgsql-general by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: Script for reading flat file without delimiters
Next
From: lbolognini@gmail.com
Date:
Subject: pg_restore: [archiver] could not open input file