if (from)
{ /* 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_RELATION)
+ {
+ if (rel->rd_rel->relkind == RELKIND_VIEW)
+ elog(ERROR, "You cannot copy view %s", relname);
+ else if (rel->rd_rel->relkind == RELKIND_SEQUENCE)
+ elog(ERROR, "You cannot change sequence relation %s", relname);
+ else
+ elog(ERROR, "You cannot copy object %s", relname);
+ }
if (pipe)
{
if (IsUnderPostmaster)
}
else
{ /* copy from database to file */
+ if (rel->rd_rel->relkind != RELKIND_RELATION)
+ {
+ if (rel->rd_rel->relkind == RELKIND_VIEW)
+ elog(ERROR, "You cannot copy view %s", relname);
+ else if (rel->rd_rel->relkind == RELKIND_SEQUENCE)
+ elog(ERROR, "You cannot copy sequence %s", relname);
+ else
+ elog(ERROR, "You cannot copy object %s", relname);
+ }
if (pipe)
{
if (IsUnderPostmaster)