*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.202 2003/07/20 21:56:32 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.203 2003/07/21 17:04:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* Check the constraints of the tuple
*/
if (rel->rd_att->constr)
- ExecConstraints("CopyFrom", resultRelInfo, slot, estate);
+ ExecConstraints(resultRelInfo, slot, estate);
/*
* OK, store the tuple and create index entries for it
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.71 2003/05/27 17:49:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.72 2003/07/21 17:05:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
break;
default:
- elog(ERROR, "ExecReScan: node type %d not supported",
- nodeTag(node));
- return;
+ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
+ break;
}
if (node->chgParam != NULL)
default:
/* don't make hard error unless caller asks to restore... */
- elog(DEBUG2, "ExecMarkPos: node type %d not supported",
- nodeTag(node));
+ elog(DEBUG2, "unrecognized node type: %d", (int) nodeTag(node));
break;
}
}
break;
default:
- elog(ERROR, "ExecRestrPos: node type %d not supported",
- nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
break;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execGrouping.c,v 1.3 2003/06/22 22:04:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execGrouping.c,v 1.4 2003/07/21 17:05:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
eq_function = oprfuncid(optup);
ReleaseSysCache(optup);
hash_function = get_op_hash_function(eq_opr);
- if (!OidIsValid(hash_function))
- elog(ERROR, "Could not find hash function for hash operator %u",
+ if (!OidIsValid(hash_function)) /* should not happen */
+ elog(ERROR, "could not find hash function for hash operator %u",
eq_opr);
fmgr_info(eq_function, &(*eqfunctions)[i]);
fmgr_info(hash_function, &(*hashfunctions)[i]);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.209 2003/05/08 18:16:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.210 2003/07/21 17:05:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
aclcheck_result = CHECK(ACL_DELETE);
break;
default:
- elog(ERROR, "ExecCheckRTEPerms: bogus operation %d",
- operation);
+ elog(ERROR, "unrecognized operation code: %d",
+ (int) operation);
aclcheck_result = ACLCHECK_OK; /* keep compiler quiet */
break;
}
return;
fail:
- elog(ERROR, "transaction is read-only");
+ ereport(ERROR,
+ (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
+ errmsg("transaction is read-only")));
}
switch (resultRelationDesc->rd_rel->relkind)
{
case RELKIND_SEQUENCE:
- elog(ERROR, "You can't change sequence relation %s",
- RelationGetRelationName(resultRelationDesc));
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot change sequence relation \"%s\"",
+ RelationGetRelationName(resultRelationDesc))));
break;
case RELKIND_TOASTVALUE:
- elog(ERROR, "You can't change toast relation %s",
- RelationGetRelationName(resultRelationDesc));
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot change toast relation \"%s\"",
+ RelationGetRelationName(resultRelationDesc))));
break;
case RELKIND_VIEW:
- elog(ERROR, "You can't change view relation %s",
- RelationGetRelationName(resultRelationDesc));
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot change view relation \"%s\"",
+ RelationGetRelationName(resultRelationDesc))));
break;
}
"ctid",
&datum,
&isNull))
- elog(ERROR, "ExecutePlan: NO (junk) `ctid' was found!");
+ elog(ERROR, "could not find junk ctid column");
/* shouldn't ever get a null result... */
if (isNull)
- elog(ERROR, "ExecutePlan: (junk) `ctid' is NULL!");
+ elog(ERROR, "ctid is NULL");
tupleid = (ItemPointer) DatumGetPointer(datum);
tuple_ctid = *tupleid; /* make sure we don't free the
erm->resname,
&datum,
&isNull))
- elog(ERROR, "ExecutePlan: NO (junk) `%s' was found!",
+ elog(ERROR, "could not find junk \"%s\" column",
erm->resname);
/* shouldn't ever get a null result... */
if (isNull)
- elog(ERROR, "ExecutePlan: (junk) `%s' is NULL!",
- erm->resname);
+ elog(ERROR, "\"%s\" is NULL", erm->resname);
tuple.t_self = *((ItemPointer) DatumGetPointer(datum));
test = heap_mark4update(erm->relation, &tuple, &buffer,
case HeapTupleUpdated:
if (XactIsoLevel == XACT_SERIALIZABLE)
- elog(ERROR, "Can't serialize access due to concurrent update");
+ ereport(ERROR,
+ (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+ errmsg("cannot serialize access due to concurrent update")));
if (!(ItemPointerEquals(&(tuple.t_self),
(ItemPointer) DatumGetPointer(datum))))
{
goto lnext;
default:
- elog(ERROR, "Unknown status %u from heap_mark4update", test);
+ elog(ERROR, "unrecognized heap_mark4update status: %u",
+ test);
return (NULL);
}
}
break;
default:
- elog(LOG, "ExecutePlan: unknown operation in queryDesc");
+ elog(ERROR, "unrecognized operation code: %d",
+ (int) operation);
result = NULL;
break;
}
* Check the constraints of the tuple
*/
if (resultRelationDesc->rd_att->constr)
- ExecConstraints("ExecInsert", resultRelInfo, slot, estate);
+ ExecConstraints(resultRelInfo, slot, estate);
/*
* insert the tuple
case HeapTupleUpdated:
if (XactIsoLevel == XACT_SERIALIZABLE)
- elog(ERROR, "Can't serialize access due to concurrent update");
+ ereport(ERROR,
+ (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+ errmsg("cannot serialize access due to concurrent update")));
else if (!(ItemPointerEquals(tupleid, &ctid)))
{
TupleTableSlot *epqslot = EvalPlanQual(estate,
return;
default:
- elog(ERROR, "Unknown status %u from heap_delete", result);
+ elog(ERROR, "unrecognized heap_delete status: %u", result);
return;
}
* abort the operation if not running transactions
*/
if (IsBootstrapProcessingMode())
- {
- elog(WARNING, "ExecUpdate: UPDATE can't run without transactions");
- return;
- }
+ elog(ERROR, "cannot UPDATE during bootstrap");
/*
* get the heap tuple out of the tuple table slot
*/
lreplace:;
if (resultRelationDesc->rd_att->constr)
- ExecConstraints("ExecUpdate", resultRelInfo, slot, estate);
+ ExecConstraints(resultRelInfo, slot, estate);
/*
* replace the heap tuple
case HeapTupleUpdated:
if (XactIsoLevel == XACT_SERIALIZABLE)
- elog(ERROR, "Can't serialize access due to concurrent update");
+ ereport(ERROR,
+ (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+ errmsg("cannot serialize access due to concurrent update")));
else if (!(ItemPointerEquals(tupleid, &ctid)))
{
TupleTableSlot *epqslot = EvalPlanQual(estate,
return;
default:
- elog(ERROR, "Unknown status %u from heap_update", result);
+ elog(ERROR, "unrecognized heap_update status: %u", result);
return;
}
ExecARUpdateTriggers(estate, resultRelInfo, tupleid, tuple);
}
-static char *
+static const char *
ExecRelCheck(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot, EState *estate)
{
}
/* NULL result means no error */
- return (char *) NULL;
+ return NULL;
}
void
-ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
+ExecConstraints(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot, EState *estate)
{
Relation rel = resultRelInfo->ri_RelationDesc;
{
if (rel->rd_att->attrs[attrChk - 1]->attnotnull &&
heap_attisnull(tuple, attrChk))
- elog(ERROR, "%s: Fail to add null value in not null attribute %s",
- caller, NameStr(rel->rd_att->attrs[attrChk - 1]->attname));
+ ereport(ERROR,
+ (errcode(ERRCODE_NOT_NULL_VIOLATION),
+ errmsg("null value for attribute \"%s\" violates NOT NULL constraint",
+ NameStr(rel->rd_att->attrs[attrChk - 1]->attname))));
}
}
if (constr->num_check > 0)
{
- char *failed;
+ const char *failed;
if ((failed = ExecRelCheck(resultRelInfo, slot, estate)) != NULL)
- elog(ERROR, "%s: rejected due to CHECK constraint \"%s\" on \"%s\"",
- caller, failed, RelationGetRelationName(rel));
+ ereport(ERROR,
+ (errcode(ERRCODE_CHECK_VIOLATION),
+ errmsg("new row for relation \"%s\" violates CHECK constraint \"%s\"",
+ RelationGetRelationName(rel), failed)));
}
}
}
}
if (relation == NULL)
- elog(ERROR, "EvalPlanQual: can't find RTE %d", (int) rti);
+ elog(ERROR, "cannot find RowMark for RT index %u", rti);
}
/*
{
TransactionId xwait = SnapshotDirty->xmax;
+ /* xmin should not be dirty... */
if (TransactionIdIsValid(SnapshotDirty->xmin))
- elog(ERROR, "EvalPlanQual: t_xmin is uncommitted ?!");
+ elog(ERROR, "t_xmin is uncommitted in tuple to be updated");
/*
* If tuple is being updated by other transaction then we have
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.36 2003/05/05 17:57:47 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.37 2003/07/21 17:05:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
break;
default:
- elog(ERROR, "ExecInitNode: node type %d unsupported",
- (int) nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
result = NULL; /* keep compiler quiet */
break;
}
break;
default:
- elog(ERROR, "ExecProcNode: node type %d unsupported",
- (int) nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
result = NULL;
break;
}
return ExecCountSlotsLimit((Limit *) node);
default:
- elog(ERROR, "ExecCountSlotsNode: node type %d unsupported",
- (int) nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
break;
}
break;
default:
- elog(ERROR, "ExecEndNode: node type %d unsupported",
- (int) nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
break;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.134 2003/06/29 00:33:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.135 2003/07/21 17:05:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
foreach(elt, astate->refupperindexpr)
{
if (i >= MAXDIM)
- elog(ERROR, "ExecEvalArrayRef: can only handle %d dimensions",
- MAXDIM);
+ ereport(ERROR,
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("number of array dimensions exceeds the maximum allowed, %d",
+ MAXDIM)));
upper.indx[i++] = DatumGetInt32(ExecEvalExpr((ExprState *) lfirst(elt),
econtext,
foreach(elt, astate->reflowerindexpr)
{
if (j >= MAXDIM)
- elog(ERROR, "ExecEvalArrayRef: can only handle %d dimensions",
- MAXDIM);
+ ereport(ERROR,
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("number of array dimensions exceeds the maximum allowed, %d",
+ MAXDIM)));
lower.indx[j++] = DatumGetInt32(ExecEvalExpr((ExprState *) lfirst(elt),
econtext,
return PointerGetDatum(array_source);
}
}
+ /* this can't happen unless parser messed up */
if (i != j)
- elog(ERROR,
- "ExecEvalArrayRef: upper and lower indices mismatch");
+ elog(ERROR, "upper and lower index lists are not same length");
lIndex = lower.indx;
}
else
ExecEvalAggref(AggrefExprState *aggref, ExprContext *econtext, bool *isNull)
{
if (econtext->ecxt_aggvalues == NULL) /* safety check */
- elog(ERROR, "ExecEvalAggref: no aggregates in this expression context");
+ elog(ERROR, "no aggregates in this expression context");
*isNull = econtext->ecxt_aggnulls[aggref->aggno];
return econtext->ecxt_aggvalues[aggref->aggno];
matchFound = true;
break;
default:
- elog(ERROR, "ExecEvalParam: invalid paramkind %d",
+ elog(ERROR, "unrecognized paramkind: %d",
thisParamKind);
}
}
if (!matchFound)
{
if (thisParamKind == PARAM_NAMED)
- elog(ERROR, "ExecEvalParam: Unknown value for parameter %s",
- thisParamName);
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("no value found for parameter \"%s\"",
+ thisParamName)));
else
- elog(ERROR, "ExecEvalParam: Unknown value for parameter %d",
- thisParamId);
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("no value found for parameter %d",
+ thisParamId)));
}
*isNull = paramList->isnull;
Datum retval;
if (!AttributeNumberIsValid(attrno))
- elog(ERROR, "GetAttributeByNum: Invalid attribute number");
-
- if (!AttrNumberIsForUserDefinedAttr(attrno))
- elog(ERROR, "GetAttributeByNum: cannot access system attributes here");
+ elog(ERROR, "invalid attribute number: %d", attrno);
if (isNull == (bool *) NULL)
- elog(ERROR, "GetAttributeByNum: a NULL isNull flag was passed");
+ elog(ERROR, "a NULL isNull pointer was passed");
if (TupIsNull(slot))
{
int i;
if (attname == NULL)
- elog(ERROR, "GetAttributeByName: Invalid attribute name");
+ elog(ERROR, "invalid attribute name");
if (isNull == (bool *) NULL)
- elog(ERROR, "GetAttributeByName: a NULL isNull flag was passed");
+ elog(ERROR, "a NULL isNull pointer was passed");
if (TupIsNull(slot))
{
}
if (attrno == InvalidAttrNumber)
- elog(ERROR, "GetAttributeByName: attribute %s not found", attname);
+ elog(ERROR, "attribute \"%s\" does not exist", attname);
retval = heap_getattr(slot->val,
attrno,
/* Safety check (should never fail, as parser should check sooner) */
if (length(fcache->args) > FUNC_MAX_ARGS)
- elog(ERROR, "init_fcache: too many arguments");
+ elog(ERROR, "too many arguments to function");
/* Set up the primary fmgr lookup information */
fmgr_info_cxt(foid, &(fcache->func), fcacheCxt);
* it.
*/
if (argIsDone != ExprSingleResult)
- elog(ERROR, "Functions and operators can take only one set argument");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("functions and operators can take at most one set argument")));
argIsDone = thisArgIsDone;
}
i++;
if (isDone)
*isDone = ExprEndResult;
else
- elog(ERROR, "Set-valued function called in context that cannot accept a set");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("set-valued function called in context that cannot accept a set")));
return (Datum) 0;
}
hasSetArg = (argDone != ExprSingleResult);
* to accept one.
*/
if (isDone == NULL)
- elog(ERROR, "Set-valued function called in context that cannot accept a set");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("set-valued function called in context that cannot accept a set")));
/*
* This loop handles the situation where we have both a set
argDone = ExecEvalFuncArgs(&fcinfo, fcache->args, econtext);
/* We don't allow sets in the arguments of the table function */
if (argDone != ExprSingleResult)
- elog(ERROR, "Set-valued function called in context that cannot accept a set");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("set-valued function called in context that cannot accept a set")));
/*
* If function is strict, and there are any NULL arguments, skip
* TupleTableSlot; use its descriptor
*/
slot = (TupleTableSlot *) DatumGetPointer(result);
- if (fcinfo.isnull ||
- !slot ||
- !IsA(slot, TupleTableSlot) ||
+ if (fcinfo.isnull || !slot)
+ ereport(ERROR,
+ (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("function returning tuple cannot return NULL")));
+ if (!IsA(slot, TupleTableSlot) ||
!slot->ttc_tupleDescriptor)
- elog(ERROR, "ExecMakeTableFunctionResult: Invalid result from function returning tuple");
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("function returning tuple did not return a valid tuple slot")));
tupdesc = CreateTupleDescCopy(slot->ttc_tupleDescriptor);
returnsTuple = true;
}
!slot ||
!IsA(slot, TupleTableSlot) ||
TupIsNull(slot))
- elog(ERROR, "ExecMakeTableFunctionResult: Invalid result from function returning tuple");
+ ereport(ERROR,
+ (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("function returning tuple cannot return NULL")));
tuple = slot->val;
}
else
{
/* check we're on the same page as the function author */
if (!first_time || rsinfo.isDone != ExprSingleResult)
- elog(ERROR, "ExecMakeTableFunctionResult: Materialize-mode protocol not followed");
+ ereport(ERROR,
+ (errcode(ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED),
+ errmsg("table-function protocol for materialize mode was not followed")));
/* Done evaluating the set result */
break;
}
else
- elog(ERROR, "ExecMakeTableFunctionResult: unknown returnMode %d",
- (int) rsinfo.returnMode);
+ ereport(ERROR,
+ (errcode(ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED),
+ errmsg("unrecognized table-function returnMode: %d",
+ (int) rsinfo.returnMode)));
first_time = false;
}
fcinfo.flinfo = &(fcache->func);
argDone = ExecEvalFuncArgs(&fcinfo, argList, econtext);
if (argDone != ExprSingleResult)
- elog(ERROR, "IS DISTINCT FROM does not support set arguments");
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("IS DISTINCT FROM does not support set arguments")));
Assert(fcinfo.nargs == 2);
if (fcinfo.argnull[0] && fcinfo.argnull[1])
fcinfo.flinfo = &(sstate->fxprstate.func);
argDone = ExecEvalFuncArgs(&fcinfo, sstate->fxprstate.args, econtext);
if (argDone != ExprSingleResult)
- elog(ERROR, "op ANY/ALL (array) does not support set arguments");
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("op ANY/ALL (array) does not support set arguments")));
Assert(fcinfo.nargs == 2);
/*
dvalues[i++] = ExecEvalExpr(e, econtext, &eisnull, NULL);
if (eisnull)
- elog(ERROR, "Arrays cannot have NULL elements");
+ ereport(ERROR,
+ (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("arrays cannot have NULL elements")));
}
/* setup for 1-D array of the given length */
int i;
if (ndims <= 0 || ndims > MAXDIM)
- elog(ERROR, "Arrays cannot have more than %d dimensions", MAXDIM);
+ ereport(ERROR,
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("number of array dimensions exceeds the maximum allowed, %d",
+ MAXDIM)));
/* loop through and get data area from each element */
foreach(element, astate->elements)
arraydatum = ExecEvalExpr(e, econtext, &eisnull, NULL);
if (eisnull)
- elog(ERROR, "Arrays cannot have NULL elements");
+ ereport(ERROR,
+ (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("arrays cannot have NULL elements")));
array = DatumGetArrayTypeP(arraydatum);
else
{
/* Check other sub-arrays are compatible */
- if (elem_ndims != ARR_NDIM(array))
- elog(ERROR, "Multidimensional arrays must have array "
- "expressions with matching number of dimensions");
-
- if (memcmp(elem_dims, ARR_DIMS(array),
- elem_ndims * sizeof(int)) != 0)
- elog(ERROR, "Multidimensional arrays must have array "
- "expressions with matching dimensions");
-
- if (memcmp(elem_lbs, ARR_LBOUND(array),
+ if (elem_ndims != ARR_NDIM(array) ||
+ memcmp(elem_dims, ARR_DIMS(array),
+ elem_ndims * sizeof(int)) != 0 ||
+ memcmp(elem_lbs, ARR_LBOUND(array),
elem_ndims * sizeof(int)) != 0)
- elog(ERROR, "Multidimensional arrays must have array "
- "expressions with matching dimensions");
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("multidimensional arrays must have array "
+ "expressions with matching dimensions")));
}
elem_ndatabytes = ARR_SIZE(array) - ARR_OVERHEAD(elem_ndims);
fcinfo.flinfo = &(fcache->func);
argDone = ExecEvalFuncArgs(&fcinfo, argList, econtext);
if (argDone != ExprSingleResult)
- elog(ERROR, "NULLIF does not support set arguments");
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("NULLIF does not support set arguments")));
Assert(fcinfo.nargs == 2);
/* if either argument is NULL they can't be equal */
else
return BoolGetDatum(true);
default:
- elog(ERROR, "ExecEvalNullTest: unexpected nulltesttype %d",
+ elog(ERROR, "unrecognized nulltesttype: %d",
(int) ntest->nulltesttype);
return (Datum) 0; /* keep compiler quiet */
}
else
return BoolGetDatum(true);
default:
- elog(ERROR, "ExecEvalBooleanTest: unexpected booltesttype %d",
+ elog(ERROR, "unrecognized booltesttype: %d",
(int) btest->booltesttype);
return (Datum) 0; /* keep compiler quiet */
}
{
case DOM_CONSTRAINT_NOTNULL:
if (*isNull)
- elog(ERROR, "Domain %s does not allow NULL values",
- format_type_be(ctest->resulttype));
+ ereport(ERROR,
+ (errcode(ERRCODE_NOT_NULL_VIOLATION),
+ errmsg("domain %s does not allow NULL values",
+ format_type_be(ctest->resulttype))));
break;
case DOM_CONSTRAINT_CHECK:
{
if (!conIsNull &&
!DatumGetBool(conResult))
- elog(ERROR, "ExecEvalCoerceToDomain: Domain %s constraint %s failed",
- format_type_be(ctest->resulttype), con->name);
-
+ ereport(ERROR,
+ (errcode(ERRCODE_CHECK_VIOLATION),
+ errmsg("value for domain %s violates CHECK constraint \"%s\"",
+ format_type_be(ctest->resulttype),
+ con->name)));
econtext->domainValue_datum = save_datum;
econtext->domainValue_isNull = save_isNull;
break;
}
default:
- elog(ERROR, "ExecEvalCoerceToDomain: Constraint type unknown");
+ elog(ERROR, "unrecognized constraint type: %d",
+ (int) con->constrainttype);
break;
}
}
* *isDone: set to indicator of set-result status
*
* A caller that can only accept a singleton (non-set) result should pass
- * NULL for isDone; if the expression computes a set result then an elog()
- * error will be reported. If the caller does pass an isDone pointer then
- * *isDone is set to one of these three states:
+ * NULL for isDone; if the expression computes a set result then an error
+ * will be reported via ereport. If the caller does pass an isDone pointer
+ * then *isDone is set to one of these three states:
* ExprSingleResult singleton result (not a set)
* ExprMultipleResult return value is one element of a set
* ExprEndResult there are no more elements in the set
retDatum = ExecEvalNot(state, econtext, isNull);
break;
default:
- elog(ERROR, "ExecEvalExpr: unknown boolop %d",
- ((BoolExpr *) expr)->boolop);
+ elog(ERROR, "unrecognized boolop: %d",
+ (int) ((BoolExpr *) expr)->boolop);
retDatum = 0; /* keep compiler quiet */
break;
}
isNull);
break;
default:
- elog(ERROR, "ExecEvalExpr: unknown expression type %d",
- nodeTag(expression));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(expression));
retDatum = 0; /* keep compiler quiet */
break;
}
/*
* Complain if the aggregate's argument contains any
* aggregates; nested agg functions are semantically
- * nonsensical. (This probably was caught earlier,
+ * nonsensical. (This should have been caught earlier,
* but we defend against it here anyway.)
*/
if (naggs != aggstate->numaggs)
- elog(ERROR, "Aggregate function calls may not be nested");
+ ereport(ERROR,
+ (errcode(ERRCODE_GROUPING_ERROR),
+ errmsg("aggregate function calls may not be nested")));
}
else
- elog(ERROR, "ExecInitExpr: Aggref not expected here");
+ {
+ /* planner messed up */
+ elog(ERROR, "aggref found in non-Agg plan node");
+ }
state = (ExprState *) astate;
}
break;
SubPlanState *sstate = makeNode(SubPlanState);
if (!parent)
- elog(ERROR, "ExecInitExpr: SubPlan not expected here");
+ elog(ERROR, "SubPlan found with no parent plan");
/*
* Here we just add the SubPlanState nodes to
return (ExprState *) FastListValue(&outlist);
}
default:
- elog(ERROR, "ExecInitExpr: unknown expression type %d",
- nodeTag(node));
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(node));
state = NULL; /* keep compiler quiet */
break;
}
SubPlanState *sstate = makeNode(SubPlanState);
if (!parent)
- elog(ERROR, "ExecInitExpr: SubPlan not expected here");
+ elog(ERROR, "SubPlan found with no parent plan");
/* The subplan's state will be initialized later */
sstate->sub_estate = NULL;
{
/* We have a set-valued expression in the tlist */
if (isDone == NULL)
- elog(ERROR, "Set-valued function called in context that cannot accept a set");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("set-valued function called in context that cannot accept a set")));
if (itemIsDone[resind] == ExprMultipleResult)
{
/* we have undone sets in the tlist, set flag */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.66 2003/05/08 18:16:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.67 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* -mer 4 Aug 1992
*/
if (table->next >= table->size)
- elog(ERROR, "Plan requires more slots than are available"
- "\n\tsend mail to your local executor guru to fix this");
+ elog(ERROR, "plan requires more slots than are available");
/*
* at this point, space in the table is guaranteed so we reserve the
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.67 2003/07/01 00:04:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.68 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ObjectIdGetDatum(foid),
0, 0, 0);
if (!HeapTupleIsValid(procedureTuple))
- elog(ERROR, "init_sql_fcache: Cache lookup failed for procedure %u",
- foid);
+ elog(ERROR, "cache lookup failed for function %u", foid);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
/*
if (rettype == ANYARRAYOID || rettype == ANYELEMENTOID)
{
rettype = get_fn_expr_rettype(finfo);
- if (rettype == InvalidOid)
- elog(ERROR, "could not determine actual result type for function declared %s",
- format_type_be(procedureStruct->prorettype));
+ if (rettype == InvalidOid) /* this probably should not happen */
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("could not determine actual result type for function declared %s",
+ format_type_be(procedureStruct->prorettype))));
}
/* Now look up the actual result type */
ObjectIdGetDatum(rettype),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
- elog(ERROR, "init_sql_fcache: Cache lookup failed for type %u",
- rettype);
+ elog(ERROR, "cache lookup failed for type %u", rettype);
typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
/*
{
argtype = get_fn_expr_argtype(finfo, argnum);
if (argtype == InvalidOid)
- elog(ERROR, "could not determine actual type of argument declared %s",
- format_type_be(argOidVect[argnum]));
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("could not determine actual type of argument declared %s",
+ format_type_be(argOidVect[argnum]))));
argOidVect[argnum] = argtype;
haspolyarg = true;
}
Anum_pg_proc_prosrc,
&isNull);
if (isNull)
- elog(ERROR, "init_sql_fcache: null prosrc for procedure %u",
- foid);
+ elog(ERROR, "null prosrc for function %u", foid);
src = DatumGetCString(DirectFunctionCall1(textout, tmp));
fcache->func_state = init_execution_state(src, argOidVect, nargs,
if (rsi && IsA(rsi, ReturnSetInfo))
rsi->isDone = ExprEndResult;
else
- elog(ERROR, "Set-valued function called in context that cannot accept a set");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("set-valued function called in context that cannot accept a set")));
fcinfo->isnull = true;
result = (Datum) 0;
if (rsi && IsA(rsi, ReturnSetInfo))
rsi->isDone = ExprMultipleResult;
else
- elog(ERROR, "Set-valued function called in context that cannot accept a set");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("set-valued function called in context that cannot accept a set")));
/*
* Ensure we will get shut down cleanly if the exprcontext is not
* Copyright (c) 2001, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/instrument.c,v 1.3 2002/03/02 21:39:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/instrument.c,v 1.4 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
return;
if (instr->starttime.tv_sec != 0 || instr->starttime.tv_usec != 0)
- elog(LOG, "InstrStartTimer called twice in a row");
+ elog(DEBUG2, "InstrStartTimer called twice in a row");
else
gettimeofday(&instr->starttime, NULL);
}
if (instr->starttime.tv_sec == 0 && instr->starttime.tv_usec == 0)
{
- elog(LOG, "InstrStopNode without start");
+ elog(DEBUG2, "InstrStopNode without start");
return;
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.110 2003/07/01 19:10:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.111 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ObjectIdGetDatum(aggref->aggfnoid),
0, 0, 0);
if (!HeapTupleIsValid(aggTuple))
- elog(ERROR, "ExecAgg: cache lookup failed for aggregate %u",
+ elog(ERROR, "cache lookup failed for aggregate %u",
aggref->aggfnoid);
aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);
if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
{
if (!IsBinaryCoercible(inputType, aggtranstype))
- elog(ERROR, "Aggregate %u needs to have compatible input type and transition type",
- aggref->aggfnoid);
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
+ errmsg("aggregate %u needs to have compatible input type and transition type",
+ aggref->aggfnoid)));
}
if (aggref->aggdistinct)
ObjectIdGetDatum(transtype),
0, 0, 0);
if (!HeapTupleIsValid(tup))
- elog(ERROR, "GetAggInitVal: cache lookup failed on aggregate transition function return type %u", transtype);
+ elog(ERROR, "cache lookup failed for type %u", transtype);
typinput = ((Form_pg_type) GETSTRUCT(tup))->typinput;
typelem = ((Form_pg_type) GETSTRUCT(tup))->typelem;
Datum
aggregate_dummy(PG_FUNCTION_ARGS)
{
- elog(ERROR, "Aggregate function %u called as normal function",
+ elog(ERROR, "aggregate function %u called as normal function",
fcinfo->flinfo->fn_oid);
return (Datum) 0; /* keep compiler quiet */
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.18 2003/06/15 17:59:10 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.19 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
if (funcTupdesc &&
tupledesc_mismatch(node->tupdesc, funcTupdesc))
- elog(ERROR, "Query-specified return tuple and actual function return tuple do not match");
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("query-specified return tuple and actual function return tuple do not match")));
}
/*
funcrelid = typeidTypeRelid(funcrettype);
if (!OidIsValid(funcrelid))
- elog(ERROR, "Invalid typrelid for complex type %u",
+ elog(ERROR, "invalid typrelid for complex type %u",
funcrettype);
rel = relation_open(funcrelid, AccessShareLock);
tupdesc = CreateTupleDescCopy(RelationGetDescr(rel));
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.76 2003/06/22 22:04:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.77 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
hashfn = get_op_hash_function(lfirsto(ho));
if (!OidIsValid(hashfn))
- elog(ERROR, "Could not find hash function for hash operator %u",
+ elog(ERROR, "could not find hash function for hash operator %u",
lfirsto(ho));
fmgr_info(hashfn, &hashtable->hashfunctions[i]);
i++;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.52 2003/06/22 22:04:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.53 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ExecGetResultType(innerPlanState(hjstate)));
break;
default:
- elog(ERROR, "ExecInitHashJoin: unsupported join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) node->join.jointype);
}
if (nread == 0)
return NULL; /* end of file */
if (nread != sizeof(HeapTupleData))
- elog(ERROR, "Read from hashjoin temp file failed");
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("read from hashjoin temp file failed: %m")));
heapTuple = palloc(HEAPTUPLESIZE + htup.t_len);
memcpy((char *) heapTuple, (char *) &htup, sizeof(HeapTupleData));
heapTuple->t_datamcxt = CurrentMemoryContext;
((char *) heapTuple + HEAPTUPLESIZE);
nread = BufFileRead(file, (void *) heapTuple->t_data, htup.t_len);
if (nread != (size_t) htup.t_len)
- elog(ERROR, "Read from hashjoin temp file failed");
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("read from hashjoin temp file failed: %m")));
return ExecStoreTuple(heapTuple, tupleSlot, InvalidBuffer, true);
}
* start reading them.
*/
if (BufFileSeek(hashtable->outerBatchFile[newbatch - 1], 0, 0L, SEEK_SET))
- elog(ERROR, "Failed to rewind hash temp file");
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("failed to rewind hashjoin temp file: %m")));
innerFile = hashtable->innerBatchFile[newbatch - 1];
if (BufFileSeek(innerFile, 0, 0L, SEEK_SET))
- elog(ERROR, "Failed to rewind hash temp file");
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("failed to rewind hashjoin temp file: %m")));
/*
* Reload the hash table with the new inner batch
written = BufFileWrite(file, (void *) heapTuple, sizeof(HeapTupleData));
if (written != sizeof(HeapTupleData))
- elog(ERROR, "Write to hashjoin temp file failed");
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("write to hashjoin temp file failed: %m")));
written = BufFileWrite(file, (void *) heapTuple->t_data, heapTuple->t_len);
if (written != (size_t) heapTuple->t_len)
- elog(ERROR, "Write to hashjoin temp file failed");
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("write to hashjoin temp file failed: %m")));
}
void
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.79 2003/02/09 06:56:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.80 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
listscan = lnext(listscan);
if (!IsA(clause, OpExpr))
- elog(ERROR, "ExecInitIndexScan: indxqual not an opclause!");
+ elog(ERROR, "indxqual is not an OpExpr");
opfuncid = clause->opfuncid;
* scan-attribute...
*/
if (scanvar == LEFT_OP)
- elog(ERROR, "ExecInitIndexScan: %s",
- "both left and right op's are rel-vars");
+ elog(ERROR, "both left and right operands are rel-vars");
/*
* if the rightop is a "rel-var", then it means that it is
* attribute...
*/
if (scanvar == NO_OP)
- elog(ERROR, "ExecInitIndexScan: %s",
- "neither leftop nor rightop refer to scan relation");
+ elog(ERROR, "neither left nor right operand refer to scan relation");
/*
* initialize the scan key's fields appropriately
currentRelation = heap_open(reloid, AccessShareLock);
if (!RelationGetForm(currentRelation)->relhasindex)
- elog(ERROR, "indexes of the relation %u was inactivated", reloid);
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("indexes of relation %u were deactivated",
+ reloid)));
indexstate->ss.ss_currentRelation = currentRelation;
indexstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.14 2002/12/15 16:17:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.15 2003/07/21 17:05:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
slot = ExecProcNode(outerPlan);
if (TupIsNull(slot))
- elog(ERROR, "ExecLimit: subplan failed to run backwards");
+ elog(ERROR, "LIMIT subplan failed to run backwards");
node->subSlot = slot;
node->position--;
}
*/
slot = ExecProcNode(outerPlan);
if (TupIsNull(slot))
- elog(ERROR, "ExecLimit: subplan failed to run backwards");
+ elog(ERROR, "LIMIT subplan failed to run backwards");
node->subSlot = slot;
node->lstate = LIMIT_INWINDOW;
/* position does not change 'cause we didn't advance it before */
break;
default:
- elog(ERROR, "ExecLimit: impossible state %d",
+ elog(ERROR, "impossible LIMIT state: %d",
(int) node->lstate);
slot = NULL; /* keep compiler quiet */
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.57 2003/05/05 17:57:47 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.58 2003/07/21 17:05:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* The two ops should be identical, so use either one for lookup.
*/
if (!IsA(ltop, OpExpr))
- elog(ERROR, "MJFormSkipQuals: op not an OpExpr!");
+ elog(ERROR, "mergejoin clause is not an OpExpr");
/*
* Lookup the operators, and replace the data in the copied
doFillInner = true;
break;
default:
- elog(ERROR, "ExecMergeJoin: unsupported join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) node->js.jointype);
doFillOuter = false; /* keep compiler quiet */
doFillInner = false;
break;
/*
- * if we get here it means our code is fouled up and so we
- * just end the join prematurely.
+ * broken state value?
*/
default:
- elog(WARNING, "ExecMergeJoin: invalid join state %d, aborting",
- node->mj_JoinState);
- return NULL;
+ elog(ERROR, "unrecognized mergejoin state: %d",
+ (int) node->mj_JoinState);
}
}
}
/*
* Can't handle right or full join with non-nil extra
- * joinclauses.
+ * joinclauses. This should have been caught by planner.
*/
if (node->join.joinqual != NIL)
- elog(ERROR, "RIGHT JOIN is only supported with mergejoinable join conditions");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("RIGHT JOIN is only supported with mergejoinable join conditions")));
break;
case JOIN_FULL:
mergestate->mj_NullOuterTupleSlot =
* joinclauses.
*/
if (node->join.joinqual != NIL)
- elog(ERROR, "FULL JOIN is only supported with mergejoinable join conditions");
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("FULL JOIN is only supported with mergejoinable join conditions")));
break;
default:
- elog(ERROR, "ExecInitMergeJoin: unsupported join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) node->join.jointype);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.32 2003/05/05 17:57:47 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.33 2003/07/21 17:05:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ExecGetResultType(innerPlanState(nlstate)));
break;
default:
- elog(ERROR, "ExecInitNestLoop: unsupported join type %d",
+ elog(ERROR, "unrecognized join type: %d",
(int) node->join.jointype);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.9 2003/01/10 23:54:24 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.10 2003/07/21 17:05:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
0 : (node->numLeft - node->numRight);
break;
default:
- elog(ERROR, "ExecSetOp: bogus command code %d",
+ elog(ERROR, "unrecognized setop code: %d",
(int) plannode->cmd);
break;
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.50 2003/06/27 00:33:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.51 2003/07/21 17:05:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
SubPlan *subplan = (SubPlan *) node->xprstate.expr;
if (subplan->setParam != NIL)
- elog(ERROR, "ExecSubPlan: can't set parent params from subquery");
+ elog(ERROR, "cannot set parent params from subquery");
if (subplan->useHashTable)
return ExecHashSubPlan(node, econtext, isNull);
/* Shouldn't have any direct correlation Vars */
if (subplan->parParam != NIL || node->args != NIL)
- elog(ERROR, "ExecHashSubPlan: direct correlation not supported");
+ elog(ERROR, "hashed subplan with direct correlation not supported");
/*
* If first time through or we need to rescan the subplan, build
{
/* cannot allow multiple input tuples for EXPR sublink */
if (found)
- elog(ERROR, "More than one tuple returned by a subselect used as an expression.");
+ ereport(ERROR,
+ (errcode(ERRCODE_CARDINALITY_VIOLATION),
+ errmsg("more than one tuple returned by a subselect used as an expression")));
found = true;
/*
/* cannot allow multiple input tuples for MULTIEXPR sublink either */
if (subLinkType == MULTIEXPR_SUBLINK && found)
- elog(ERROR, "More than one tuple returned by a subselect used as an expression.");
+ ereport(ERROR,
+ (errcode(ERRCODE_CARDINALITY_VIOLATION),
+ errmsg("more than one tuple returned by a subselect used as an expression")));
found = true;
/* Lookup the associated hash function */
hashfn = get_op_hash_function(opexpr->opno);
if (!OidIsValid(hashfn))
- elog(ERROR, "Could not find hash function for hash operator %u",
+ elog(ERROR, "could not find hash function for hash operator %u",
opexpr->opno);
fmgr_info(hashfn, &node->hashfunctions[i-1]);
if (subLinkType == ANY_SUBLINK ||
subLinkType == ALL_SUBLINK)
- elog(ERROR, "ExecSetParamPlan: ANY/ALL subselect unsupported");
+ elog(ERROR, "ANY/ALL subselect unsupported as initplan");
if (planstate->chgParam != NULL)
ExecReScan(planstate, NULL);
if (found &&
(subLinkType == EXPR_SUBLINK ||
subLinkType == MULTIEXPR_SUBLINK))
- elog(ERROR, "More than one tuple returned by a subselect used as an expression.");
+ ereport(ERROR,
+ (errcode(ERRCODE_CARDINALITY_VIOLATION),
+ errmsg("more than one tuple returned by a subselect used as an expression")));
found = true;
}
}
+/*
+ * Mark an initplan as needing recalculation
+ */
void
ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
{
EState *estate = parent->state;
List *lst;
+ /* sanity checks */
if (subplan->parParam != NIL)
- elog(ERROR, "ExecReScanSetParamPlan: direct correlated subquery unsupported, yet");
+ elog(ERROR, "direct correlated subquery unsupported as initplan");
if (subplan->setParam == NIL)
- elog(ERROR, "ExecReScanSetParamPlan: setParam list is empty");
+ elog(ERROR, "setParam list of initplan is empty");
if (bms_is_empty(planstate->plan->extParam))
- elog(ERROR, "ExecReScanSetParamPlan: extParam set of plan is empty");
+ elog(ERROR, "extParam set of initplan is empty");
/*
* Don't actually re-scan: ExecSetParamPlan does it if needed.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.98 2003/05/09 18:08:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.99 2003/07/21 17:05:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (_SPI_stack == NULL)
{
if (_SPI_connected != -1)
- elog(FATAL, "SPI_connect: no connection(s) expected");
+ elog(ERROR, "SPI stack corrupted");
new_SPI_stack = (_SPI_connection *) malloc(sizeof(_SPI_connection));
}
else
{
- if (_SPI_connected <= -1)
- elog(FATAL, "SPI_connect: some connection(s) expected");
+ if (_SPI_connected < 0)
+ elog(ERROR, "SPI stack corrupted");
new_SPI_stack = (_SPI_connection *) realloc(_SPI_stack,
(_SPI_connected + 2) * sizeof(_SPI_connection));
}
if (new_SPI_stack == NULL)
- elog(ERROR, "Memory exhausted in SPI_connect");
+ ereport(ERROR,
+ (errcode(ERRCODE_OUT_OF_MEMORY),
+ errmsg("out of memory")));
/*
* We' returning to procedure where _SPI_curid == _SPI_connected - 1
(_SPI_connected + 1) * sizeof(_SPI_connection));
/* This could only fail with a pretty stupid malloc package ... */
if (new_SPI_stack == NULL)
- elog(ERROR, "Memory exhausted in SPI_finish");
+ ereport(ERROR,
+ (errcode(ERRCODE_OUT_OF_MEMORY),
+ errmsg("out of memory")));
_SPI_stack = new_SPI_stack;
_SPI_current = &(_SPI_stack[_SPI_connected]);
}
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
- elog(FATAL, "SPI: stack corrupted");
+ elog(ERROR, "SPI stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
- elog(FATAL, "SPI: stack corrupted");
+ elog(ERROR, "SPI stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
- elog(FATAL, "SPI: stack corrupted");
+ elog(ERROR, "SPI stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
- elog(FATAL, "SPI: stack corrupted");
+ elog(ERROR, "SPI stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
SPI_result = 0;
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
- elog(FATAL, "SPI: stack corrupted");
+ elog(ERROR, "SPI stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
/* Ensure that the plan contains only one regular SELECT query */
if (length(ptlist) != 1 || length(qtlist) != 1)
- elog(ERROR, "cannot open multi-query plan as cursor");
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
+ errmsg("cannot open multi-query plan as cursor")));
queryTree = (Query *) lfirst((List *) lfirst(qtlist));
planTree = (Plan *) lfirst(ptlist);
if (queryTree->commandType != CMD_SELECT)
- elog(ERROR, "plan in SPI_cursor_open() is not a SELECT");
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
+ errmsg("cannot open non-SELECT query as cursor")));
if (queryTree->into != NULL)
- elog(ERROR, "plan in SPI_cursor_open() must NOT be a SELECT INTO");
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
+ errmsg("cannot open SELECT INTO query as cursor")));
/* Increment CommandCounter to see changes made by now */
CommandCounterIncrement();
* _SPI_connected
*/
if (_SPI_curid != _SPI_connected || _SPI_connected < 0)
- elog(FATAL, "SPI: improper call to spi_dest_startup");
+ elog(ERROR, "improper call to spi_dest_startup");
if (_SPI_current != &(_SPI_stack[_SPI_curid]))
- elog(FATAL, "SPI: stack corrupted in spi_dest_startup");
+ elog(ERROR, "SPI stack corrupted");
if (_SPI_current->tuptable != NULL)
- elog(FATAL, "SPI: improper call to spi_dest_startup");
+ elog(ERROR, "improper call to spi_dest_startup");
oldcxt = _SPI_procmem(); /* switch to procedure memory context */
* _SPI_connected
*/
if (_SPI_curid != _SPI_connected || _SPI_connected < 0)
- elog(FATAL, "SPI: improper call to spi_printtup");
+ elog(ERROR, "improper call to spi_printtup");
if (_SPI_current != &(_SPI_stack[_SPI_curid]))
- elog(FATAL, "SPI: stack corrupted in spi_printtup");
+ elog(ERROR, "SPI stack corrupted");
tuptable = _SPI_current->tuptable;
if (tuptable == NULL)
- elog(FATAL, "SPI: improper call to spi_printtup");
+ elog(ERROR, "improper call to spi_printtup");
oldcxt = MemoryContextSwitchTo(tuptable->tuptabcxt);
if (operation == CMD_SELECT && queryDesc->dest->mydest == SPI)
{
if (_SPI_checktuples())
- elog(FATAL, "SPI_select: # of processed tuples check failed");
+ elog(ERROR, "consistency check on SPI tuple count failed");
}
if (queryDesc->dest->mydest == SPI)
dest);
if (dest->mydest == SPI && _SPI_checktuples())
- elog(FATAL, "SPI_fetch: # of processed tuples check failed");
+ elog(ERROR, "consistency check on SPI tuple count failed");
/* Put the result into place for access by caller */
SPI_processed = _SPI_current->processed;
return SPI_ERROR_UNCONNECTED;
_SPI_curid++;
if (_SPI_current != &(_SPI_stack[_SPI_curid]))
- elog(FATAL, "SPI: stack corrupted");
+ elog(ERROR, "SPI stack corrupted");
if (execmem) /* switch to the Executor memory context */
_SPI_execmem();
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: executor.h,v 1.95 2003/06/22 22:04:55 tgl Exp $
+ * $Id: executor.h,v 1.96 2003/07/21 17:05:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
extern void ExecutorRewind(QueryDesc *queryDesc);
extern void ExecCheckRTPerms(List *rangeTable, CmdType operation);
extern void ExecEndPlan(PlanState *planstate, EState *estate);
-extern void ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
+extern void ExecConstraints(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot, EState *estate);
extern TupleTableSlot *EvalPlanQual(EState *estate, Index rti,
ItemPointer tid);
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: elog.h,v 1.51 2003/07/21 01:59:11 tgl Exp $
+ * $Id: elog.h,v 1.52 2003/07/21 17:05:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* Class 22 - Data Exception */
#define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2', '0','0','0')
#define ERRCODE_ARRAY_ELEMENT_ERROR MAKE_SQLSTATE('2','2', '0','2','E')
+/* SQL99's actual definition of "array element error" is subscript error */
+#define ERRCODE_ARRAY_SUBSCRIPT_ERROR ERRCODE_ARRAY_ELEMENT_ERROR
#define ERRCODE_CHARACTER_NOT_IN_REPERTOIRE MAKE_SQLSTATE('2','2', '0','2','1')
#define ERRCODE_DATETIME_FIELD_OVERFLOW MAKE_SQLSTATE('2','2', '0','0','8')
#define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2', '0','1','2')
#define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED MAKE_SQLSTATE('3','9', '0','0','1')
#define ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('3','9', '0','0','4')
#define ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9', 'P','0','1')
+#define ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9', 'P','0','2')
/* Class 3D - Invalid Catalog Name */
#define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D', '0','0','0')
alter table atacc1 add constraint atacc_test1 check (test>3);
-- should fail
insert into atacc1 (test) values (2);
-ERROR: ExecInsert: rejected due to CHECK constraint "atacc_test1" on "atacc1"
+ERROR: new row for relation "atacc1" violates CHECK constraint "atacc_test1"
-- should succeed
insert into atacc1 (test) values (4);
drop table atacc1;
alter table atacc1 add constraint atacc_test1 check (test+test2<test3*4);
-- should fail
insert into atacc1 (test,test2,test3) values (4,4,2);
-ERROR: ExecInsert: rejected due to CHECK constraint "atacc_test1" on "atacc1"
+ERROR: new row for relation "atacc1" violates CHECK constraint "atacc_test1"
-- should succeed
insert into atacc1 (test,test2,test3) values (4,4,5);
drop table atacc1;
alter table atacc1 add check (test2>test);
-- should fail for $2
insert into atacc1 (test2, test) values (3, 4);
-ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "atacc1"
+ERROR: new row for relation "atacc1" violates CHECK constraint "$1"
drop table atacc1;
-- inheritance related tests
create table atacc1 (test int);
alter table atacc2 add constraint foo check (test2>0);
-- fail and then succeed on atacc2
insert into atacc2 (test2) values (-3);
-ERROR: ExecInsert: rejected due to CHECK constraint "foo" on "atacc2"
+ERROR: new row for relation "atacc2" violates CHECK constraint "foo"
insert into atacc2 (test2) values (3);
-- fail and then succeed on atacc3
insert into atacc3 (test2) values (-3);
-ERROR: ExecInsert: rejected due to CHECK constraint "foo" on "atacc3"
+ERROR: new row for relation "atacc3" violates CHECK constraint "foo"
insert into atacc3 (test2) values (3);
drop table atacc3;
drop table atacc2;
alter table only atacc2 add constraint foo check (test2>0);
-- fail and then succeed on atacc2
insert into atacc2 (test2) values (-3);
-ERROR: ExecInsert: rejected due to CHECK constraint "foo" on "atacc2"
+ERROR: new row for relation "atacc2" violates CHECK constraint "foo"
insert into atacc2 (test2) values (3);
-- both succeed on atacc3
insert into atacc3 (test2) values (-3);
insert into atacc1 (test) values (4);
-- inserting NULL should fail
insert into atacc1 (test) values(NULL);
-ERROR: ExecInsert: Fail to add null value in not null attribute test
+ERROR: null value for attribute "test" violates NOT NULL constraint
-- try adding a second primary key (should fail)
alter table atacc1 add constraint atacc_oid1 primary key(oid);
ERROR: multiple primary keys for table "atacc1" are not allowed
insert into atacc1 (test,test2) values (4,4);
ERROR: Cannot insert a duplicate key into unique index atacc_test1
insert into atacc1 (test,test2) values (NULL,3);
-ERROR: ExecInsert: Fail to add null value in not null attribute test
+ERROR: null value for attribute "test" violates NOT NULL constraint
insert into atacc1 (test,test2) values (3, NULL);
-ERROR: ExecInsert: Fail to add null value in not null attribute test2
+ERROR: null value for attribute "test2" violates NOT NULL constraint
insert into atacc1 (test,test2) values (NULL,NULL);
-ERROR: ExecInsert: Fail to add null value in not null attribute test
+ERROR: null value for attribute "test" violates NOT NULL constraint
-- should all succeed
insert into atacc1 (test,test2) values (4,5);
insert into atacc1 (test,test2) values (5,4);
insert into atacc1 (test2, test) values (2, 3);
ERROR: Cannot insert a duplicate key into unique index atacc1_pkey
insert into atacc1 (test2, test) values (1, NULL);
-ERROR: ExecInsert: Fail to add null value in not null attribute test
+ERROR: null value for attribute "test" violates NOT NULL constraint
drop table atacc1;
-- alter table / alter column [set/drop] not null tests
-- try altering system catalogs, should fail
create table child (b varchar(255)) inherits (parent);
alter table parent alter a set not null;
insert into parent values (NULL);
-ERROR: ExecInsert: Fail to add null value in not null attribute a
+ERROR: null value for attribute "a" violates NOT NULL constraint
insert into child (a, b) values (NULL, 'foo');
-ERROR: ExecInsert: Fail to add null value in not null attribute a
+ERROR: null value for attribute "a" violates NOT NULL constraint
alter table parent alter a drop not null;
insert into parent values (NULL);
insert into child (a, b) values (NULL, 'foo');
delete from parent;
alter table only parent alter a set not null;
insert into parent values (NULL);
-ERROR: ExecInsert: Fail to add null value in not null attribute a
+ERROR: null value for attribute "a" violates NOT NULL constraint
alter table child alter a set not null;
insert into child (a, b) values (NULL, 'foo');
-ERROR: ExecInsert: Fail to add null value in not null attribute a
+ERROR: null value for attribute "a" violates NOT NULL constraint
delete from child;
alter table child alter a set not null;
insert into child (a, b) values (NULL, 'foo');
-ERROR: ExecInsert: Fail to add null value in not null attribute a
+ERROR: null value for attribute "a" violates NOT NULL constraint
drop table child;
drop table parent;
-- test setting and removing default values
NOTICE: merging definition of column "f2" for child "c1"
insert into p1 values (1,2,'abc');
insert into c1 values(11,'xyz',33,0); -- should fail
-ERROR: ExecInsert: rejected due to CHECK constraint "p1_a1" on "c1"
+ERROR: new row for relation "c1" violates CHECK constraint "p1_a1"
insert into c1 values(11,'xyz',33,22);
select * from p1;
f1 | a1 | f2
, col5 dcheck CHECK (col5 IN ('c', 'd'))
);
INSERT INTO nulltest DEFAULT VALUES;
-ERROR: Domain dnotnull does not allow NULL values
+ERROR: domain dnotnull does not allow NULL values
INSERT INTO nulltest values ('a', 'b', 'c', 'd', 'c'); -- Good
insert into nulltest values ('a', 'b', 'c', 'd', NULL);
-ERROR: Domain dcheck does not allow NULL values
+ERROR: domain dcheck does not allow NULL values
insert into nulltest values ('a', 'b', 'c', 'd', 'a');
-ERROR: ExecInsert: rejected due to CHECK constraint "nulltest_col5" on "nulltest"
+ERROR: new row for relation "nulltest" violates CHECK constraint "nulltest_col5"
INSERT INTO nulltest values (NULL, 'b', 'c', 'd', 'd');
-ERROR: Domain dnotnull does not allow NULL values
+ERROR: domain dnotnull does not allow NULL values
INSERT INTO nulltest values ('a', NULL, 'c', 'd', 'c');
-ERROR: Domain dnotnull does not allow NULL values
+ERROR: domain dnotnull does not allow NULL values
INSERT INTO nulltest values ('a', 'b', NULL, 'd', 'c');
-ERROR: ExecInsert: Fail to add null value in not null attribute col3
+ERROR: null value for attribute "col3" violates NOT NULL constraint
INSERT INTO nulltest values ('a', 'b', 'c', NULL, 'd'); -- Good
-- Test copy
COPY nulltest FROM stdin; --fail
-ERROR: Domain dcheck does not allow NULL values
+ERROR: domain dcheck does not allow NULL values
CONTEXT: COPY FROM, line 1
-- Last row is bad
COPY nulltest FROM stdin;
-ERROR: CopyFrom: rejected due to CHECK constraint "nulltest_col5" on "nulltest"
+ERROR: new row for relation "nulltest" violates CHECK constraint "nulltest_col5"
CONTEXT: COPY FROM, line 3
select * from nulltest;
col1 | col2 | col3 | col4 | col5
(1 row)
SELECT cast(NULL as dnotnull); -- fail
-ERROR: Domain dnotnull does not allow NULL values
+ERROR: domain dnotnull does not allow NULL values
SELECT cast(cast(NULL as dnull) as dnotnull); -- fail
-ERROR: Domain dnotnull does not allow NULL values
+ERROR: domain dnotnull does not allow NULL values
SELECT cast(col4 as dnotnull) from nulltest; -- fail
-ERROR: Domain dnotnull does not allow NULL values
+ERROR: domain dnotnull does not allow NULL values
-- cleanup
drop table nulltest;
drop domain dnotnull restrict;
alter domain dnotnulltest set not null; -- fails
NOTICE: "dnotnulltest" is already set to NOT NULL
update domnotnull set col1 = null; -- fails
-ERROR: Domain dnotnulltest does not allow NULL values
+ERROR: domain dnotnulltest does not allow NULL values
alter domain dnotnulltest drop not null;
alter domain dnotnulltest drop not null; -- fails
NOTICE: "dnotnulltest" is already set to NULL
alter domain con add constraint t check (VALUE < 34);
alter domain con add check (VALUE > 0);
insert into domcontest values (-5); -- fails
-ERROR: ExecEvalCoerceToDomain: Domain con constraint $1 failed
+ERROR: value for domain con violates CHECK constraint "$1"
insert into domcontest values (42); -- fails
-ERROR: ExecEvalCoerceToDomain: Domain con constraint t failed
+ERROR: value for domain con violates CHECK constraint "t"
insert into domcontest values (5);
alter domain con drop constraint t;
insert into domcontest values (-5); --fails
-ERROR: ExecEvalCoerceToDomain: Domain con constraint $1 failed
+ERROR: value for domain con violates CHECK constraint "$1"
insert into domcontest values (42);
-- Confirm ALTER DOMAIN with RULES.
create table domtab (col1 integer);
alter domain dom set not null;
select * from domview; -- fail
-ERROR: Domain dom does not allow NULL values
+ERROR: domain dom does not allow NULL values
alter domain dom drop not null;
select * from domview;
col1
alter domain dom add constraint domchkgt6 check(value > 6);
select * from domview; --fail
-ERROR: ExecEvalCoerceToDomain: Domain dom constraint domchkgt6 failed
+ERROR: value for domain dom violates CHECK constraint "domchkgt6"
alter domain dom drop constraint domchkgt6 restrict;
select * from domview;
col1
CREATE TEMP TABLE z (b TEXT, PRIMARY KEY(aa, b)) inherits (a);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "z_pkey" for table "z"
INSERT INTO z VALUES (NULL, 'text'); -- should fail
-ERROR: ExecInsert: Fail to add null value in not null attribute aa
+ERROR: null value for attribute "aa" violates NOT NULL constraint
-- Check UPDATE with inherited target and an inherited source table
create temp table foo(f1 int, f2 int);
create temp table foo2(f3 int) inherits (foo);
--
create table inserttest (col1 int4, col2 int4 NOT NULL, col3 text default 'testing');
insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT, DEFAULT);
-ERROR: ExecInsert: Fail to add null value in not null attribute col2
+ERROR: null value for attribute "col2" violates NOT NULL constraint
insert into inserttest (col2, col3) values (3, DEFAULT);
insert into inserttest (col1, col2, col3) values (DEFAULT, 5, DEFAULT);
insert into inserttest values (DEFAULT, 5, 'test');
INSERT INTO serialTest VALUES ('bar');
INSERT INTO serialTest VALUES ('force', 100);
INSERT INTO serialTest VALUES ('wrong', NULL);
-ERROR: ExecInsert: Fail to add null value in not null attribute f2
+ERROR: null value for attribute "f2" violates NOT NULL constraint
SELECT * FROM serialTest;
f1 | f2
INSERT INTO CHECK_TBL VALUES (5);
INSERT INTO CHECK_TBL VALUES (4);
INSERT INTO CHECK_TBL VALUES (3);
-ERROR: ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
+ERROR: new row for relation "check_tbl" violates CHECK constraint "check_con"
INSERT INTO CHECK_TBL VALUES (2);
-ERROR: ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
+ERROR: new row for relation "check_tbl" violates CHECK constraint "check_con"
INSERT INTO CHECK_TBL VALUES (6);
INSERT INTO CHECK_TBL VALUES (1);
-ERROR: ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
+ERROR: new row for relation "check_tbl" violates CHECK constraint "check_con"
SELECT '' AS three, * FROM CHECK_TBL;
three | x
-------+---
CHECK (x > 3 and y <> 'check failed' and z < 8));
INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2);
INSERT INTO CHECK2_TBL VALUES (1, 'x check failed', -2);
-ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
+ERROR: new row for relation "check2_tbl" violates CHECK constraint "sequence_con"
INSERT INTO CHECK2_TBL VALUES (5, 'z check failed', 10);
-ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
+ERROR: new row for relation "check2_tbl" violates CHECK constraint "sequence_con"
INSERT INTO CHECK2_TBL VALUES (0, 'check failed', -2);
-ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
+ERROR: new row for relation "check2_tbl" violates CHECK constraint "sequence_con"
INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11);
-ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
+ERROR: new row for relation "check2_tbl" violates CHECK constraint "sequence_con"
INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7);
SELECT '' AS two, * from CHECK2_TBL;
two | x | y | z
CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
CHECK (x + z = 0));
INSERT INTO INSERT_TBL(x,z) VALUES (2, -2);
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "insert_con"
SELECT '' AS zero, * FROM INSERT_TBL;
zero | x | y | z
------+---+---+---
(1 row)
INSERT INTO INSERT_TBL(y) VALUES ('Y');
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "insert_con"
INSERT INTO INSERT_TBL(y) VALUES ('Y');
INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
-ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "$1"
INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7);
INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "insert_con"
INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
SELECT '' AS four, * FROM INSERT_TBL;
(4 rows)
INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4);
-ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "$1"
INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed');
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "insert_con"
INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed');
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
SELECT '' AS six, * FROM INSERT_TBL;
(1 row)
INSERT INTO INSERT_TBL(y) VALUES ('Y');
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "insert_con"
SELECT 'eight' AS one, currval('insert_seq');
one | currval
-------+---------
INHERITS (INSERT_TBL);
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11);
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6);
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_child_cy" on "insert_child"
+ERROR: new row for relation "insert_child" violates CHECK constraint "insert_child_cy"
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7);
-ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "insert_child"
+ERROR: new row for relation "insert_child" violates CHECK constraint "$1"
INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7);
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_child"
+ERROR: new row for relation "insert_child" violates CHECK constraint "insert_con"
SELECT * FROM INSERT_CHILD;
x | y | z | cx | cy
---+--------+----+----+----
INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again';
INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again';
INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again';
-ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "insert_con"
SELECT '' AS four, * FROM INSERT_TBL;
four | x | y | z
------+---+---------------+----
UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
UPDATE INSERT_TBL SET x = -z, z = -x;
UPDATE INSERT_TBL SET x = z, z = x;
-ERROR: ExecUpdate: rejected due to CHECK constraint "insert_con" on "insert_tbl"
+ERROR: new row for relation "insert_tbl" violates CHECK constraint "insert_con"
SELECT * FROM INSERT_TBL;
x | y | z
---+---------------+----
(2 rows)
COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data';
-ERROR: CopyFrom: rejected due to CHECK constraint "copy_con" on "copy_tbl"
+ERROR: new row for relation "copy_tbl" violates CHECK constraint "copy_con"
CONTEXT: COPY FROM, line 2
SELECT * FROM COPY_TBL;
x | y | z
INSERT INTO PRIMARY_TBL VALUES (4, 'three');
INSERT INTO PRIMARY_TBL VALUES (5, 'one');
INSERT INTO PRIMARY_TBL (t) VALUES ('six');
-ERROR: ExecInsert: Fail to add null value in not null attribute i
+ERROR: null value for attribute "i" violates NOT NULL constraint
SELECT '' AS four, * FROM PRIMARY_TBL;
four | i | t
------+---+-------
INSERT INTO PRIMARY_TBL VALUES (4, 'three');
INSERT INTO PRIMARY_TBL VALUES (5, 'one');
INSERT INTO PRIMARY_TBL (t) VALUES ('six');
-ERROR: ExecInsert: Fail to add null value in not null attribute i
+ERROR: null value for attribute "i" violates NOT NULL constraint
SELECT '' AS three, * FROM PRIMARY_TBL;
three | i | t
-------+---+-------