From: | Klint Gore <kgore4(at)une(dot)edu(dot)au> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | copy question - fixed width? |
Date: | 2008-02-10 23:22:39 |
Message-ID: | 47AF873F.2080601@une.edu.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Is there any way to make copy work with fixed width files?
eg
create table t1 (code char(5), description char(30));
copy t1 from '/tmp/afile' delimiter as <nothing?>
where afile looks something like
00001test16789012345678901234567890
00002test26789012345678901234567890
00003test36789012345678901234567890
at the moment i have a function that does
create temp table tmp1 (line text);
copy tmp1 from '/tmp/afile';
<bunch of code to create a view of tmp1 with lots of substrings from
looking at information schema for t1 definition>
<it used to do the substrings in the plpgsql but it was orders of
magnitude quicker to use the view>
insert into t1 select * from tmpview;
klint.
--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350
Ph: 02 6773 3789
Fax: 02 6773 3266
EMail: kgore4(at)une(dot)edu(dot)au
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-02-10 23:26:58 | Re: Alter Temporary table in Stored Procedure |
Previous Message | Willem Buitendyk | 2008-02-10 23:13:15 | Mechanics of Select |