Обсуждение: is there a reason we can't copy from a view?

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

is there a reason we can't copy from a view?

От
Josh Berkus
Дата:
... other than it just got forgotten?

dolszewski=# create view meh as select * from pg_tables;
CREATE VIEW
dolszewski=# copy meh to stdout;
ERROR:  cannot copy from view "meh"
HINT:  Try the COPY (SELECT ...) TO variant.
dolszewski=# copy (select * from meh) to stdout;
pg_catalogpg_statisticpostgres\Ntff
pg_catalogpg_typepostgres\Ntff

--                                  -- Josh Berkus                                    PostgreSQL Experts Inc.
                        http://www.pgexperts.com
 


Re: is there a reason we can't copy from a view?

От
Tom Lane
Дата:
Josh Berkus <josh@agliodbs.com> writes:
> ... other than it just got forgotten?

We've been over that ground before.  IIRC the conclusion was that
letting COPY TO pretend that a view is a table is a bad idea because
then people would complain about COPY FROM not working for it.  You
can useCOPY (select * from myview) TO ...
so the functionality is available.
        regards, tom lane