Re: COPY (query) TO file

Поиск
Список
Период
Сортировка
От Harald Fuchs
Тема Re: COPY (query) TO file
Дата
Msg-id puejy2cpdf.fsf@srv.protecting.net
обсуждение исходный текст
Ответ на COPY (query) TO file  ("Mark Woodward" <pgsql@mohawksoft.com>)
Ответы Re: COPY (query) TO file  ("Jim C. Nasby" <jnasby@pervasive.com>)
Список pgsql-hackers
In article <44804377.8070706@dunslane.net>,
Andrew Dunstan <andrew@dunslane.net> writes:

> Mark Woodward wrote:
>> Tom had posted a question about file compression with copy. I thought
>> about it, and I want to through this out and see if anyone things it is a
>> good idea.
>> 
>> Currently, the COPY command only copies a table, what if it could operate
>> with a query, as:
>> 
>> COPY (select * from mytable where foo='bar') as BAR TO stdout
>> 
>> 

> Isn't this already being worked on? The TODO list says:

>   Allow COPY to output from views

IIRC Karel Zak posted a patch for that.

>   Another idea would be to allow actual SELECT statements in a COPY.

> Personally I strongly favor the second option as being more flexible
> than the first.

How so?  I see that
 psql -h somehost somedb -c "copy 'somequery' to stdout" >localfile

would be more terse than
 psql -h somehost somedb -c "create temp view tmp as somequery; copy tmp to stdout" >localfile

but what's more flexible there?



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PERFORM] psql -A (unaligned format) eats too much
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: COPY (query) TO file