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

Started by Josh Berkusover 15 years ago2 messages
#1Josh Berkus
josh@agliodbs.com

... 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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Josh Berkus (#1)
Re: is there a reason we can't copy from a view?

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 use
COPY (select * from myview) TO ...
so the functionality is available.

regards, tom lane