7
7
*
8
8
*
9
9
* 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 $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -305,8 +305,15 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
305
305
306
306
if (from )
307
307
{ /* 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
+ }
310
317
if (pipe )
311
318
{
312
319
if (IsUnderPostmaster )
@@ -330,6 +337,15 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
330
337
}
331
338
else
332
339
{ /* 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
+ }
333
349
if (pipe )
334
350
{
335
351
if (IsUnderPostmaster )
0 commit comments