*/
if (lsn < XLOG_BLCKSZ)
ereport(ERROR,
- (errmsg("could not read WAL at LSN %X/%X",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("could not read WAL at LSN %X/%X",
LSN_FORMAT_ARGS(lsn))));
private_data = (ReadLocalXLogPageNoWaitPrivate *)
recoveryTarget != RECOVERY_TARGET_UNSET &&
!reachedRecoveryTarget)
ereport(FATAL,
- (errmsg("recovery ended before configured recovery target was reached")));
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("recovery ended before configured recovery target was reached")));
}
/*
break;
case TAR_NAME_TOO_LONG:
ereport(ERROR,
- (errmsg("file name too long for tar format: \"%s\"",
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("file name too long for tar format: \"%s\"",
filename)));
break;
case TAR_SYMLINK_TOO_LONG:
ereport(ERROR,
- (errmsg("symbolic link target too long for tar format: "
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("symbolic link target too long for tar format: "
"file name \"%s\", target \"%s\"",
filename, linktarget)));
break;
* That's a pretty silly thing to do.)
*/
if (!foundUniqueIndex)
- elog(ERROR, "could not find suitable unique index on materialized view");
+ ereport(ERROR,
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("could not find suitable unique index on materialized view"));
appendStringInfoString(&querybuf,
" AND newdata.* OPERATOR(pg_catalog.*=) mv.*) "
}
ereport(ERROR,
- (errmsg("cannot alter constraint \"%s\" on relation \"%s\"",
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("cannot alter constraint \"%s\" on relation \"%s\"",
cmdcon->conname, RelationGetRelationName(rel)),
ancestorname && ancestortable ?
errdetail("Constraint \"%s\" is derived from constraint \"%s\" of relation \"%s\".",
*/
if (OidIsValid(trigform->tgparentid))
ereport(ERROR,
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot rename trigger \"%s\" on table \"%s\"",
stmt->subname, RelationGetRelationName(targetrel)),
errhint("Rename the trigger on the partitioned table \"%s\" instead.",
*/
if (memberid == ROLE_PG_DATABASE_OWNER)
ereport(ERROR,
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("role \"%s\" cannot be a member of any role",
get_rolespec_name(memberRole)));
*/
if (is_grant && roleid == ROLE_PG_DATABASE_OWNER)
ereport(ERROR,
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("role \"%s\" cannot have explicit members",
GetUserNameFromId(roleid, false)));
if (ssl_ver_min > ssl_ver_max)
{
ereport(isServerStart ? FATAL : LOG,
- (errmsg("could not set SSL protocol version range"),
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("could not set SSL protocol version range"),
errdetail("\"%s\" cannot be higher than \"%s\"",
"ssl_min_protocol_version",
"ssl_max_protocol_version")));
/* Found it, check type and collation match */
if (atttypid != att->atttypid || atttypmod != att->atttypmod)
- elog(ERROR, "attribute \"%s\" of relation \"%s\" does not match parent's type",
- attname, RelationGetRelationName(newrelation));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_COLUMN_DEFINITION),
+ errmsg("attribute \"%s\" of relation \"%s\" does not match parent's type",
+ attname, RelationGetRelationName(newrelation))));
if (attcollation != att->attcollation)
- elog(ERROR, "attribute \"%s\" of relation \"%s\" does not match parent's collation",
- attname, RelationGetRelationName(newrelation));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_COLUMN_DEFINITION),
+ errmsg("attribute \"%s\" of relation \"%s\" does not match parent's collation",
+ attname, RelationGetRelationName(newrelation))));
vars = lappend(vars, makeVar(newvarno,
(AttrNumber) (new_attno + 1),
if (XLogRecPtrIsInvalid(moveto))
ereport(ERROR,
- (errmsg("invalid target WAL LSN")));
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("invalid target WAL LSN")));
/* Build a tuple descriptor for our result type */
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
UCOL_DEFAULT, UCOL_DEFAULT_STRENGTH, NULL, &status);
if (U_FAILURE(status))
ereport(ERROR,
- (errmsg("could not open collator for locale \"%s\" with rules \"%s\": %s",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("could not open collator for locale \"%s\" with rules \"%s\": %s",
iculocstr, icurules, u_errorName(status))));
}
if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING)
{
ereport(ERROR,
- (errmsg("could not get language from locale \"%s\": %s",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("could not get language from locale \"%s\": %s",
loc_str, u_errorName(status))));
}
if (U_FAILURE(status))
ereport(ERROR,
/* use original string for error report */
- (errmsg("could not open collator for locale \"%s\": %s",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("could not open collator for locale \"%s\": %s",
orig_str, u_errorName(status))));
if (U_ICU_VERSION_MAJOR_NUM < 54)
{
ucol_close(collator);
ereport(ERROR,
- (errmsg("could not open collator for locale \"%s\": %s",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("could not open collator for locale \"%s\": %s",
orig_str, u_errorName(status))));
}
}
if (elevel > 0)
ereport(elevel,
- (errmsg("could not convert locale name \"%s\" to language tag: %s",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("could not convert locale name \"%s\" to language tag: %s",
loc_str, u_errorName(status))));
return NULL;
}
if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING)
{
ereport(elevel,
- (errmsg("could not get language from ICU locale \"%s\": %s",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("could not get language from ICU locale \"%s\": %s",
loc_str, u_errorName(status)),
errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
"icu_validation_level", "disabled")));
if (!found)
ereport(elevel,
- (errmsg("ICU locale \"%s\" has unknown language \"%s\"",
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("ICU locale \"%s\" has unknown language \"%s\"",
loc_str, lang),
errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
"icu_validation_level", "disabled")));
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);
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];
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))