Re: COPY Transform support - Mailing list pgsql-hackers

From Csaba Nagy
Subject Re: COPY Transform support
Date
Msg-id 1207234673.8259.45.camel@PCD12478
Whole thread Raw
In response to Re: COPY Transform support  (PFC <lists@peufeu.com>)
List pgsql-hackers
On Thu, 2008-04-03 at 16:44 +0200, PFC wrote:
> CREATE FLATFILE READER mydump (
>     id    INTEGER,
>     date    TEXT,
>     ...
> ) FROM file 'dump.txt'
> (followed by delimiter specification syntax identical to COPY, etc)
> ;

Very cool idea, but why would you need to create a reader object
first ? You should be able to use COPY directly with the target table
being omitted,  meaning the copy will not pump it's result in the target
but be equivalent to a select... and use it in any place where a select
can be used. This would have absolutely no new  syntax, just the rules
changed... 

Now that I had a second look you actually need the field definitions to
meaningfully interpret the file, but then why not use a record
specification instead of the table in the normal COPY command ? I'm not
sure if there's any existing syntax for that but I would guess yes...

In any case, such a feature would help a lot in processing input files
based also on other existing data in the DB.

Cheers,
Csaba.




pgsql-hackers by date:

Previous
From: PFC
Date:
Subject: Re: COPY Transform support
Next
From: PFC
Date:
Subject: Re: COPY Transform support