Re: Importing undelimited files (Flat Files or Fixed-Length records)

From: "Douglas McNaught" <doug(at)mcnaught(dot)org>
To: "Bill Thoen" <bthoen(at)gisnet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Importing undelimited files (Flat Files or Fixed-Length records)
Date: 2008-06-19 23:07:18
Message-ID: 5ded07e00806191607u329a941dk8dd34563d9674043@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 19, 2008 at 6:54 PM, Bill Thoen <bthoen(at)gisnet(dot)com> wrote:
> I've got to load some large fixed-legnth ASCII records into PG and I was
> wondering how this is done. The Copy command looks like it works only with
> delimited files, and I would hate to have to convert these files to
> INSERT-type SQL to run them through psql.. Is there a way one can specify a
> table structure with raw field widths and then just pass it a flat file?

You'll need to use something external to PG, like sed, awk or Perl, to
convert to a delimited file, then load with COPY.

-Doug

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Spadea 2008-06-19 23:22:37 Re: renumber table
Previous Message David Spadea 2008-06-19 23:07:10 Re: renumber table