> > Thank _you_. > > I didn't see anything in the documentation under COPY TO that > indicated it should not work with views. Since you say it should > raise and error, the documentation should probably be updated too. > > -Steve Pothier- > > Date: Thu, 28 Jun 2001 10:56:29 -0400 > From: Tom Lane <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > > Steve Pothier <[EMAIL PROTECTED]> writes: > > I created a simple view from an existing table. I can select on the > > view ok but COPY TO "does nothing" (no error, no output). > > It should raise an error. Thanks for pointing that out. OK, the following patch throws an error if you try to COPY TO/FROM views. -- Bruce Momjian | http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Index: src/backend/commands/copy.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/copy.c,v retrieving revision 1.139 diff -c -r1.139 copy.c *** src/backend/commands/copy.c 2001/06/08 21:16:48 1.139 --- src/backend/commands/copy.c 2001/07/11 21:50:30 *************** *** 307,312 **** --- 307,314 ---- { /* copy from file to database */ if (rel->rd_rel->relkind == RELKIND_SEQUENCE) elog(ERROR, "You cannot change sequence relation %s", relname); + if (rel->rd_rel->relkind == RELKIND_VIEW) + elog(ERROR, "You cannot copy view %s", relname); if (pipe) { if (IsUnderPostmaster) *************** *** 330,335 **** --- 332,339 ---- } else { /* copy from database to file */ + if (rel->rd_rel->relkind == RELKIND_VIEW) + elog(ERROR, "You cannot copy view %s", relname); if (pipe) { if (IsUnderPostmaster)
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl