diff options
Diffstat (limited to 'src/backend/utils/adt/tid.c')
-rw-r--r-- | src/backend/utils/adt/tid.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c index 8cff1e7a12e..dd46001a4eb 100644 --- a/src/backend/utils/adt/tid.c +++ b/src/backend/utils/adt/tid.c @@ -312,9 +312,11 @@ currtid_internal(Relation rel, ItemPointer tid) return currtid_for_view(rel, tid); if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind)) - elog(ERROR, "cannot look at latest visible tid for relation \"%s.%s\"", - get_namespace_name(RelationGetNamespace(rel)), - RelationGetRelationName(rel)); + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot look at latest visible tid for relation \"%s.%s\"", + get_namespace_name(RelationGetNamespace(rel)), + RelationGetRelationName(rel))); ItemPointerCopy(tid, result); @@ -349,16 +351,22 @@ currtid_for_view(Relation viewrel, ItemPointer tid) if (strcmp(NameStr(attr->attname), "ctid") == 0) { if (attr->atttypid != TIDOID) - elog(ERROR, "ctid isn't of type TID"); + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("ctid isn't of type TID")); tididx = i; break; } } if (tididx < 0) - elog(ERROR, "currtid cannot handle views with no CTID"); + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("currtid cannot handle views with no CTID")); rulelock = viewrel->rd_rules; if (!rulelock) - elog(ERROR, "the view has no rules"); + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("the view has no rules")); for (i = 0; i < rulelock->numLocks; i++) { rewrite = rulelock->rules[i]; @@ -368,7 +376,9 @@ currtid_for_view(Relation viewrel, ItemPointer tid) TargetEntry *tle; if (list_length(rewrite->actions) != 1) - elog(ERROR, "only one select rule is allowed in views"); + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("only one select rule is allowed in views")); query = (Query *) linitial(rewrite->actions); tle = get_tle_by_resno(query->targetList, tididx + 1); if (tle && tle->expr && IsA(tle->expr, Var)) |