77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.136 2001/03/22 06:16:11 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.136.2.1 2001/08/08 22:32:29 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -305,8 +305,15 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
305305
306306if (from )
307307{/* copy from file to database */
308- if (rel -> rd_rel -> relkind == RELKIND_SEQUENCE )
309- elog (ERROR ,"You cannot change sequence relation %s" ,relname );
308+ if (rel -> rd_rel -> relkind != RELKIND_RELATION )
309+ {
310+ if (rel -> rd_rel -> relkind == RELKIND_VIEW )
311+ elog (ERROR ,"You cannot copy view %s" ,relname );
312+ else if (rel -> rd_rel -> relkind == RELKIND_SEQUENCE )
313+ elog (ERROR ,"You cannot change sequence relation %s" ,relname );
314+ else
315+ elog (ERROR ,"You cannot copy object %s" ,relname );
316+ }
310317if (pipe )
311318{
312319if (IsUnderPostmaster )
@@ -330,6 +337,15 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
330337}
331338else
332339{/* copy from database to file */
340+ if (rel -> rd_rel -> relkind != RELKIND_RELATION )
341+ {
342+ if (rel -> rd_rel -> relkind == RELKIND_VIEW )
343+ elog (ERROR ,"You cannot copy view %s" ,relname );
344+ else if (rel -> rd_rel -> relkind == RELKIND_SEQUENCE )
345+ elog (ERROR ,"You cannot copy sequence %s" ,relname );
346+ else
347+ elog (ERROR ,"You cannot copy object %s" ,relname );
348+ }
333349if (pipe )
334350{
335351if (IsUnderPostmaster )