]> granicus.if.org Git - postgresql/commitdiff
Disable COPY TO/FROM on views.
authorBruce Momjian <bruce@momjian.us>
Wed, 11 Jul 2001 21:53:59 +0000 (21:53 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 11 Jul 2001 21:53:59 +0000 (21:53 +0000)
src/backend/commands/copy.c

index 6f0c977c70469cf60cf129bed0c84b810a511c44..e1b85a46ff0260cd6273dc0fccdf7bb93a8566a5 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.139 2001/06/08 21:16:48 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.140 2001/07/11 21:53:59 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -307,6 +307,8 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
        {                                                       /* 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,6 +332,8 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
        }
        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)