mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Error message editing in backend/optimizer, backend/rewrite.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.82 2003/01/17 02:01:16 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.83 2003/07/25 00:01:08 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/acl.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
@@ -97,8 +98,10 @@ InsertRule(char *rulname,
|
||||
if (HeapTupleIsValid(oldtup))
|
||||
{
|
||||
if (!replace)
|
||||
elog(ERROR, "Attempt to insert rule \"%s\" failed: already exists",
|
||||
rulname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
||||
errmsg("rule \"%s\" for relation \"%s\" already exists",
|
||||
rulname, get_rel_name(eventrel_oid))));
|
||||
|
||||
/*
|
||||
* When replacing, we don't need to replace every attribute
|
||||
@@ -224,11 +227,15 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
if (query != getInsertSelectQuery(query, NULL))
|
||||
continue;
|
||||
if (query->resultRelation == PRS2_OLD_VARNO)
|
||||
elog(ERROR, "rule actions on OLD currently not supported"
|
||||
"\n\tuse views or triggers instead");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("rule actions on OLD are not implemented"),
|
||||
errhint("Use views or triggers instead.")));
|
||||
if (query->resultRelation == PRS2_NEW_VARNO)
|
||||
elog(ERROR, "rule actions on NEW currently not supported"
|
||||
"\n\tuse triggers instead");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("rule actions on NEW are not implemented"),
|
||||
errhint("Use triggers instead.")));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -243,29 +250,35 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
* So there cannot be INSTEAD NOTHING, ...
|
||||
*/
|
||||
if (length(action) == 0)
|
||||
{
|
||||
elog(ERROR, "instead nothing rules on select currently not supported"
|
||||
"\n\tuse views instead");
|
||||
}
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("INSTEAD NOTHING rules on select are not implemented"),
|
||||
errhint("Use views instead.")));
|
||||
|
||||
/*
|
||||
* ... there cannot be multiple actions, ...
|
||||
*/
|
||||
if (length(action) > 1)
|
||||
elog(ERROR, "multiple action rules on select currently not supported");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("multiple action rules on select are not implemented")));
|
||||
|
||||
/*
|
||||
* ... the one action must be a SELECT, ...
|
||||
*/
|
||||
query = (Query *) lfirst(action);
|
||||
if (!is_instead || query->commandType != CMD_SELECT)
|
||||
elog(ERROR, "only instead-select rules currently supported on select");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("only instead-select rules are currently supported on select")));
|
||||
|
||||
/*
|
||||
* ... there can be no rule qual, ...
|
||||
*/
|
||||
if (event_qual != NULL)
|
||||
elog(ERROR, "event qualifications not supported for rules on select");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("event qualifications are not implemented for rules on select")));
|
||||
|
||||
/*
|
||||
* ... the targetlist of the SELECT action must exactly match the
|
||||
@@ -283,7 +296,9 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
continue;
|
||||
i++;
|
||||
if (i > event_relation->rd_att->natts)
|
||||
elog(ERROR, "select rule's target list has too many entries");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("select rule's target list has too many entries")));
|
||||
|
||||
attr = event_relation->rd_att->attrs[i - 1];
|
||||
attname = NameStr(attr->attname);
|
||||
@@ -297,13 +312,19 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
* positions.
|
||||
*/
|
||||
if (attr->attisdropped)
|
||||
elog(ERROR, "cannot convert relation containing dropped columns to view");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot convert relation containing dropped columns to view")));
|
||||
|
||||
if (strcmp(resdom->resname, attname) != 0)
|
||||
elog(ERROR, "select rule's target entry %d has different column name from %s", i, attname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("select rule's target entry %d has different column name from \"%s\"", i, attname)));
|
||||
|
||||
if (attr->atttypid != resdom->restype)
|
||||
elog(ERROR, "select rule's target entry %d has different type from attribute %s", i, attname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("select rule's target entry %d has different type from attribute \"%s\"", i, attname)));
|
||||
|
||||
/*
|
||||
* Allow typmods to be different only if one of them is -1,
|
||||
@@ -314,11 +335,15 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
*/
|
||||
if (attr->atttypmod != resdom->restypmod &&
|
||||
attr->atttypmod != -1 && resdom->restypmod != -1)
|
||||
elog(ERROR, "select rule's target entry %d has different size from attribute %s", i, attname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("select rule's target entry %d has different size from attribute \"%s\"", i, attname)));
|
||||
}
|
||||
|
||||
if (i != event_relation->rd_att->natts)
|
||||
elog(ERROR, "select rule's target list has too few entries");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("select rule's target list has too few entries")));
|
||||
|
||||
/*
|
||||
* ... there must not be another ON SELECT rule already ...
|
||||
@@ -331,8 +356,10 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
|
||||
rule = event_relation->rd_rules->rules[i];
|
||||
if (rule->event == CMD_SELECT)
|
||||
elog(ERROR, "\"%s\" is already a view",
|
||||
RelationGetRelationName(event_relation));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("\"%s\" is already a view",
|
||||
RelationGetRelationName(event_relation))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,8 +380,10 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
if (strncmp(stmt->rulename, "_RET", 4) != 0 ||
|
||||
strncmp(stmt->rulename + 4, event_obj->relname,
|
||||
NAMEDATALEN - 4 - 4) != 0)
|
||||
elog(ERROR, "view rule for \"%s\" must be named \"%s\"",
|
||||
event_obj->relname, ViewSelectRuleName);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("view rule for \"%s\" must be named \"%s\"",
|
||||
event_obj->relname, ViewSelectRuleName)));
|
||||
stmt->rulename = pstrdup(ViewSelectRuleName);
|
||||
}
|
||||
|
||||
@@ -370,8 +399,10 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
|
||||
scanDesc = heap_beginscan(event_relation, SnapshotNow, 0, NULL);
|
||||
if (heap_getnext(scanDesc, ForwardScanDirection) != NULL)
|
||||
elog(ERROR, "Relation \"%s\" is not empty. Cannot convert it to view",
|
||||
event_obj->relname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("cannot convert non-empty table \"%s\" to a view",
|
||||
event_obj->relname)));
|
||||
heap_endscan(scanDesc);
|
||||
|
||||
RelisBecomingView = true;
|
||||
@@ -509,12 +540,17 @@ RenameRewriteRule(Oid owningRel, const char *oldName,
|
||||
PointerGetDatum(oldName),
|
||||
0, 0);
|
||||
if (!HeapTupleIsValid(ruletup))
|
||||
elog(ERROR, "RenameRewriteRule: rule \"%s\" does not exist", oldName);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("rule \"%s\" for relation \"%s\" does not exist",
|
||||
oldName, get_rel_name(owningRel))));
|
||||
|
||||
/* should not already exist */
|
||||
if (IsDefinedRewriteRule(owningRel, newName))
|
||||
elog(ERROR, "Attempt to rename rule \"%s\" failed: \"%s\" already exists",
|
||||
oldName, newName);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
||||
errmsg("rule \"%s\" for relation \"%s\" already exists",
|
||||
newName, get_rel_name(owningRel))));
|
||||
|
||||
namestrcpy(&(((Form_pg_rewrite) GETSTRUCT(ruletup))->rulename), newName);
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.123 2003/07/16 17:25:48 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.124 2003/07/25 00:01:08 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -168,7 +168,9 @@ rewriteRuleAction(Query *parsetree,
|
||||
* member statements of the setop?)
|
||||
*/
|
||||
if (sub_action->setOperations != NULL)
|
||||
elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
|
||||
|
||||
sub_action->jointree->fromlist =
|
||||
nconc(newjointree, sub_action->jointree->fromlist);
|
||||
@@ -407,8 +409,7 @@ rewriteTargetList(Query *parsetree, Relation target_relation)
|
||||
{
|
||||
/* Let's just make sure we processed all the non-junk items */
|
||||
if (resdom->resno < 1 || resdom->resno > numattrs)
|
||||
elog(ERROR, "rewriteTargetList: bogus resno %d in targetlist",
|
||||
resdom->resno);
|
||||
elog(ERROR, "bogus resno %d in targetlist", resdom->resno);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,8 +450,10 @@ process_matched_tle(TargetEntry *src_tle,
|
||||
((ArrayRef *) prior_tle->expr)->refassgnexpr == NULL ||
|
||||
((ArrayRef *) src_tle->expr)->refrestype !=
|
||||
((ArrayRef *) prior_tle->expr)->refrestype)
|
||||
elog(ERROR, "Multiple assignments to same attribute \"%s\"",
|
||||
resdom->resname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("multiple assignments to same attribute \"%s\"",
|
||||
resdom->resname)));
|
||||
|
||||
/*
|
||||
* Prior TLE could be a nest of ArrayRefs if we do this more than
|
||||
@@ -461,8 +464,10 @@ process_matched_tle(TargetEntry *src_tle,
|
||||
((ArrayRef *) priorbottom)->refassgnexpr != NULL)
|
||||
priorbottom = (Node *) ((ArrayRef *) priorbottom)->refexpr;
|
||||
if (!equal(priorbottom, ((ArrayRef *) src_tle->expr)->refexpr))
|
||||
elog(ERROR, "Multiple assignments to same attribute \"%s\"",
|
||||
resdom->resname);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("multiple assignments to same attribute \"%s\"",
|
||||
resdom->resname)));
|
||||
|
||||
/*
|
||||
* Looks OK to nest 'em.
|
||||
@@ -550,12 +555,14 @@ build_column_default(Relation rel, int attrno)
|
||||
* type when it was created ...
|
||||
*/
|
||||
if (expr == NULL)
|
||||
elog(ERROR, "Column \"%s\" is of type %s"
|
||||
" but default expression is of type %s"
|
||||
"\n\tYou will need to rewrite or cast the expression",
|
||||
NameStr(att_tup->attname),
|
||||
format_type_be(atttype),
|
||||
format_type_be(exprtype));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
errmsg("column \"%s\" is of type %s"
|
||||
" but default expression is of type %s",
|
||||
NameStr(att_tup->attname),
|
||||
format_type_be(atttype),
|
||||
format_type_be(exprtype)),
|
||||
errhint("You will need to rewrite or cast the expression.")));
|
||||
|
||||
return expr;
|
||||
}
|
||||
@@ -619,11 +626,11 @@ ApplyRetrieveRule(Query *parsetree,
|
||||
*subrte;
|
||||
|
||||
if (length(rule->actions) != 1)
|
||||
elog(ERROR, "ApplyRetrieveRule: expected just one rule action");
|
||||
elog(ERROR, "expected just one rule action");
|
||||
if (rule->qual != NULL)
|
||||
elog(ERROR, "ApplyRetrieveRule: can't handle qualified ON SELECT rule");
|
||||
elog(ERROR, "cannot handle qualified ON SELECT rule");
|
||||
if (!relation_level)
|
||||
elog(ERROR, "ApplyRetrieveRule: can't handle per-attribute ON SELECT rule");
|
||||
elog(ERROR, "cannot handle per-attribute ON SELECT rule");
|
||||
|
||||
/*
|
||||
* Make a modifiable copy of the view query, and recursively expand
|
||||
@@ -872,8 +879,10 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
||||
List *l;
|
||||
|
||||
if (oidMember(RelationGetRelid(rel), activeRIRs))
|
||||
elog(ERROR, "Infinite recursion detected in rules for relation %s",
|
||||
RelationGetRelationName(rel));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("infinite recursion detected in rules for relation \"%s\"",
|
||||
RelationGetRelationName(rel))));
|
||||
newActiveRIRs = lconso(RelationGetRelid(rel), activeRIRs);
|
||||
|
||||
foreach(l, locks)
|
||||
@@ -913,7 +922,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
||||
parsetree->hasAggs = checkExprHasAggs((Node *) parsetree);
|
||||
if (parsetree->hasAggs)
|
||||
if (checkExprHasAggs((Node *) parsetree->jointree))
|
||||
elog(ERROR, "fireRIRrules: failed to remove aggs from qual");
|
||||
elog(ERROR, "failed to remove aggregates from qual");
|
||||
}
|
||||
if (parsetree->hasSubLinks)
|
||||
parsetree->hasSubLinks = checkExprHasSubLink((Node *) parsetree);
|
||||
@@ -1151,8 +1160,10 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
|
||||
rev = (rewrite_event *) lfirst(n);
|
||||
if (rev->relation == RelationGetRelid(rt_entry_relation) &&
|
||||
rev->event == event)
|
||||
elog(ERROR, "Infinite recursion detected in rules for relation %s",
|
||||
RelationGetRelationName(rt_entry_relation));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("infinite recursion detected in rules for relation \"%s\"",
|
||||
RelationGetRelationName(rt_entry_relation))));
|
||||
}
|
||||
|
||||
rev = (rewrite_event *) palloc(sizeof(rewrite_event));
|
||||
@@ -1259,19 +1270,25 @@ QueryRewrite(Query *parsetree)
|
||||
switch (query->commandType)
|
||||
{
|
||||
case CMD_INSERT:
|
||||
elog(ERROR, "Cannot insert into a view"
|
||||
"\n\tYou need an unconditional ON INSERT DO INSTEAD rule");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot insert into a view"),
|
||||
errhint("You need an unconditional ON INSERT DO INSTEAD rule.")));
|
||||
break;
|
||||
case CMD_UPDATE:
|
||||
elog(ERROR, "Cannot update a view"
|
||||
"\n\tYou need an unconditional ON UPDATE DO INSTEAD rule");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot update a view"),
|
||||
errhint("You need an unconditional ON UPDATE DO INSTEAD rule.")));
|
||||
break;
|
||||
case CMD_DELETE:
|
||||
elog(ERROR, "Cannot delete from a view"
|
||||
"\n\tYou need an unconditional ON DELETE DO INSTEAD rule");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot delete from a view"),
|
||||
errhint("You need an unconditional ON DELETE DO INSTEAD rule.")));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "QueryRewrite: unexpected commandType %d",
|
||||
elog(ERROR, "unrecognized commandType: %d",
|
||||
(int) query->commandType);
|
||||
break;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.73 2003/07/16 17:25:48 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.74 2003/07/25 00:01:09 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -678,14 +678,14 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
|
||||
return parsetree;
|
||||
Assert(parsetree->jointree && IsA(parsetree->jointree, FromExpr));
|
||||
if (length(parsetree->jointree->fromlist) != 1)
|
||||
elog(ERROR, "getInsertSelectQuery: expected to find SELECT subquery");
|
||||
elog(ERROR, "expected to find SELECT subquery");
|
||||
rtr = (RangeTblRef *) lfirst(parsetree->jointree->fromlist);
|
||||
Assert(IsA(rtr, RangeTblRef));
|
||||
selectrte = rt_fetch(rtr->rtindex, parsetree->rtable);
|
||||
selectquery = selectrte->subquery;
|
||||
if (!(selectquery && IsA(selectquery, Query) &&
|
||||
selectquery->commandType == CMD_SELECT))
|
||||
elog(ERROR, "getInsertSelectQuery: expected to find SELECT subquery");
|
||||
elog(ERROR, "expected to find SELECT subquery");
|
||||
if (length(selectquery->rtable) >= 2 &&
|
||||
strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname,
|
||||
"*OLD*") == 0 &&
|
||||
@@ -696,7 +696,7 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
|
||||
*subquery_ptr = &(selectrte->subquery);
|
||||
return selectquery;
|
||||
}
|
||||
elog(ERROR, "getInsertSelectQuery: can't find rule placeholders");
|
||||
elog(ERROR, "could not find rule placeholders");
|
||||
return NULL; /* not reached */
|
||||
}
|
||||
|
||||
@@ -730,7 +730,9 @@ AddQual(Query *parsetree, Node *qual)
|
||||
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
|
||||
return;
|
||||
else
|
||||
elog(ERROR, "Conditional utility statements are not implemented");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("conditional utility statements are not implemented")));
|
||||
}
|
||||
|
||||
if (parsetree->setOperations != NULL)
|
||||
@@ -740,7 +742,9 @@ AddQual(Query *parsetree, Node *qual)
|
||||
* (This could be fixed, but right now the planner simply ignores
|
||||
* any qual condition on a setop query.)
|
||||
*/
|
||||
elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
|
||||
}
|
||||
|
||||
/* INTERSECT want's the original, but we need to copy - Jan */
|
||||
@@ -780,7 +784,9 @@ AddHavingQual(Query *parsetree, Node *havingQual)
|
||||
if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt))
|
||||
return;
|
||||
else
|
||||
elog(ERROR, "Conditional utility statements are not implemented");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("conditional utility statements are not implemented")));
|
||||
}
|
||||
|
||||
if (parsetree->setOperations != NULL)
|
||||
@@ -790,7 +796,9 @@ AddHavingQual(Query *parsetree, Node *havingQual)
|
||||
* (This could be fixed, but right now the planner simply ignores
|
||||
* any qual condition on a setop query.)
|
||||
*/
|
||||
elog(ERROR, "Conditional UNION/INTERSECT/EXCEPT statements are not implemented");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
|
||||
}
|
||||
|
||||
/* INTERSECT want's the original, but we need to copy - Jan */
|
||||
@@ -905,7 +913,9 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
|
||||
|
||||
/* band-aid: don't do the wrong thing with a whole-tuple Var */
|
||||
if (var->varattno == InvalidAttrNumber)
|
||||
elog(ERROR, "ResolveNew: can't handle whole-tuple reference");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot handle whole-tuple reference")));
|
||||
|
||||
n = FindMatchingNew(context->targetlist, var->varattno);
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.53 2002/09/04 20:31:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.54 2003/07/25 00:01:09 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -54,7 +54,10 @@ RemoveRewriteRule(Oid owningRel, const char *ruleName, DropBehavior behavior)
|
||||
* complain if no rule with such name exists
|
||||
*/
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "Rule \"%s\" not found", ruleName);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("rule \"%s\" for relation \"%s\" does not exist",
|
||||
ruleName, get_rel_name(owningRel))));
|
||||
|
||||
/*
|
||||
* Verify user has appropriate permissions.
|
||||
@@ -110,8 +113,7 @@ RemoveRewriteRuleById(Oid ruleOid)
|
||||
tuple = systable_getnext(rcscan);
|
||||
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "RemoveRewriteRuleById: Rule %u does not exist",
|
||||
ruleOid);
|
||||
elog(ERROR, "could not find tuple for rule %u", ruleOid);
|
||||
|
||||
/*
|
||||
* We had better grab AccessExclusiveLock so that we know no other
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.54 2002/08/05 03:29:17 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.55 2003/07/25 00:01:09 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -65,7 +65,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules,
|
||||
ObjectIdGetDatum(relationId),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "SetRelationRuleStatus: cache lookup failed for relation %u", relationId);
|
||||
elog(ERROR, "cache lookup failed for relation %u", relationId);
|
||||
classForm = (Form_pg_class) GETSTRUCT(tuple);
|
||||
|
||||
if (classForm->relhasrules != relHasRules ||
|
||||
|
Reference in New Issue
Block a user