Re: copy question - fixed width?

Поиск
Список
Период
Сортировка
Искать

Re: copy question - fixed width?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Klint Gore  writes:
> Is there any way to make copy work with fixed width files?

I'd suggest using a simple sed script to convert the data into the
format COPY understands.

			regards, tom lane

Re: copy question - fixed width?

От:
Dimitri Fontaine <dfontaine@hi-media.com>
Дата:
Le lundi 11 février 2008, Klint Gore a écrit :
> Is there any way to make copy work with fixed width files?

I'll try to see about implementing this in pgloader, shouldn't be complex. But 
we have some other things on the TODO (which could get formalized by now...).

So at the moment the preprocessing sed script is a better idea than waiting 
for the pgloader release which will be able to process no-separator 
fixed-field length input files.

Regards,
-- 
dim

copy question - fixed width?

От:
Klint Gore <kgore4@une.edu.au>
Дата:
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 

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';
  
  
  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@une.edu.au

FAQ