Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b6564c4

Browse files
committed
Disable COPY TO/FROM on views.
1 parent 75d872a commit b6564c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/commands/copy.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.139 2001/06/08 21:16:48 petere Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.140 2001/07/11 21:53:59 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -307,6 +307,8 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
307307
{ /* copy from file to database */
308308
if (rel->rd_rel->relkind == RELKIND_SEQUENCE)
309309
elog(ERROR, "You cannot change sequence relation %s", relname);
310+
if (rel->rd_rel->relkind == RELKIND_VIEW)
311+
elog(ERROR, "You cannot copy view %s", relname);
310312
if (pipe)
311313
{
312314
if (IsUnderPostmaster)
@@ -330,6 +332,8 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
330332
}
331333
else
332334
{ /* copy from database to file */
335+
if (rel->rd_rel->relkind == RELKIND_VIEW)
336+
elog(ERROR, "You cannot copy view %s", relname);
333337
if (pipe)
334338
{
335339
if (IsUnderPostmaster)

0 commit comments

Comments
 (0)