Re: COPY IN as SELECT target - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: COPY IN as SELECT target
Date
Msg-id 4B2B8056.8020405@dunslane.net
Whole thread Raw
In response to Re: COPY IN as SELECT target  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers

Pavel Stehule wrote:
> 2009/12/17 Andrew Dunstan <andrew@dunslane.net>:
>   
>> Recently there was discussion about allowing a COPY statement to be a SELECT
>> target, returning a text array, although the syntax wasn't really nailed
>> down that I recall. I was thinking that  we might have
>>
>>   COPY RETURNING ARRAY FROM ...
>>
>> instead of
>>
>>   COPY tablename opt_column_list FROM ...
>>
>>
>> the we possibly could do things like:
>>
>>   SELECT t[5] as a, 3*(t[3]::numeric) as b FROM (COPY RETURNING ARRAY FROM
>> STDIN CSV) as t;
>>
>> Thoughts?
>>     
>
> In this case copy doesn't return array - so RETURNING ARRAY is little
> bit strange.
>
> what
>
> SELECT .. FROM (COPY VALUES [(colums)] FROM ....)
>
>   


You are misunderstanding what I want to provide, which is that it *does* 
return an array of text for each line. That was what the previous 
discussion arrived at, and is illustrated in the example I showed above.


cheers

andrew


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Fast or immediate shutdown
Next
From: Robert Haas
Date:
Subject: Re: Largeobject Access Controls (r2460)