mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Error message editing in backend/executor.
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1581,7 +1581,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
|
|||||||
* Check the constraints of the tuple
|
* Check the constraints of the tuple
|
||||||
*/
|
*/
|
||||||
if (rel->rd_att->constr)
|
if (rel->rd_att->constr)
|
||||||
ExecConstraints("CopyFrom", resultRelInfo, slot, estate);
|
ExecConstraints(resultRelInfo, slot, estate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OK, store the tuple and create index entries for it
|
* OK, store the tuple and create index entries for it
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -160,9 +160,8 @@ ExecReScan(PlanState *node, ExprContext *exprCtxt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecReScan: node type %d not supported",
|
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
|
||||||
nodeTag(node));
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->chgParam != NULL)
|
if (node->chgParam != NULL)
|
||||||
@ -208,8 +207,7 @@ ExecMarkPos(PlanState *node)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
/* don't make hard error unless caller asks to restore... */
|
/* don't make hard error unless caller asks to restore... */
|
||||||
elog(DEBUG2, "ExecMarkPos: node type %d not supported",
|
elog(DEBUG2, "unrecognized node type: %d", (int) nodeTag(node));
|
||||||
nodeTag(node));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,8 +247,7 @@ ExecRestrPos(PlanState *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecRestrPos: node type %d not supported",
|
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
|
||||||
nodeTag(node));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -249,8 +249,8 @@ execTuplesHashPrepare(TupleDesc tupdesc,
|
|||||||
eq_function = oprfuncid(optup);
|
eq_function = oprfuncid(optup);
|
||||||
ReleaseSysCache(optup);
|
ReleaseSysCache(optup);
|
||||||
hash_function = get_op_hash_function(eq_opr);
|
hash_function = get_op_hash_function(eq_opr);
|
||||||
if (!OidIsValid(hash_function))
|
if (!OidIsValid(hash_function)) /* should not happen */
|
||||||
elog(ERROR, "Could not find hash function for hash operator %u",
|
elog(ERROR, "could not find hash function for hash operator %u",
|
||||||
eq_opr);
|
eq_opr);
|
||||||
fmgr_info(eq_function, &(*eqfunctions)[i]);
|
fmgr_info(eq_function, &(*eqfunctions)[i]);
|
||||||
fmgr_info(hash_function, &(*hashfunctions)[i]);
|
fmgr_info(hash_function, &(*hashfunctions)[i]);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -410,8 +410,8 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
|
|||||||
aclcheck_result = CHECK(ACL_DELETE);
|
aclcheck_result = CHECK(ACL_DELETE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecCheckRTEPerms: bogus operation %d",
|
elog(ERROR, "unrecognized operation code: %d",
|
||||||
operation);
|
(int) operation);
|
||||||
aclcheck_result = ACLCHECK_OK; /* keep compiler quiet */
|
aclcheck_result = ACLCHECK_OK; /* keep compiler quiet */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -455,7 +455,9 @@ ExecCheckXactReadOnly(Query *parsetree, CmdType operation)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
elog(ERROR, "transaction is read-only");
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
|
||||||
|
errmsg("transaction is read-only")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -833,16 +835,22 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
|
|||||||
switch (resultRelationDesc->rd_rel->relkind)
|
switch (resultRelationDesc->rd_rel->relkind)
|
||||||
{
|
{
|
||||||
case RELKIND_SEQUENCE:
|
case RELKIND_SEQUENCE:
|
||||||
elog(ERROR, "You can't change sequence relation %s",
|
ereport(ERROR,
|
||||||
RelationGetRelationName(resultRelationDesc));
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
|
errmsg("cannot change sequence relation \"%s\"",
|
||||||
|
RelationGetRelationName(resultRelationDesc))));
|
||||||
break;
|
break;
|
||||||
case RELKIND_TOASTVALUE:
|
case RELKIND_TOASTVALUE:
|
||||||
elog(ERROR, "You can't change toast relation %s",
|
ereport(ERROR,
|
||||||
RelationGetRelationName(resultRelationDesc));
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
|
errmsg("cannot change toast relation \"%s\"",
|
||||||
|
RelationGetRelationName(resultRelationDesc))));
|
||||||
break;
|
break;
|
||||||
case RELKIND_VIEW:
|
case RELKIND_VIEW:
|
||||||
elog(ERROR, "You can't change view relation %s",
|
ereport(ERROR,
|
||||||
RelationGetRelationName(resultRelationDesc));
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
|
errmsg("cannot change view relation \"%s\"",
|
||||||
|
RelationGetRelationName(resultRelationDesc))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1056,11 +1064,11 @@ lnext: ;
|
|||||||
"ctid",
|
"ctid",
|
||||||
&datum,
|
&datum,
|
||||||
&isNull))
|
&isNull))
|
||||||
elog(ERROR, "ExecutePlan: NO (junk) `ctid' was found!");
|
elog(ERROR, "could not find junk ctid column");
|
||||||
|
|
||||||
/* shouldn't ever get a null result... */
|
/* shouldn't ever get a null result... */
|
||||||
if (isNull)
|
if (isNull)
|
||||||
elog(ERROR, "ExecutePlan: (junk) `ctid' is NULL!");
|
elog(ERROR, "ctid is NULL");
|
||||||
|
|
||||||
tupleid = (ItemPointer) DatumGetPointer(datum);
|
tupleid = (ItemPointer) DatumGetPointer(datum);
|
||||||
tuple_ctid = *tupleid; /* make sure we don't free the
|
tuple_ctid = *tupleid; /* make sure we don't free the
|
||||||
@ -1085,13 +1093,12 @@ lnext: ;
|
|||||||
erm->resname,
|
erm->resname,
|
||||||
&datum,
|
&datum,
|
||||||
&isNull))
|
&isNull))
|
||||||
elog(ERROR, "ExecutePlan: NO (junk) `%s' was found!",
|
elog(ERROR, "could not find junk \"%s\" column",
|
||||||
erm->resname);
|
erm->resname);
|
||||||
|
|
||||||
/* shouldn't ever get a null result... */
|
/* shouldn't ever get a null result... */
|
||||||
if (isNull)
|
if (isNull)
|
||||||
elog(ERROR, "ExecutePlan: (junk) `%s' is NULL!",
|
elog(ERROR, "\"%s\" is NULL", erm->resname);
|
||||||
erm->resname);
|
|
||||||
|
|
||||||
tuple.t_self = *((ItemPointer) DatumGetPointer(datum));
|
tuple.t_self = *((ItemPointer) DatumGetPointer(datum));
|
||||||
test = heap_mark4update(erm->relation, &tuple, &buffer,
|
test = heap_mark4update(erm->relation, &tuple, &buffer,
|
||||||
@ -1108,7 +1115,9 @@ lnext: ;
|
|||||||
|
|
||||||
case HeapTupleUpdated:
|
case HeapTupleUpdated:
|
||||||
if (XactIsoLevel == XACT_SERIALIZABLE)
|
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),
|
if (!(ItemPointerEquals(&(tuple.t_self),
|
||||||
(ItemPointer) DatumGetPointer(datum))))
|
(ItemPointer) DatumGetPointer(datum))))
|
||||||
{
|
{
|
||||||
@ -1129,7 +1138,8 @@ lnext: ;
|
|||||||
goto lnext;
|
goto lnext;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "Unknown status %u from heap_mark4update", test);
|
elog(ERROR, "unrecognized heap_mark4update status: %u",
|
||||||
|
test);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1178,7 +1188,8 @@ lnext: ;
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(LOG, "ExecutePlan: unknown operation in queryDesc");
|
elog(ERROR, "unrecognized operation code: %d",
|
||||||
|
(int) operation);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1321,7 +1332,7 @@ ExecInsert(TupleTableSlot *slot,
|
|||||||
* Check the constraints of the tuple
|
* Check the constraints of the tuple
|
||||||
*/
|
*/
|
||||||
if (resultRelationDesc->rd_att->constr)
|
if (resultRelationDesc->rd_att->constr)
|
||||||
ExecConstraints("ExecInsert", resultRelInfo, slot, estate);
|
ExecConstraints(resultRelInfo, slot, estate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* insert the tuple
|
* insert the tuple
|
||||||
@ -1403,7 +1414,9 @@ ldelete:;
|
|||||||
|
|
||||||
case HeapTupleUpdated:
|
case HeapTupleUpdated:
|
||||||
if (XactIsoLevel == XACT_SERIALIZABLE)
|
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)))
|
else if (!(ItemPointerEquals(tupleid, &ctid)))
|
||||||
{
|
{
|
||||||
TupleTableSlot *epqslot = EvalPlanQual(estate,
|
TupleTableSlot *epqslot = EvalPlanQual(estate,
|
||||||
@ -1419,7 +1432,7 @@ ldelete:;
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "Unknown status %u from heap_delete", result);
|
elog(ERROR, "unrecognized heap_delete status: %u", result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1466,10 +1479,7 @@ ExecUpdate(TupleTableSlot *slot,
|
|||||||
* abort the operation if not running transactions
|
* abort the operation if not running transactions
|
||||||
*/
|
*/
|
||||||
if (IsBootstrapProcessingMode())
|
if (IsBootstrapProcessingMode())
|
||||||
{
|
elog(ERROR, "cannot UPDATE during bootstrap");
|
||||||
elog(WARNING, "ExecUpdate: UPDATE can't run without transactions");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get the heap tuple out of the tuple table slot
|
* get the heap tuple out of the tuple table slot
|
||||||
@ -1519,7 +1529,7 @@ ExecUpdate(TupleTableSlot *slot,
|
|||||||
*/
|
*/
|
||||||
lreplace:;
|
lreplace:;
|
||||||
if (resultRelationDesc->rd_att->constr)
|
if (resultRelationDesc->rd_att->constr)
|
||||||
ExecConstraints("ExecUpdate", resultRelInfo, slot, estate);
|
ExecConstraints(resultRelInfo, slot, estate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* replace the heap tuple
|
* replace the heap tuple
|
||||||
@ -1538,7 +1548,9 @@ lreplace:;
|
|||||||
|
|
||||||
case HeapTupleUpdated:
|
case HeapTupleUpdated:
|
||||||
if (XactIsoLevel == XACT_SERIALIZABLE)
|
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)))
|
else if (!(ItemPointerEquals(tupleid, &ctid)))
|
||||||
{
|
{
|
||||||
TupleTableSlot *epqslot = EvalPlanQual(estate,
|
TupleTableSlot *epqslot = EvalPlanQual(estate,
|
||||||
@ -1558,7 +1570,7 @@ lreplace:;
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "Unknown status %u from heap_update", result);
|
elog(ERROR, "unrecognized heap_update status: %u", result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1591,7 +1603,7 @@ lreplace:;
|
|||||||
ExecARUpdateTriggers(estate, resultRelInfo, tupleid, tuple);
|
ExecARUpdateTriggers(estate, resultRelInfo, tupleid, tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
ExecRelCheck(ResultRelInfo *resultRelInfo,
|
ExecRelCheck(ResultRelInfo *resultRelInfo,
|
||||||
TupleTableSlot *slot, EState *estate)
|
TupleTableSlot *slot, EState *estate)
|
||||||
{
|
{
|
||||||
@ -1646,11 +1658,11 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* NULL result means no error */
|
/* NULL result means no error */
|
||||||
return (char *) NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
|
ExecConstraints(ResultRelInfo *resultRelInfo,
|
||||||
TupleTableSlot *slot, EState *estate)
|
TupleTableSlot *slot, EState *estate)
|
||||||
{
|
{
|
||||||
Relation rel = resultRelInfo->ri_RelationDesc;
|
Relation rel = resultRelInfo->ri_RelationDesc;
|
||||||
@ -1668,18 +1680,22 @@ ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
|
|||||||
{
|
{
|
||||||
if (rel->rd_att->attrs[attrChk - 1]->attnotnull &&
|
if (rel->rd_att->attrs[attrChk - 1]->attnotnull &&
|
||||||
heap_attisnull(tuple, attrChk))
|
heap_attisnull(tuple, attrChk))
|
||||||
elog(ERROR, "%s: Fail to add null value in not null attribute %s",
|
ereport(ERROR,
|
||||||
caller, NameStr(rel->rd_att->attrs[attrChk - 1]->attname));
|
(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)
|
if (constr->num_check > 0)
|
||||||
{
|
{
|
||||||
char *failed;
|
const char *failed;
|
||||||
|
|
||||||
if ((failed = ExecRelCheck(resultRelInfo, slot, estate)) != NULL)
|
if ((failed = ExecRelCheck(resultRelInfo, slot, estate)) != NULL)
|
||||||
elog(ERROR, "%s: rejected due to CHECK constraint \"%s\" on \"%s\"",
|
ereport(ERROR,
|
||||||
caller, failed, RelationGetRelationName(rel));
|
(errcode(ERRCODE_CHECK_VIOLATION),
|
||||||
|
errmsg("new row for relation \"%s\" violates CHECK constraint \"%s\"",
|
||||||
|
RelationGetRelationName(rel), failed)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1721,7 +1737,7 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (relation == NULL)
|
if (relation == NULL)
|
||||||
elog(ERROR, "EvalPlanQual: can't find RTE %d", (int) rti);
|
elog(ERROR, "cannot find RowMark for RT index %u", rti);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1738,8 +1754,9 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
|||||||
{
|
{
|
||||||
TransactionId xwait = SnapshotDirty->xmax;
|
TransactionId xwait = SnapshotDirty->xmax;
|
||||||
|
|
||||||
|
/* xmin should not be dirty... */
|
||||||
if (TransactionIdIsValid(SnapshotDirty->xmin))
|
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
|
* If tuple is being updated by other transaction then we have
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -214,8 +214,7 @@ ExecInitNode(Plan *node, EState *estate)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecInitNode: node type %d unsupported",
|
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
|
||||||
(int) nodeTag(node));
|
|
||||||
result = NULL; /* keep compiler quiet */
|
result = NULL; /* keep compiler quiet */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -374,8 +373,7 @@ ExecProcNode(PlanState *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecProcNode: node type %d unsupported",
|
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
|
||||||
(int) nodeTag(node));
|
|
||||||
result = NULL;
|
result = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -467,8 +465,7 @@ ExecCountSlotsNode(Plan *node)
|
|||||||
return ExecCountSlotsLimit((Limit *) node);
|
return ExecCountSlotsLimit((Limit *) node);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecCountSlotsNode: node type %d unsupported",
|
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
|
||||||
(int) nodeTag(node));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,8 +593,7 @@ ExecEndNode(PlanState *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecEndNode: node type %d unsupported",
|
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
|
||||||
(int) nodeTag(node));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -175,8 +175,10 @@ ExecEvalArrayRef(ArrayRefExprState *astate,
|
|||||||
foreach(elt, astate->refupperindexpr)
|
foreach(elt, astate->refupperindexpr)
|
||||||
{
|
{
|
||||||
if (i >= MAXDIM)
|
if (i >= MAXDIM)
|
||||||
elog(ERROR, "ExecEvalArrayRef: can only handle %d dimensions",
|
ereport(ERROR,
|
||||||
MAXDIM);
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||||
|
errmsg("number of array dimensions exceeds the maximum allowed, %d",
|
||||||
|
MAXDIM)));
|
||||||
|
|
||||||
upper.indx[i++] = DatumGetInt32(ExecEvalExpr((ExprState *) lfirst(elt),
|
upper.indx[i++] = DatumGetInt32(ExecEvalExpr((ExprState *) lfirst(elt),
|
||||||
econtext,
|
econtext,
|
||||||
@ -197,8 +199,10 @@ ExecEvalArrayRef(ArrayRefExprState *astate,
|
|||||||
foreach(elt, astate->reflowerindexpr)
|
foreach(elt, astate->reflowerindexpr)
|
||||||
{
|
{
|
||||||
if (j >= MAXDIM)
|
if (j >= MAXDIM)
|
||||||
elog(ERROR, "ExecEvalArrayRef: can only handle %d dimensions",
|
ereport(ERROR,
|
||||||
MAXDIM);
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||||
|
errmsg("number of array dimensions exceeds the maximum allowed, %d",
|
||||||
|
MAXDIM)));
|
||||||
|
|
||||||
lower.indx[j++] = DatumGetInt32(ExecEvalExpr((ExprState *) lfirst(elt),
|
lower.indx[j++] = DatumGetInt32(ExecEvalExpr((ExprState *) lfirst(elt),
|
||||||
econtext,
|
econtext,
|
||||||
@ -217,9 +221,9 @@ ExecEvalArrayRef(ArrayRefExprState *astate,
|
|||||||
return PointerGetDatum(array_source);
|
return PointerGetDatum(array_source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* this can't happen unless parser messed up */
|
||||||
if (i != j)
|
if (i != j)
|
||||||
elog(ERROR,
|
elog(ERROR, "upper and lower index lists are not same length");
|
||||||
"ExecEvalArrayRef: upper and lower indices mismatch");
|
|
||||||
lIndex = lower.indx;
|
lIndex = lower.indx;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -300,7 +304,7 @@ static Datum
|
|||||||
ExecEvalAggref(AggrefExprState *aggref, ExprContext *econtext, bool *isNull)
|
ExecEvalAggref(AggrefExprState *aggref, ExprContext *econtext, bool *isNull)
|
||||||
{
|
{
|
||||||
if (econtext->ecxt_aggvalues == NULL) /* safety check */
|
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];
|
*isNull = econtext->ecxt_aggnulls[aggref->aggno];
|
||||||
return econtext->ecxt_aggvalues[aggref->aggno];
|
return econtext->ecxt_aggvalues[aggref->aggno];
|
||||||
@ -478,7 +482,7 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
|
|||||||
matchFound = true;
|
matchFound = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecEvalParam: invalid paramkind %d",
|
elog(ERROR, "unrecognized paramkind: %d",
|
||||||
thisParamKind);
|
thisParamKind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,11 +494,15 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
|
|||||||
if (!matchFound)
|
if (!matchFound)
|
||||||
{
|
{
|
||||||
if (thisParamKind == PARAM_NAMED)
|
if (thisParamKind == PARAM_NAMED)
|
||||||
elog(ERROR, "ExecEvalParam: Unknown value for parameter %s",
|
ereport(ERROR,
|
||||||
thisParamName);
|
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||||
|
errmsg("no value found for parameter \"%s\"",
|
||||||
|
thisParamName)));
|
||||||
else
|
else
|
||||||
elog(ERROR, "ExecEvalParam: Unknown value for parameter %d",
|
ereport(ERROR,
|
||||||
thisParamId);
|
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||||
|
errmsg("no value found for parameter %d",
|
||||||
|
thisParamId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
*isNull = paramList->isnull;
|
*isNull = paramList->isnull;
|
||||||
@ -525,13 +533,10 @@ GetAttributeByNum(TupleTableSlot *slot,
|
|||||||
Datum retval;
|
Datum retval;
|
||||||
|
|
||||||
if (!AttributeNumberIsValid(attrno))
|
if (!AttributeNumberIsValid(attrno))
|
||||||
elog(ERROR, "GetAttributeByNum: Invalid attribute number");
|
elog(ERROR, "invalid attribute number: %d", attrno);
|
||||||
|
|
||||||
if (!AttrNumberIsForUserDefinedAttr(attrno))
|
|
||||||
elog(ERROR, "GetAttributeByNum: cannot access system attributes here");
|
|
||||||
|
|
||||||
if (isNull == (bool *) NULL)
|
if (isNull == (bool *) NULL)
|
||||||
elog(ERROR, "GetAttributeByNum: a NULL isNull flag was passed");
|
elog(ERROR, "a NULL isNull pointer was passed");
|
||||||
|
|
||||||
if (TupIsNull(slot))
|
if (TupIsNull(slot))
|
||||||
{
|
{
|
||||||
@ -559,10 +564,10 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (attname == NULL)
|
if (attname == NULL)
|
||||||
elog(ERROR, "GetAttributeByName: Invalid attribute name");
|
elog(ERROR, "invalid attribute name");
|
||||||
|
|
||||||
if (isNull == (bool *) NULL)
|
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 (TupIsNull(slot))
|
||||||
{
|
{
|
||||||
@ -584,7 +589,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attrno == InvalidAttrNumber)
|
if (attrno == InvalidAttrNumber)
|
||||||
elog(ERROR, "GetAttributeByName: attribute %s not found", attname);
|
elog(ERROR, "attribute \"%s\" does not exist", attname);
|
||||||
|
|
||||||
retval = heap_getattr(slot->val,
|
retval = heap_getattr(slot->val,
|
||||||
attrno,
|
attrno,
|
||||||
@ -611,7 +616,7 @@ init_fcache(Oid foid, FuncExprState *fcache, MemoryContext fcacheCxt)
|
|||||||
|
|
||||||
/* Safety check (should never fail, as parser should check sooner) */
|
/* Safety check (should never fail, as parser should check sooner) */
|
||||||
if (length(fcache->args) > FUNC_MAX_ARGS)
|
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 */
|
/* Set up the primary fmgr lookup information */
|
||||||
fmgr_info_cxt(foid, &(fcache->func), fcacheCxt);
|
fmgr_info_cxt(foid, &(fcache->func), fcacheCxt);
|
||||||
@ -654,7 +659,9 @@ ExecEvalFuncArgs(FunctionCallInfo fcinfo,
|
|||||||
* it.
|
* it.
|
||||||
*/
|
*/
|
||||||
if (argIsDone != ExprSingleResult)
|
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;
|
argIsDone = thisArgIsDone;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@ -704,7 +711,9 @@ ExecMakeFunctionResult(FuncExprState *fcache,
|
|||||||
if (isDone)
|
if (isDone)
|
||||||
*isDone = ExprEndResult;
|
*isDone = ExprEndResult;
|
||||||
else
|
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;
|
return (Datum) 0;
|
||||||
}
|
}
|
||||||
hasSetArg = (argDone != ExprSingleResult);
|
hasSetArg = (argDone != ExprSingleResult);
|
||||||
@ -746,7 +755,9 @@ ExecMakeFunctionResult(FuncExprState *fcache,
|
|||||||
* to accept one.
|
* to accept one.
|
||||||
*/
|
*/
|
||||||
if (isDone == NULL)
|
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
|
* This loop handles the situation where we have both a set
|
||||||
@ -931,7 +942,9 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
|
|||||||
argDone = ExecEvalFuncArgs(&fcinfo, fcache->args, econtext);
|
argDone = ExecEvalFuncArgs(&fcinfo, fcache->args, econtext);
|
||||||
/* We don't allow sets in the arguments of the table function */
|
/* We don't allow sets in the arguments of the table function */
|
||||||
if (argDone != ExprSingleResult)
|
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
|
* If function is strict, and there are any NULL arguments, skip
|
||||||
@ -1038,11 +1051,15 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
|
|||||||
* TupleTableSlot; use its descriptor
|
* TupleTableSlot; use its descriptor
|
||||||
*/
|
*/
|
||||||
slot = (TupleTableSlot *) DatumGetPointer(result);
|
slot = (TupleTableSlot *) DatumGetPointer(result);
|
||||||
if (fcinfo.isnull ||
|
if (fcinfo.isnull || !slot)
|
||||||
!slot ||
|
ereport(ERROR,
|
||||||
!IsA(slot, TupleTableSlot) ||
|
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
|
||||||
|
errmsg("function returning tuple cannot return NULL")));
|
||||||
|
if (!IsA(slot, TupleTableSlot) ||
|
||||||
!slot->ttc_tupleDescriptor)
|
!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);
|
tupdesc = CreateTupleDescCopy(slot->ttc_tupleDescriptor);
|
||||||
returnsTuple = true;
|
returnsTuple = true;
|
||||||
}
|
}
|
||||||
@ -1076,7 +1093,9 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
|
|||||||
!slot ||
|
!slot ||
|
||||||
!IsA(slot, TupleTableSlot) ||
|
!IsA(slot, TupleTableSlot) ||
|
||||||
TupIsNull(slot))
|
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;
|
tuple = slot->val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1101,13 +1120,17 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
|
|||||||
{
|
{
|
||||||
/* check we're on the same page as the function author */
|
/* check we're on the same page as the function author */
|
||||||
if (!first_time || rsinfo.isDone != ExprSingleResult)
|
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 */
|
/* Done evaluating the set result */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
elog(ERROR, "ExecMakeTableFunctionResult: unknown returnMode %d",
|
ereport(ERROR,
|
||||||
(int) rsinfo.returnMode);
|
(errcode(ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED),
|
||||||
|
errmsg("unrecognized table-function returnMode: %d",
|
||||||
|
(int) rsinfo.returnMode)));
|
||||||
|
|
||||||
first_time = false;
|
first_time = false;
|
||||||
}
|
}
|
||||||
@ -1217,7 +1240,9 @@ ExecEvalDistinct(FuncExprState *fcache,
|
|||||||
fcinfo.flinfo = &(fcache->func);
|
fcinfo.flinfo = &(fcache->func);
|
||||||
argDone = ExecEvalFuncArgs(&fcinfo, argList, econtext);
|
argDone = ExecEvalFuncArgs(&fcinfo, argList, econtext);
|
||||||
if (argDone != ExprSingleResult)
|
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);
|
Assert(fcinfo.nargs == 2);
|
||||||
|
|
||||||
if (fcinfo.argnull[0] && fcinfo.argnull[1])
|
if (fcinfo.argnull[0] && fcinfo.argnull[1])
|
||||||
@ -1283,7 +1308,9 @@ ExecEvalScalarArrayOp(ScalarArrayOpExprState *sstate,
|
|||||||
fcinfo.flinfo = &(sstate->fxprstate.func);
|
fcinfo.flinfo = &(sstate->fxprstate.func);
|
||||||
argDone = ExecEvalFuncArgs(&fcinfo, sstate->fxprstate.args, econtext);
|
argDone = ExecEvalFuncArgs(&fcinfo, sstate->fxprstate.args, econtext);
|
||||||
if (argDone != ExprSingleResult)
|
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);
|
Assert(fcinfo.nargs == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1615,7 +1642,9 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
|
|||||||
|
|
||||||
dvalues[i++] = ExecEvalExpr(e, econtext, &eisnull, NULL);
|
dvalues[i++] = ExecEvalExpr(e, econtext, &eisnull, NULL);
|
||||||
if (eisnull)
|
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 */
|
/* setup for 1-D array of the given length */
|
||||||
@ -1641,7 +1670,10 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ndims <= 0 || ndims > MAXDIM)
|
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 */
|
/* loop through and get data area from each element */
|
||||||
foreach(element, astate->elements)
|
foreach(element, astate->elements)
|
||||||
@ -1654,7 +1686,9 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
|
|||||||
|
|
||||||
arraydatum = ExecEvalExpr(e, econtext, &eisnull, NULL);
|
arraydatum = ExecEvalExpr(e, econtext, &eisnull, NULL);
|
||||||
if (eisnull)
|
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);
|
array = DatumGetArrayTypeP(arraydatum);
|
||||||
|
|
||||||
@ -1671,19 +1705,15 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check other sub-arrays are compatible */
|
/* Check other sub-arrays are compatible */
|
||||||
if (elem_ndims != ARR_NDIM(array))
|
if (elem_ndims != ARR_NDIM(array) ||
|
||||||
elog(ERROR, "Multidimensional arrays must have array "
|
memcmp(elem_dims, ARR_DIMS(array),
|
||||||
"expressions with matching number of dimensions");
|
elem_ndims * sizeof(int)) != 0 ||
|
||||||
|
memcmp(elem_lbs, ARR_LBOUND(array),
|
||||||
if (memcmp(elem_dims, ARR_DIMS(array),
|
|
||||||
elem_ndims * sizeof(int)) != 0)
|
elem_ndims * sizeof(int)) != 0)
|
||||||
elog(ERROR, "Multidimensional arrays must have array "
|
ereport(ERROR,
|
||||||
"expressions with matching dimensions");
|
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
|
||||||
|
errmsg("multidimensional arrays must have array "
|
||||||
if (memcmp(elem_lbs, ARR_LBOUND(array),
|
"expressions with matching dimensions")));
|
||||||
elem_ndims * sizeof(int)) != 0)
|
|
||||||
elog(ERROR, "Multidimensional arrays must have array "
|
|
||||||
"expressions with matching dimensions");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elem_ndatabytes = ARR_SIZE(array) - ARR_OVERHEAD(elem_ndims);
|
elem_ndatabytes = ARR_SIZE(array) - ARR_OVERHEAD(elem_ndims);
|
||||||
@ -1790,7 +1820,9 @@ ExecEvalNullIf(FuncExprState *fcache, ExprContext *econtext,
|
|||||||
fcinfo.flinfo = &(fcache->func);
|
fcinfo.flinfo = &(fcache->func);
|
||||||
argDone = ExecEvalFuncArgs(&fcinfo, argList, econtext);
|
argDone = ExecEvalFuncArgs(&fcinfo, argList, econtext);
|
||||||
if (argDone != ExprSingleResult)
|
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);
|
Assert(fcinfo.nargs == 2);
|
||||||
|
|
||||||
/* if either argument is NULL they can't be equal */
|
/* if either argument is NULL they can't be equal */
|
||||||
@ -1850,7 +1882,7 @@ ExecEvalNullTest(GenericExprState *nstate,
|
|||||||
else
|
else
|
||||||
return BoolGetDatum(true);
|
return BoolGetDatum(true);
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecEvalNullTest: unexpected nulltesttype %d",
|
elog(ERROR, "unrecognized nulltesttype: %d",
|
||||||
(int) ntest->nulltesttype);
|
(int) ntest->nulltesttype);
|
||||||
return (Datum) 0; /* keep compiler quiet */
|
return (Datum) 0; /* keep compiler quiet */
|
||||||
}
|
}
|
||||||
@ -1935,7 +1967,7 @@ ExecEvalBooleanTest(GenericExprState *bstate,
|
|||||||
else
|
else
|
||||||
return BoolGetDatum(true);
|
return BoolGetDatum(true);
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecEvalBooleanTest: unexpected booltesttype %d",
|
elog(ERROR, "unrecognized booltesttype: %d",
|
||||||
(int) btest->booltesttype);
|
(int) btest->booltesttype);
|
||||||
return (Datum) 0; /* keep compiler quiet */
|
return (Datum) 0; /* keep compiler quiet */
|
||||||
}
|
}
|
||||||
@ -1969,8 +2001,10 @@ ExecEvalCoerceToDomain(CoerceToDomainState *cstate, ExprContext *econtext,
|
|||||||
{
|
{
|
||||||
case DOM_CONSTRAINT_NOTNULL:
|
case DOM_CONSTRAINT_NOTNULL:
|
||||||
if (*isNull)
|
if (*isNull)
|
||||||
elog(ERROR, "Domain %s does not allow NULL values",
|
ereport(ERROR,
|
||||||
format_type_be(ctest->resulttype));
|
(errcode(ERRCODE_NOT_NULL_VIOLATION),
|
||||||
|
errmsg("domain %s does not allow NULL values",
|
||||||
|
format_type_be(ctest->resulttype))));
|
||||||
break;
|
break;
|
||||||
case DOM_CONSTRAINT_CHECK:
|
case DOM_CONSTRAINT_CHECK:
|
||||||
{
|
{
|
||||||
@ -1996,16 +2030,19 @@ ExecEvalCoerceToDomain(CoerceToDomainState *cstate, ExprContext *econtext,
|
|||||||
|
|
||||||
if (!conIsNull &&
|
if (!conIsNull &&
|
||||||
!DatumGetBool(conResult))
|
!DatumGetBool(conResult))
|
||||||
elog(ERROR, "ExecEvalCoerceToDomain: Domain %s constraint %s failed",
|
ereport(ERROR,
|
||||||
format_type_be(ctest->resulttype), con->name);
|
(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_datum = save_datum;
|
||||||
econtext->domainValue_isNull = save_isNull;
|
econtext->domainValue_isNull = save_isNull;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecEvalCoerceToDomain: Constraint type unknown");
|
elog(ERROR, "unrecognized constraint type: %d",
|
||||||
|
(int) con->constrainttype);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2074,9 +2111,9 @@ ExecEvalFieldSelect(GenericExprState *fstate,
|
|||||||
* *isDone: set to indicator of set-result status
|
* *isDone: set to indicator of set-result status
|
||||||
*
|
*
|
||||||
* A caller that can only accept a singleton (non-set) result should pass
|
* 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()
|
* NULL for isDone; if the expression computes a set result then an error
|
||||||
* error will be reported. If the caller does pass an isDone pointer then
|
* will be reported via ereport. If the caller does pass an isDone pointer
|
||||||
* *isDone is set to one of these three states:
|
* then *isDone is set to one of these three states:
|
||||||
* ExprSingleResult singleton result (not a set)
|
* ExprSingleResult singleton result (not a set)
|
||||||
* ExprMultipleResult return value is one element of a set
|
* ExprMultipleResult return value is one element of a set
|
||||||
* ExprEndResult there are no more elements in the set
|
* ExprEndResult there are no more elements in the set
|
||||||
@ -2182,8 +2219,8 @@ ExecEvalExpr(ExprState *expression,
|
|||||||
retDatum = ExecEvalNot(state, econtext, isNull);
|
retDatum = ExecEvalNot(state, econtext, isNull);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecEvalExpr: unknown boolop %d",
|
elog(ERROR, "unrecognized boolop: %d",
|
||||||
((BoolExpr *) expr)->boolop);
|
(int) ((BoolExpr *) expr)->boolop);
|
||||||
retDatum = 0; /* keep compiler quiet */
|
retDatum = 0; /* keep compiler quiet */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2251,8 +2288,8 @@ ExecEvalExpr(ExprState *expression,
|
|||||||
isNull);
|
isNull);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecEvalExpr: unknown expression type %d",
|
elog(ERROR, "unrecognized node type: %d",
|
||||||
nodeTag(expression));
|
(int) nodeTag(expression));
|
||||||
retDatum = 0; /* keep compiler quiet */
|
retDatum = 0; /* keep compiler quiet */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2346,14 +2383,19 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
|||||||
/*
|
/*
|
||||||
* Complain if the aggregate's argument contains any
|
* Complain if the aggregate's argument contains any
|
||||||
* aggregates; nested agg functions are semantically
|
* 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.)
|
* but we defend against it here anyway.)
|
||||||
*/
|
*/
|
||||||
if (naggs != aggstate->numaggs)
|
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
|
else
|
||||||
elog(ERROR, "ExecInitExpr: Aggref not expected here");
|
{
|
||||||
|
/* planner messed up */
|
||||||
|
elog(ERROR, "aggref found in non-Agg plan node");
|
||||||
|
}
|
||||||
state = (ExprState *) astate;
|
state = (ExprState *) astate;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2440,7 +2482,7 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
|||||||
SubPlanState *sstate = makeNode(SubPlanState);
|
SubPlanState *sstate = makeNode(SubPlanState);
|
||||||
|
|
||||||
if (!parent)
|
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
|
* Here we just add the SubPlanState nodes to
|
||||||
@ -2611,8 +2653,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
|||||||
return (ExprState *) FastListValue(&outlist);
|
return (ExprState *) FastListValue(&outlist);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecInitExpr: unknown expression type %d",
|
elog(ERROR, "unrecognized node type: %d",
|
||||||
nodeTag(node));
|
(int) nodeTag(node));
|
||||||
state = NULL; /* keep compiler quiet */
|
state = NULL; /* keep compiler quiet */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2635,7 +2677,7 @@ ExecInitExprInitPlan(SubPlan *node, PlanState *parent)
|
|||||||
SubPlanState *sstate = makeNode(SubPlanState);
|
SubPlanState *sstate = makeNode(SubPlanState);
|
||||||
|
|
||||||
if (!parent)
|
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 */
|
/* The subplan's state will be initialized later */
|
||||||
sstate->sub_estate = NULL;
|
sstate->sub_estate = NULL;
|
||||||
@ -2886,7 +2928,9 @@ ExecTargetList(List *targetlist,
|
|||||||
{
|
{
|
||||||
/* We have a set-valued expression in the tlist */
|
/* We have a set-valued expression in the tlist */
|
||||||
if (isDone == NULL)
|
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)
|
if (itemIsDone[resind] == ExprMultipleResult)
|
||||||
{
|
{
|
||||||
/* we have undone sets in the tlist, set flag */
|
/* we have undone sets in the tlist, set flag */
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -256,8 +256,7 @@ ExecAllocTableSlot(TupleTable table)
|
|||||||
* -mer 4 Aug 1992
|
* -mer 4 Aug 1992
|
||||||
*/
|
*/
|
||||||
if (table->next >= table->size)
|
if (table->next >= table->size)
|
||||||
elog(ERROR, "Plan requires more slots than are available"
|
elog(ERROR, "plan requires more slots than are available");
|
||||||
"\n\tsend mail to your local executor guru to fix this");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* at this point, space in the table is guaranteed so we reserve the
|
* at this point, space in the table is guaranteed so we reserve the
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -165,8 +165,7 @@ init_sql_fcache(FmgrInfo *finfo)
|
|||||||
ObjectIdGetDatum(foid),
|
ObjectIdGetDatum(foid),
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
if (!HeapTupleIsValid(procedureTuple))
|
if (!HeapTupleIsValid(procedureTuple))
|
||||||
elog(ERROR, "init_sql_fcache: Cache lookup failed for procedure %u",
|
elog(ERROR, "cache lookup failed for function %u", foid);
|
||||||
foid);
|
|
||||||
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
|
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -178,9 +177,11 @@ init_sql_fcache(FmgrInfo *finfo)
|
|||||||
if (rettype == ANYARRAYOID || rettype == ANYELEMENTOID)
|
if (rettype == ANYARRAYOID || rettype == ANYELEMENTOID)
|
||||||
{
|
{
|
||||||
rettype = get_fn_expr_rettype(finfo);
|
rettype = get_fn_expr_rettype(finfo);
|
||||||
if (rettype == InvalidOid)
|
if (rettype == InvalidOid) /* this probably should not happen */
|
||||||
elog(ERROR, "could not determine actual result type for function declared %s",
|
ereport(ERROR,
|
||||||
format_type_be(procedureStruct->prorettype));
|
(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 */
|
/* Now look up the actual result type */
|
||||||
@ -188,8 +189,7 @@ init_sql_fcache(FmgrInfo *finfo)
|
|||||||
ObjectIdGetDatum(rettype),
|
ObjectIdGetDatum(rettype),
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
if (!HeapTupleIsValid(typeTuple))
|
if (!HeapTupleIsValid(typeTuple))
|
||||||
elog(ERROR, "init_sql_fcache: Cache lookup failed for type %u",
|
elog(ERROR, "cache lookup failed for type %u", rettype);
|
||||||
rettype);
|
|
||||||
typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
|
typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -249,8 +249,10 @@ init_sql_fcache(FmgrInfo *finfo)
|
|||||||
{
|
{
|
||||||
argtype = get_fn_expr_argtype(finfo, argnum);
|
argtype = get_fn_expr_argtype(finfo, argnum);
|
||||||
if (argtype == InvalidOid)
|
if (argtype == InvalidOid)
|
||||||
elog(ERROR, "could not determine actual type of argument declared %s",
|
ereport(ERROR,
|
||||||
format_type_be(argOidVect[argnum]));
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
|
errmsg("could not determine actual type of argument declared %s",
|
||||||
|
format_type_be(argOidVect[argnum]))));
|
||||||
argOidVect[argnum] = argtype;
|
argOidVect[argnum] = argtype;
|
||||||
haspolyarg = true;
|
haspolyarg = true;
|
||||||
}
|
}
|
||||||
@ -264,8 +266,7 @@ init_sql_fcache(FmgrInfo *finfo)
|
|||||||
Anum_pg_proc_prosrc,
|
Anum_pg_proc_prosrc,
|
||||||
&isNull);
|
&isNull);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
elog(ERROR, "init_sql_fcache: null prosrc for procedure %u",
|
elog(ERROR, "null prosrc for function %u", foid);
|
||||||
foid);
|
|
||||||
src = DatumGetCString(DirectFunctionCall1(textout, tmp));
|
src = DatumGetCString(DirectFunctionCall1(textout, tmp));
|
||||||
|
|
||||||
fcache->func_state = init_execution_state(src, argOidVect, nargs,
|
fcache->func_state = init_execution_state(src, argOidVect, nargs,
|
||||||
@ -563,7 +564,9 @@ fmgr_sql(PG_FUNCTION_ARGS)
|
|||||||
if (rsi && IsA(rsi, ReturnSetInfo))
|
if (rsi && IsA(rsi, ReturnSetInfo))
|
||||||
rsi->isDone = ExprEndResult;
|
rsi->isDone = ExprEndResult;
|
||||||
else
|
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;
|
fcinfo->isnull = true;
|
||||||
result = (Datum) 0;
|
result = (Datum) 0;
|
||||||
|
|
||||||
@ -598,7 +601,9 @@ fmgr_sql(PG_FUNCTION_ARGS)
|
|||||||
if (rsi && IsA(rsi, ReturnSetInfo))
|
if (rsi && IsA(rsi, ReturnSetInfo))
|
||||||
rsi->isDone = ExprMultipleResult;
|
rsi->isDone = ExprMultipleResult;
|
||||||
else
|
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
|
* Ensure we will get shut down cleanly if the exprcontext is not
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Copyright (c) 2001, PostgreSQL Global Development Group
|
* Copyright (c) 2001, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -37,7 +37,7 @@ InstrStartNode(Instrumentation *instr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (instr->starttime.tv_sec != 0 || instr->starttime.tv_usec != 0)
|
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
|
else
|
||||||
gettimeofday(&instr->starttime, NULL);
|
gettimeofday(&instr->starttime, NULL);
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ InstrStopNode(Instrumentation *instr, bool returnedTuple)
|
|||||||
|
|
||||||
if (instr->starttime.tv_sec == 0 && instr->starttime.tv_usec == 0)
|
if (instr->starttime.tv_sec == 0 && instr->starttime.tv_usec == 0)
|
||||||
{
|
{
|
||||||
elog(LOG, "InstrStopNode without start");
|
elog(DEBUG2, "InstrStopNode without start");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1233,7 +1233,7 @@ ExecInitAgg(Agg *node, EState *estate)
|
|||||||
ObjectIdGetDatum(aggref->aggfnoid),
|
ObjectIdGetDatum(aggref->aggfnoid),
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
if (!HeapTupleIsValid(aggTuple))
|
if (!HeapTupleIsValid(aggTuple))
|
||||||
elog(ERROR, "ExecAgg: cache lookup failed for aggregate %u",
|
elog(ERROR, "cache lookup failed for aggregate %u",
|
||||||
aggref->aggfnoid);
|
aggref->aggfnoid);
|
||||||
aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);
|
aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);
|
||||||
|
|
||||||
@ -1311,8 +1311,10 @@ ExecInitAgg(Agg *node, EState *estate)
|
|||||||
if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
|
if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
|
||||||
{
|
{
|
||||||
if (!IsBinaryCoercible(inputType, aggtranstype))
|
if (!IsBinaryCoercible(inputType, aggtranstype))
|
||||||
elog(ERROR, "Aggregate %u needs to have compatible input type and transition type",
|
ereport(ERROR,
|
||||||
aggref->aggfnoid);
|
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
|
||||||
|
errmsg("aggregate %u needs to have compatible input type and transition type",
|
||||||
|
aggref->aggfnoid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aggref->aggdistinct)
|
if (aggref->aggdistinct)
|
||||||
@ -1357,7 +1359,7 @@ GetAggInitVal(Datum textInitVal, Oid transtype)
|
|||||||
ObjectIdGetDatum(transtype),
|
ObjectIdGetDatum(transtype),
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
if (!HeapTupleIsValid(tup))
|
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;
|
typinput = ((Form_pg_type) GETSTRUCT(tup))->typinput;
|
||||||
typelem = ((Form_pg_type) GETSTRUCT(tup))->typelem;
|
typelem = ((Form_pg_type) GETSTRUCT(tup))->typelem;
|
||||||
@ -1494,7 +1496,7 @@ ExecReScanAgg(AggState *node, ExprContext *exprCtxt)
|
|||||||
Datum
|
Datum
|
||||||
aggregate_dummy(PG_FUNCTION_ARGS)
|
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);
|
fcinfo->flinfo->fn_oid);
|
||||||
return (Datum) 0; /* keep compiler quiet */
|
return (Datum) 0; /* keep compiler quiet */
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -88,7 +88,9 @@ FunctionNext(FunctionScanState *node)
|
|||||||
*/
|
*/
|
||||||
if (funcTupdesc &&
|
if (funcTupdesc &&
|
||||||
tupledesc_mismatch(node->tupdesc, 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")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -201,7 +203,7 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate)
|
|||||||
|
|
||||||
funcrelid = typeidTypeRelid(funcrettype);
|
funcrelid = typeidTypeRelid(funcrettype);
|
||||||
if (!OidIsValid(funcrelid))
|
if (!OidIsValid(funcrelid))
|
||||||
elog(ERROR, "Invalid typrelid for complex type %u",
|
elog(ERROR, "invalid typrelid for complex type %u",
|
||||||
funcrettype);
|
funcrettype);
|
||||||
rel = relation_open(funcrelid, AccessShareLock);
|
rel = relation_open(funcrelid, AccessShareLock);
|
||||||
tupdesc = CreateTupleDescCopy(RelationGetDescr(rel));
|
tupdesc = CreateTupleDescCopy(RelationGetDescr(rel));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -248,7 +248,7 @@ ExecHashTableCreate(Hash *node, List *hashOperators)
|
|||||||
|
|
||||||
hashfn = get_op_hash_function(lfirsto(ho));
|
hashfn = get_op_hash_function(lfirsto(ho));
|
||||||
if (!OidIsValid(hashfn))
|
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));
|
lfirsto(ho));
|
||||||
fmgr_info(hashfn, &hashtable->hashfunctions[i]);
|
fmgr_info(hashfn, &hashtable->hashfunctions[i]);
|
||||||
i++;
|
i++;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -368,7 +368,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
|
|||||||
ExecGetResultType(innerPlanState(hjstate)));
|
ExecGetResultType(innerPlanState(hjstate)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecInitHashJoin: unsupported join type %d",
|
elog(ERROR, "unrecognized join type: %d",
|
||||||
(int) node->join.jointype);
|
(int) node->join.jointype);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +553,9 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
|
|||||||
if (nread == 0)
|
if (nread == 0)
|
||||||
return NULL; /* end of file */
|
return NULL; /* end of file */
|
||||||
if (nread != sizeof(HeapTupleData))
|
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);
|
heapTuple = palloc(HEAPTUPLESIZE + htup.t_len);
|
||||||
memcpy((char *) heapTuple, (char *) &htup, sizeof(HeapTupleData));
|
memcpy((char *) heapTuple, (char *) &htup, sizeof(HeapTupleData));
|
||||||
heapTuple->t_datamcxt = CurrentMemoryContext;
|
heapTuple->t_datamcxt = CurrentMemoryContext;
|
||||||
@ -561,7 +563,9 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
|
|||||||
((char *) heapTuple + HEAPTUPLESIZE);
|
((char *) heapTuple + HEAPTUPLESIZE);
|
||||||
nread = BufFileRead(file, (void *) heapTuple->t_data, htup.t_len);
|
nread = BufFileRead(file, (void *) heapTuple->t_data, htup.t_len);
|
||||||
if (nread != (size_t) 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);
|
return ExecStoreTuple(heapTuple, tupleSlot, InvalidBuffer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,12 +621,16 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
|
|||||||
* start reading them.
|
* start reading them.
|
||||||
*/
|
*/
|
||||||
if (BufFileSeek(hashtable->outerBatchFile[newbatch - 1], 0, 0L, SEEK_SET))
|
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];
|
innerFile = hashtable->innerBatchFile[newbatch - 1];
|
||||||
|
|
||||||
if (BufFileSeek(innerFile, 0, 0L, SEEK_SET))
|
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
|
* Reload the hash table with the new inner batch
|
||||||
@ -671,10 +679,14 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple,
|
|||||||
|
|
||||||
written = BufFileWrite(file, (void *) heapTuple, sizeof(HeapTupleData));
|
written = BufFileWrite(file, (void *) heapTuple, sizeof(HeapTupleData));
|
||||||
if (written != 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);
|
written = BufFileWrite(file, (void *) heapTuple->t_data, heapTuple->t_len);
|
||||||
if (written != (size_t) 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
|
void
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -666,7 +666,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
|||||||
listscan = lnext(listscan);
|
listscan = lnext(listscan);
|
||||||
|
|
||||||
if (!IsA(clause, OpExpr))
|
if (!IsA(clause, OpExpr))
|
||||||
elog(ERROR, "ExecInitIndexScan: indxqual not an opclause!");
|
elog(ERROR, "indxqual is not an OpExpr");
|
||||||
|
|
||||||
opfuncid = clause->opfuncid;
|
opfuncid = clause->opfuncid;
|
||||||
|
|
||||||
@ -768,8 +768,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
|||||||
* scan-attribute...
|
* scan-attribute...
|
||||||
*/
|
*/
|
||||||
if (scanvar == LEFT_OP)
|
if (scanvar == LEFT_OP)
|
||||||
elog(ERROR, "ExecInitIndexScan: %s",
|
elog(ERROR, "both left and right operands are rel-vars");
|
||||||
"both left and right op's are rel-vars");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the rightop is a "rel-var", then it means that it is
|
* if the rightop is a "rel-var", then it means that it is
|
||||||
@ -805,8 +804,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
|||||||
* attribute...
|
* attribute...
|
||||||
*/
|
*/
|
||||||
if (scanvar == NO_OP)
|
if (scanvar == NO_OP)
|
||||||
elog(ERROR, "ExecInitIndexScan: %s",
|
elog(ERROR, "neither left nor right operand refer to scan relation");
|
||||||
"neither leftop nor rightop refer to scan relation");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize the scan key's fields appropriately
|
* initialize the scan key's fields appropriately
|
||||||
@ -878,7 +876,10 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
|||||||
currentRelation = heap_open(reloid, AccessShareLock);
|
currentRelation = heap_open(reloid, AccessShareLock);
|
||||||
|
|
||||||
if (!RelationGetForm(currentRelation)->relhasindex)
|
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_currentRelation = currentRelation;
|
||||||
indexstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
|
indexstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -149,7 +149,7 @@ ExecLimit(LimitState *node)
|
|||||||
*/
|
*/
|
||||||
slot = ExecProcNode(outerPlan);
|
slot = ExecProcNode(outerPlan);
|
||||||
if (TupIsNull(slot))
|
if (TupIsNull(slot))
|
||||||
elog(ERROR, "ExecLimit: subplan failed to run backwards");
|
elog(ERROR, "LIMIT subplan failed to run backwards");
|
||||||
node->subSlot = slot;
|
node->subSlot = slot;
|
||||||
node->position--;
|
node->position--;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ ExecLimit(LimitState *node)
|
|||||||
*/
|
*/
|
||||||
slot = ExecProcNode(outerPlan);
|
slot = ExecProcNode(outerPlan);
|
||||||
if (TupIsNull(slot))
|
if (TupIsNull(slot))
|
||||||
elog(ERROR, "ExecLimit: subplan failed to run backwards");
|
elog(ERROR, "LIMIT subplan failed to run backwards");
|
||||||
node->subSlot = slot;
|
node->subSlot = slot;
|
||||||
node->lstate = LIMIT_INWINDOW;
|
node->lstate = LIMIT_INWINDOW;
|
||||||
/* position does not change 'cause we didn't advance it before */
|
/* position does not change 'cause we didn't advance it before */
|
||||||
@ -195,7 +195,7 @@ ExecLimit(LimitState *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecLimit: impossible state %d",
|
elog(ERROR, "impossible LIMIT state: %d",
|
||||||
(int) node->lstate);
|
(int) node->lstate);
|
||||||
slot = NULL; /* keep compiler quiet */
|
slot = NULL; /* keep compiler quiet */
|
||||||
break;
|
break;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -129,7 +129,7 @@ MJFormSkipQuals(List *qualList, List **ltQuals, List **gtQuals,
|
|||||||
* The two ops should be identical, so use either one for lookup.
|
* The two ops should be identical, so use either one for lookup.
|
||||||
*/
|
*/
|
||||||
if (!IsA(ltop, OpExpr))
|
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
|
* Lookup the operators, and replace the data in the copied
|
||||||
@ -398,7 +398,7 @@ ExecMergeJoin(MergeJoinState *node)
|
|||||||
doFillInner = true;
|
doFillInner = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecMergeJoin: unsupported join type %d",
|
elog(ERROR, "unrecognized join type: %d",
|
||||||
(int) node->js.jointype);
|
(int) node->js.jointype);
|
||||||
doFillOuter = false; /* keep compiler quiet */
|
doFillOuter = false; /* keep compiler quiet */
|
||||||
doFillInner = false;
|
doFillInner = false;
|
||||||
@ -1384,13 +1384,11 @@ ExecMergeJoin(MergeJoinState *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if we get here it means our code is fouled up and so we
|
* broken state value?
|
||||||
* just end the join prematurely.
|
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
elog(WARNING, "ExecMergeJoin: invalid join state %d, aborting",
|
elog(ERROR, "unrecognized mergejoin state: %d",
|
||||||
node->mj_JoinState);
|
(int) node->mj_JoinState);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1473,10 +1471,12 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Can't handle right or full join with non-nil extra
|
* 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)
|
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;
|
break;
|
||||||
case JOIN_FULL:
|
case JOIN_FULL:
|
||||||
mergestate->mj_NullOuterTupleSlot =
|
mergestate->mj_NullOuterTupleSlot =
|
||||||
@ -1491,10 +1491,12 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
|
|||||||
* joinclauses.
|
* joinclauses.
|
||||||
*/
|
*/
|
||||||
if (node->join.joinqual != NIL)
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecInitMergeJoin: unsupported join type %d",
|
elog(ERROR, "unrecognized join type: %d",
|
||||||
(int) node->join.jointype);
|
(int) node->join.jointype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -333,7 +333,7 @@ ExecInitNestLoop(NestLoop *node, EState *estate)
|
|||||||
ExecGetResultType(innerPlanState(nlstate)));
|
ExecGetResultType(innerPlanState(nlstate)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecInitNestLoop: unsupported join type %d",
|
elog(ERROR, "unrecognized join type: %d",
|
||||||
(int) node->join.jointype);
|
(int) node->join.jointype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -170,7 +170,7 @@ ExecSetOp(SetOpState *node)
|
|||||||
0 : (node->numLeft - node->numRight);
|
0 : (node->numLeft - node->numRight);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "ExecSetOp: bogus command code %d",
|
elog(ERROR, "unrecognized setop code: %d",
|
||||||
(int) plannode->cmd);
|
(int) plannode->cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -52,7 +52,7 @@ ExecSubPlan(SubPlanState *node,
|
|||||||
SubPlan *subplan = (SubPlan *) node->xprstate.expr;
|
SubPlan *subplan = (SubPlan *) node->xprstate.expr;
|
||||||
|
|
||||||
if (subplan->setParam != NIL)
|
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)
|
if (subplan->useHashTable)
|
||||||
return ExecHashSubPlan(node, econtext, isNull);
|
return ExecHashSubPlan(node, econtext, isNull);
|
||||||
@ -76,7 +76,7 @@ ExecHashSubPlan(SubPlanState *node,
|
|||||||
|
|
||||||
/* Shouldn't have any direct correlation Vars */
|
/* Shouldn't have any direct correlation Vars */
|
||||||
if (subplan->parParam != NIL || node->args != NIL)
|
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
|
* If first time through or we need to rescan the subplan, build
|
||||||
@ -284,7 +284,9 @@ ExecScanSubPlan(SubPlanState *node,
|
|||||||
{
|
{
|
||||||
/* cannot allow multiple input tuples for EXPR sublink */
|
/* cannot allow multiple input tuples for EXPR sublink */
|
||||||
if (found)
|
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;
|
found = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -324,7 +326,9 @@ ExecScanSubPlan(SubPlanState *node,
|
|||||||
|
|
||||||
/* cannot allow multiple input tuples for MULTIEXPR sublink either */
|
/* cannot allow multiple input tuples for MULTIEXPR sublink either */
|
||||||
if (subLinkType == MULTIEXPR_SUBLINK && found)
|
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;
|
found = true;
|
||||||
|
|
||||||
@ -836,7 +840,7 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
|
|||||||
/* Lookup the associated hash function */
|
/* Lookup the associated hash function */
|
||||||
hashfn = get_op_hash_function(opexpr->opno);
|
hashfn = get_op_hash_function(opexpr->opno);
|
||||||
if (!OidIsValid(hashfn))
|
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);
|
opexpr->opno);
|
||||||
fmgr_info(hashfn, &node->hashfunctions[i-1]);
|
fmgr_info(hashfn, &node->hashfunctions[i-1]);
|
||||||
|
|
||||||
@ -908,7 +912,7 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
|
|||||||
|
|
||||||
if (subLinkType == ANY_SUBLINK ||
|
if (subLinkType == ANY_SUBLINK ||
|
||||||
subLinkType == ALL_SUBLINK)
|
subLinkType == ALL_SUBLINK)
|
||||||
elog(ERROR, "ExecSetParamPlan: ANY/ALL subselect unsupported");
|
elog(ERROR, "ANY/ALL subselect unsupported as initplan");
|
||||||
|
|
||||||
if (planstate->chgParam != NULL)
|
if (planstate->chgParam != NULL)
|
||||||
ExecReScan(planstate, NULL);
|
ExecReScan(planstate, NULL);
|
||||||
@ -952,7 +956,9 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
|
|||||||
if (found &&
|
if (found &&
|
||||||
(subLinkType == EXPR_SUBLINK ||
|
(subLinkType == EXPR_SUBLINK ||
|
||||||
subLinkType == MULTIEXPR_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;
|
found = true;
|
||||||
|
|
||||||
@ -1046,6 +1052,9 @@ ExecEndSubPlan(SubPlanState *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mark an initplan as needing recalculation
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
|
ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
|
||||||
{
|
{
|
||||||
@ -1054,12 +1063,13 @@ ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
|
|||||||
EState *estate = parent->state;
|
EState *estate = parent->state;
|
||||||
List *lst;
|
List *lst;
|
||||||
|
|
||||||
|
/* sanity checks */
|
||||||
if (subplan->parParam != NIL)
|
if (subplan->parParam != NIL)
|
||||||
elog(ERROR, "ExecReScanSetParamPlan: direct correlated subquery unsupported, yet");
|
elog(ERROR, "direct correlated subquery unsupported as initplan");
|
||||||
if (subplan->setParam == NIL)
|
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))
|
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.
|
* Don't actually re-scan: ExecSetParamPlan does it if needed.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -66,19 +66,21 @@ SPI_connect(void)
|
|||||||
if (_SPI_stack == NULL)
|
if (_SPI_stack == NULL)
|
||||||
{
|
{
|
||||||
if (_SPI_connected != -1)
|
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));
|
new_SPI_stack = (_SPI_connection *) malloc(sizeof(_SPI_connection));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_SPI_connected <= -1)
|
if (_SPI_connected < 0)
|
||||||
elog(FATAL, "SPI_connect: some connection(s) expected");
|
elog(ERROR, "SPI stack corrupted");
|
||||||
new_SPI_stack = (_SPI_connection *) realloc(_SPI_stack,
|
new_SPI_stack = (_SPI_connection *) realloc(_SPI_stack,
|
||||||
(_SPI_connected + 2) * sizeof(_SPI_connection));
|
(_SPI_connected + 2) * sizeof(_SPI_connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_SPI_stack == NULL)
|
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
|
* We' returning to procedure where _SPI_curid == _SPI_connected - 1
|
||||||
@ -158,7 +160,9 @@ SPI_finish(void)
|
|||||||
(_SPI_connected + 1) * sizeof(_SPI_connection));
|
(_SPI_connected + 1) * sizeof(_SPI_connection));
|
||||||
/* This could only fail with a pretty stupid malloc package ... */
|
/* This could only fail with a pretty stupid malloc package ... */
|
||||||
if (new_SPI_stack == NULL)
|
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_stack = new_SPI_stack;
|
||||||
_SPI_current = &(_SPI_stack[_SPI_connected]);
|
_SPI_current = &(_SPI_stack[_SPI_connected]);
|
||||||
}
|
}
|
||||||
@ -320,7 +324,7 @@ SPI_copytuple(HeapTuple tuple)
|
|||||||
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
||||||
{
|
{
|
||||||
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
||||||
elog(FATAL, "SPI: stack corrupted");
|
elog(ERROR, "SPI stack corrupted");
|
||||||
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +351,7 @@ SPI_copytupledesc(TupleDesc tupdesc)
|
|||||||
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
||||||
{
|
{
|
||||||
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
||||||
elog(FATAL, "SPI: stack corrupted");
|
elog(ERROR, "SPI stack corrupted");
|
||||||
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +380,7 @@ SPI_copytupleintoslot(HeapTuple tuple, TupleDesc tupdesc)
|
|||||||
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
||||||
{
|
{
|
||||||
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
||||||
elog(FATAL, "SPI: stack corrupted");
|
elog(ERROR, "SPI stack corrupted");
|
||||||
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +418,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
|
|||||||
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
||||||
{
|
{
|
||||||
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
||||||
elog(FATAL, "SPI: stack corrupted");
|
elog(ERROR, "SPI stack corrupted");
|
||||||
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
||||||
}
|
}
|
||||||
SPI_result = 0;
|
SPI_result = 0;
|
||||||
@ -654,7 +658,7 @@ SPI_palloc(Size size)
|
|||||||
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
||||||
{
|
{
|
||||||
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
||||||
elog(FATAL, "SPI: stack corrupted");
|
elog(ERROR, "SPI stack corrupted");
|
||||||
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,14 +720,20 @@ SPI_cursor_open(const char *name, void *plan, Datum *Values, const char *Nulls)
|
|||||||
|
|
||||||
/* Ensure that the plan contains only one regular SELECT query */
|
/* Ensure that the plan contains only one regular SELECT query */
|
||||||
if (length(ptlist) != 1 || length(qtlist) != 1)
|
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));
|
queryTree = (Query *) lfirst((List *) lfirst(qtlist));
|
||||||
planTree = (Plan *) lfirst(ptlist);
|
planTree = (Plan *) lfirst(ptlist);
|
||||||
|
|
||||||
if (queryTree->commandType != CMD_SELECT)
|
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)
|
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 */
|
/* Increment CommandCounter to see changes made by now */
|
||||||
CommandCounterIncrement();
|
CommandCounterIncrement();
|
||||||
@ -888,12 +898,12 @@ spi_dest_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
|
|||||||
* _SPI_connected
|
* _SPI_connected
|
||||||
*/
|
*/
|
||||||
if (_SPI_curid != _SPI_connected || _SPI_connected < 0)
|
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]))
|
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)
|
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 */
|
oldcxt = _SPI_procmem(); /* switch to procedure memory context */
|
||||||
|
|
||||||
@ -930,13 +940,13 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc, DestReceiver *self)
|
|||||||
* _SPI_connected
|
* _SPI_connected
|
||||||
*/
|
*/
|
||||||
if (_SPI_curid != _SPI_connected || _SPI_connected < 0)
|
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]))
|
if (_SPI_current != &(_SPI_stack[_SPI_curid]))
|
||||||
elog(FATAL, "SPI: stack corrupted in spi_printtup");
|
elog(ERROR, "SPI stack corrupted");
|
||||||
|
|
||||||
tuptable = _SPI_current->tuptable;
|
tuptable = _SPI_current->tuptable;
|
||||||
if (tuptable == NULL)
|
if (tuptable == NULL)
|
||||||
elog(FATAL, "SPI: improper call to spi_printtup");
|
elog(ERROR, "improper call to spi_printtup");
|
||||||
|
|
||||||
oldcxt = MemoryContextSwitchTo(tuptable->tuptabcxt);
|
oldcxt = MemoryContextSwitchTo(tuptable->tuptabcxt);
|
||||||
|
|
||||||
@ -1217,7 +1227,7 @@ _SPI_pquery(QueryDesc *queryDesc, bool runit, int tcount)
|
|||||||
if (operation == CMD_SELECT && queryDesc->dest->mydest == SPI)
|
if (operation == CMD_SELECT && queryDesc->dest->mydest == SPI)
|
||||||
{
|
{
|
||||||
if (_SPI_checktuples())
|
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)
|
if (queryDesc->dest->mydest == SPI)
|
||||||
@ -1274,7 +1284,7 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
|
|||||||
dest);
|
dest);
|
||||||
|
|
||||||
if (dest->mydest == SPI && _SPI_checktuples())
|
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 */
|
/* Put the result into place for access by caller */
|
||||||
SPI_processed = _SPI_current->processed;
|
SPI_processed = _SPI_current->processed;
|
||||||
@ -1308,7 +1318,7 @@ _SPI_begin_call(bool execmem)
|
|||||||
return SPI_ERROR_UNCONNECTED;
|
return SPI_ERROR_UNCONNECTED;
|
||||||
_SPI_curid++;
|
_SPI_curid++;
|
||||||
if (_SPI_current != &(_SPI_stack[_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 */
|
if (execmem) /* switch to the Executor memory context */
|
||||||
_SPI_execmem();
|
_SPI_execmem();
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -94,7 +94,7 @@ extern void ExecutorEnd(QueryDesc *queryDesc);
|
|||||||
extern void ExecutorRewind(QueryDesc *queryDesc);
|
extern void ExecutorRewind(QueryDesc *queryDesc);
|
||||||
extern void ExecCheckRTPerms(List *rangeTable, CmdType operation);
|
extern void ExecCheckRTPerms(List *rangeTable, CmdType operation);
|
||||||
extern void ExecEndPlan(PlanState *planstate, EState *estate);
|
extern void ExecEndPlan(PlanState *planstate, EState *estate);
|
||||||
extern void ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
|
extern void ExecConstraints(ResultRelInfo *resultRelInfo,
|
||||||
TupleTableSlot *slot, EState *estate);
|
TupleTableSlot *slot, EState *estate);
|
||||||
extern TupleTableSlot *EvalPlanQual(EState *estate, Index rti,
|
extern TupleTableSlot *EvalPlanQual(EState *estate, Index rti,
|
||||||
ItemPointer tid);
|
ItemPointer tid);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -124,6 +124,8 @@
|
|||||||
/* Class 22 - Data Exception */
|
/* Class 22 - Data Exception */
|
||||||
#define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2', '0','0','0')
|
#define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2', '0','0','0')
|
||||||
#define ERRCODE_ARRAY_ELEMENT_ERROR MAKE_SQLSTATE('2','2', '0','2','E')
|
#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_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_DATETIME_FIELD_OVERFLOW MAKE_SQLSTATE('2','2', '0','0','8')
|
||||||
#define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2', '0','1','2')
|
#define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2', '0','1','2')
|
||||||
@ -215,6 +217,7 @@
|
|||||||
#define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED MAKE_SQLSTATE('3','9', '0','0','1')
|
#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_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_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 */
|
/* Class 3D - Invalid Catalog Name */
|
||||||
#define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D', '0','0','0')
|
#define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D', '0','0','0')
|
||||||
|
@ -399,7 +399,7 @@ create table atacc1 ( test int );
|
|||||||
alter table atacc1 add constraint atacc_test1 check (test>3);
|
alter table atacc1 add constraint atacc_test1 check (test>3);
|
||||||
-- should fail
|
-- should fail
|
||||||
insert into atacc1 (test) values (2);
|
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
|
-- should succeed
|
||||||
insert into atacc1 (test) values (4);
|
insert into atacc1 (test) values (4);
|
||||||
drop table atacc1;
|
drop table atacc1;
|
||||||
@ -424,7 +424,7 @@ create table atacc1 ( test int, test2 int, test3 int);
|
|||||||
alter table atacc1 add constraint atacc_test1 check (test+test2<test3*4);
|
alter table atacc1 add constraint atacc_test1 check (test+test2<test3*4);
|
||||||
-- should fail
|
-- should fail
|
||||||
insert into atacc1 (test,test2,test3) values (4,4,2);
|
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
|
-- should succeed
|
||||||
insert into atacc1 (test,test2,test3) values (4,4,5);
|
insert into atacc1 (test,test2,test3) values (4,4,5);
|
||||||
drop table atacc1;
|
drop table atacc1;
|
||||||
@ -433,7 +433,7 @@ create table atacc1 (test int check (test>3), test2 int);
|
|||||||
alter table atacc1 add check (test2>test);
|
alter table atacc1 add check (test2>test);
|
||||||
-- should fail for $2
|
-- should fail for $2
|
||||||
insert into atacc1 (test2, test) values (3, 4);
|
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;
|
drop table atacc1;
|
||||||
-- inheritance related tests
|
-- inheritance related tests
|
||||||
create table atacc1 (test int);
|
create table atacc1 (test int);
|
||||||
@ -442,11 +442,11 @@ create table atacc3 (test3 int) inherits (atacc1, atacc2);
|
|||||||
alter table atacc2 add constraint foo check (test2>0);
|
alter table atacc2 add constraint foo check (test2>0);
|
||||||
-- fail and then succeed on atacc2
|
-- fail and then succeed on atacc2
|
||||||
insert into atacc2 (test2) values (-3);
|
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);
|
insert into atacc2 (test2) values (3);
|
||||||
-- fail and then succeed on atacc3
|
-- fail and then succeed on atacc3
|
||||||
insert into atacc3 (test2) values (-3);
|
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);
|
insert into atacc3 (test2) values (3);
|
||||||
drop table atacc3;
|
drop table atacc3;
|
||||||
drop table atacc2;
|
drop table atacc2;
|
||||||
@ -458,7 +458,7 @@ create table atacc3 (test3 int) inherits (atacc1, atacc2);
|
|||||||
alter table only atacc2 add constraint foo check (test2>0);
|
alter table only atacc2 add constraint foo check (test2>0);
|
||||||
-- fail and then succeed on atacc2
|
-- fail and then succeed on atacc2
|
||||||
insert into atacc2 (test2) values (-3);
|
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);
|
insert into atacc2 (test2) values (3);
|
||||||
-- both succeed on atacc3
|
-- both succeed on atacc3
|
||||||
insert into atacc3 (test2) values (-3);
|
insert into atacc3 (test2) values (-3);
|
||||||
@ -539,7 +539,7 @@ ERROR: Cannot insert a duplicate key into unique index atacc_test1
|
|||||||
insert into atacc1 (test) values (4);
|
insert into atacc1 (test) values (4);
|
||||||
-- inserting NULL should fail
|
-- inserting NULL should fail
|
||||||
insert into atacc1 (test) values(NULL);
|
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)
|
-- try adding a second primary key (should fail)
|
||||||
alter table atacc1 add constraint atacc_oid1 primary key(oid);
|
alter table atacc1 add constraint atacc_oid1 primary key(oid);
|
||||||
ERROR: multiple primary keys for table "atacc1" are not allowed
|
ERROR: multiple primary keys for table "atacc1" are not allowed
|
||||||
@ -591,11 +591,11 @@ insert into atacc1 (test,test2) values (4,4);
|
|||||||
insert into atacc1 (test,test2) values (4,4);
|
insert into atacc1 (test,test2) values (4,4);
|
||||||
ERROR: Cannot insert a duplicate key into unique index atacc_test1
|
ERROR: Cannot insert a duplicate key into unique index atacc_test1
|
||||||
insert into atacc1 (test,test2) values (NULL,3);
|
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);
|
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);
|
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
|
-- should all succeed
|
||||||
insert into atacc1 (test,test2) values (4,5);
|
insert into atacc1 (test,test2) values (4,5);
|
||||||
insert into atacc1 (test,test2) values (5,4);
|
insert into atacc1 (test,test2) values (5,4);
|
||||||
@ -609,7 +609,7 @@ insert into atacc1 (test2, test) values (3, 3);
|
|||||||
insert into atacc1 (test2, test) values (2, 3);
|
insert into atacc1 (test2, test) values (2, 3);
|
||||||
ERROR: Cannot insert a duplicate key into unique index atacc1_pkey
|
ERROR: Cannot insert a duplicate key into unique index atacc1_pkey
|
||||||
insert into atacc1 (test2, test) values (1, NULL);
|
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;
|
drop table atacc1;
|
||||||
-- alter table / alter column [set/drop] not null tests
|
-- alter table / alter column [set/drop] not null tests
|
||||||
-- try altering system catalogs, should fail
|
-- try altering system catalogs, should fail
|
||||||
@ -659,9 +659,9 @@ create table parent (a int);
|
|||||||
create table child (b varchar(255)) inherits (parent);
|
create table child (b varchar(255)) inherits (parent);
|
||||||
alter table parent alter a set not null;
|
alter table parent alter a set not null;
|
||||||
insert into parent values (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');
|
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;
|
alter table parent alter a drop not null;
|
||||||
insert into parent values (NULL);
|
insert into parent values (NULL);
|
||||||
insert into child (a, b) values (NULL, 'foo');
|
insert into child (a, b) values (NULL, 'foo');
|
||||||
@ -672,14 +672,14 @@ ERROR: attribute "a" contains NULL values
|
|||||||
delete from parent;
|
delete from parent;
|
||||||
alter table only parent alter a set not null;
|
alter table only parent alter a set not null;
|
||||||
insert into parent values (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;
|
alter table child alter a set not null;
|
||||||
insert into child (a, b) values (NULL, 'foo');
|
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;
|
delete from child;
|
||||||
alter table child alter a set not null;
|
alter table child alter a set not null;
|
||||||
insert into child (a, b) values (NULL, 'foo');
|
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 child;
|
||||||
drop table parent;
|
drop table parent;
|
||||||
-- test setting and removing default values
|
-- test setting and removing default values
|
||||||
@ -1232,7 +1232,7 @@ alter table p1 add column f2 text;
|
|||||||
NOTICE: merging definition of column "f2" for child "c1"
|
NOTICE: merging definition of column "f2" for child "c1"
|
||||||
insert into p1 values (1,2,'abc');
|
insert into p1 values (1,2,'abc');
|
||||||
insert into c1 values(11,'xyz',33,0); -- should fail
|
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);
|
insert into c1 values(11,'xyz',33,22);
|
||||||
select * from p1;
|
select * from p1;
|
||||||
f1 | a1 | f2
|
f1 | a1 | f2
|
||||||
|
@ -111,26 +111,26 @@ create table nulltest
|
|||||||
, col5 dcheck CHECK (col5 IN ('c', 'd'))
|
, col5 dcheck CHECK (col5 IN ('c', 'd'))
|
||||||
);
|
);
|
||||||
INSERT INTO nulltest DEFAULT VALUES;
|
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', 'c'); -- Good
|
||||||
insert into nulltest values ('a', 'b', 'c', 'd', NULL);
|
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');
|
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');
|
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');
|
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');
|
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
|
INSERT INTO nulltest values ('a', 'b', 'c', NULL, 'd'); -- Good
|
||||||
-- Test copy
|
-- Test copy
|
||||||
COPY nulltest FROM stdin; --fail
|
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
|
CONTEXT: COPY FROM, line 1
|
||||||
-- Last row is bad
|
-- Last row is bad
|
||||||
COPY nulltest FROM stdin;
|
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
|
CONTEXT: COPY FROM, line 3
|
||||||
select * from nulltest;
|
select * from nulltest;
|
||||||
col1 | col2 | col3 | col4 | col5
|
col1 | col2 | col3 | col4 | col5
|
||||||
@ -147,11 +147,11 @@ SELECT cast('1' as dnotnull);
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT cast(NULL as dnotnull); -- fail
|
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
|
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
|
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
|
-- cleanup
|
||||||
drop table nulltest;
|
drop table nulltest;
|
||||||
drop domain dnotnull restrict;
|
drop domain dnotnull restrict;
|
||||||
@ -208,7 +208,7 @@ alter domain dnotnulltest set not null;
|
|||||||
alter domain dnotnulltest set not null; -- fails
|
alter domain dnotnulltest set not null; -- fails
|
||||||
NOTICE: "dnotnulltest" is already set to NOT NULL
|
NOTICE: "dnotnulltest" is already set to NOT NULL
|
||||||
update domnotnull set col1 = null; -- fails
|
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;
|
||||||
alter domain dnotnulltest drop not null; -- fails
|
alter domain dnotnulltest drop not null; -- fails
|
||||||
NOTICE: "dnotnulltest" is already set to NULL
|
NOTICE: "dnotnulltest" is already set to NULL
|
||||||
@ -255,13 +255,13 @@ ERROR: relation "domcontest" attribute "col1" contains values that violate the
|
|||||||
alter domain con add constraint t check (VALUE < 34);
|
alter domain con add constraint t check (VALUE < 34);
|
||||||
alter domain con add check (VALUE > 0);
|
alter domain con add check (VALUE > 0);
|
||||||
insert into domcontest values (-5); -- fails
|
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
|
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);
|
insert into domcontest values (5);
|
||||||
alter domain con drop constraint t;
|
alter domain con drop constraint t;
|
||||||
insert into domcontest values (-5); --fails
|
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);
|
insert into domcontest values (42);
|
||||||
-- Confirm ALTER DOMAIN with RULES.
|
-- Confirm ALTER DOMAIN with RULES.
|
||||||
create table domtab (col1 integer);
|
create table domtab (col1 integer);
|
||||||
@ -278,7 +278,7 @@ select * from domview;
|
|||||||
|
|
||||||
alter domain dom set not null;
|
alter domain dom set not null;
|
||||||
select * from domview; -- fail
|
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;
|
alter domain dom drop not null;
|
||||||
select * from domview;
|
select * from domview;
|
||||||
col1
|
col1
|
||||||
@ -289,7 +289,7 @@ select * from domview;
|
|||||||
|
|
||||||
alter domain dom add constraint domchkgt6 check(value > 6);
|
alter domain dom add constraint domchkgt6 check(value > 6);
|
||||||
select * from domview; --fail
|
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;
|
alter domain dom drop constraint domchkgt6 restrict;
|
||||||
select * from domview;
|
select * from domview;
|
||||||
col1
|
col1
|
||||||
|
@ -538,7 +538,7 @@ SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
|
|||||||
CREATE TEMP TABLE z (b TEXT, PRIMARY KEY(aa, b)) inherits (a);
|
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"
|
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "z_pkey" for table "z"
|
||||||
INSERT INTO z VALUES (NULL, 'text'); -- should fail
|
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
|
-- Check UPDATE with inherited target and an inherited source table
|
||||||
create temp table foo(f1 int, f2 int);
|
create temp table foo(f1 int, f2 int);
|
||||||
create temp table foo2(f3 int) inherits (foo);
|
create temp table foo2(f3 int) inherits (foo);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
--
|
--
|
||||||
create table inserttest (col1 int4, col2 int4 NOT NULL, col3 text default 'testing');
|
create table inserttest (col1 int4, col2 int4 NOT NULL, col3 text default 'testing');
|
||||||
insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT, DEFAULT);
|
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 (col2, col3) values (3, DEFAULT);
|
||||||
insert into inserttest (col1, col2, col3) values (DEFAULT, 5, DEFAULT);
|
insert into inserttest (col1, col2, col3) values (DEFAULT, 5, DEFAULT);
|
||||||
insert into inserttest values (DEFAULT, 5, 'test');
|
insert into inserttest values (DEFAULT, 5, 'test');
|
||||||
|
@ -9,7 +9,7 @@ INSERT INTO serialTest VALUES ('foo');
|
|||||||
INSERT INTO serialTest VALUES ('bar');
|
INSERT INTO serialTest VALUES ('bar');
|
||||||
INSERT INTO serialTest VALUES ('force', 100);
|
INSERT INTO serialTest VALUES ('force', 100);
|
||||||
INSERT INTO serialTest VALUES ('wrong', NULL);
|
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;
|
SELECT * FROM serialTest;
|
||||||
f1 | f2
|
f1 | f2
|
||||||
|
@ -62,12 +62,12 @@ CREATE TABLE CHECK_TBL (x int,
|
|||||||
INSERT INTO CHECK_TBL VALUES (5);
|
INSERT INTO CHECK_TBL VALUES (5);
|
||||||
INSERT INTO CHECK_TBL VALUES (4);
|
INSERT INTO CHECK_TBL VALUES (4);
|
||||||
INSERT INTO CHECK_TBL VALUES (3);
|
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);
|
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 (6);
|
||||||
INSERT INTO CHECK_TBL VALUES (1);
|
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;
|
SELECT '' AS three, * FROM CHECK_TBL;
|
||||||
three | x
|
three | x
|
||||||
-------+---
|
-------+---
|
||||||
@ -82,13 +82,13 @@ CREATE TABLE CHECK2_TBL (x int, y text, z int,
|
|||||||
CHECK (x > 3 and y <> 'check failed' and z < 8));
|
CHECK (x > 3 and y <> 'check failed' and z < 8));
|
||||||
INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2);
|
INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2);
|
||||||
INSERT INTO CHECK2_TBL VALUES (1, 'x check failed', -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);
|
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);
|
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);
|
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);
|
INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7);
|
||||||
SELECT '' AS two, * from CHECK2_TBL;
|
SELECT '' AS two, * from CHECK2_TBL;
|
||||||
two | x | y | z
|
two | x | y | z
|
||||||
@ -107,7 +107,7 @@ CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'),
|
|||||||
CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
|
CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
|
||||||
CHECK (x + z = 0));
|
CHECK (x + z = 0));
|
||||||
INSERT INTO INSERT_TBL(x,z) VALUES (2, -2);
|
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;
|
SELECT '' AS zero, * FROM INSERT_TBL;
|
||||||
zero | x | y | z
|
zero | x | y | z
|
||||||
------+---+---+---
|
------+---+---+---
|
||||||
@ -120,13 +120,13 @@ SELECT 'one' AS one, nextval('insert_seq');
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO INSERT_TBL(y) VALUES ('Y');
|
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(y) VALUES ('Y');
|
||||||
INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
|
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(z,x) VALUES (-7, 7);
|
||||||
INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
|
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 VALUES (7, '!check failed', -7);
|
||||||
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
|
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
|
||||||
SELECT '' AS four, * FROM INSERT_TBL;
|
SELECT '' AS four, * FROM INSERT_TBL;
|
||||||
@ -139,9 +139,9 @@ SELECT '' AS four, * FROM INSERT_TBL;
|
|||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4);
|
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');
|
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(x,y) VALUES (5, '!check failed');
|
||||||
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
|
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
|
||||||
SELECT '' AS six, * FROM INSERT_TBL;
|
SELECT '' AS six, * FROM INSERT_TBL;
|
||||||
@ -162,7 +162,7 @@ SELECT 'seven' AS one, nextval('insert_seq');
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO INSERT_TBL(y) VALUES ('Y');
|
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');
|
SELECT 'eight' AS one, currval('insert_seq');
|
||||||
one | currval
|
one | currval
|
||||||
-------+---------
|
-------+---------
|
||||||
@ -193,11 +193,11 @@ CREATE TABLE INSERT_CHILD (cx INT default 42,
|
|||||||
INHERITS (INSERT_TBL);
|
INHERITS (INSERT_TBL);
|
||||||
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11);
|
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11);
|
||||||
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6);
|
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);
|
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);
|
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;
|
SELECT * FROM INSERT_CHILD;
|
||||||
x | y | z | cx | cy
|
x | y | z | cx | cy
|
||||||
---+--------+----+----+----
|
---+--------+----+----+----
|
||||||
@ -227,7 +227,7 @@ SELECT '' AS three, * FROM INSERT_TBL;
|
|||||||
INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again';
|
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, -7 FROM tmp WHERE yd = 'try again';
|
||||||
INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 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;
|
SELECT '' AS four, * FROM INSERT_TBL;
|
||||||
four | x | y | z
|
four | x | y | z
|
||||||
------+---+---------------+----
|
------+---+---------------+----
|
||||||
@ -246,7 +246,7 @@ UPDATE INSERT_TBL SET x = NULL WHERE x = 5;
|
|||||||
UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
|
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;
|
||||||
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;
|
SELECT * FROM INSERT_TBL;
|
||||||
x | y | z
|
x | y | z
|
||||||
---+---------------+----
|
---+---------------+----
|
||||||
@ -273,7 +273,7 @@ SELECT '' AS two, * FROM COPY_TBL;
|
|||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data';
|
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
|
CONTEXT: COPY FROM, line 2
|
||||||
SELECT * FROM COPY_TBL;
|
SELECT * FROM COPY_TBL;
|
||||||
x | y | z
|
x | y | z
|
||||||
@ -294,7 +294,7 @@ ERROR: Cannot insert a duplicate key into unique index primary_tbl_pkey
|
|||||||
INSERT INTO PRIMARY_TBL VALUES (4, 'three');
|
INSERT INTO PRIMARY_TBL VALUES (4, 'three');
|
||||||
INSERT INTO PRIMARY_TBL VALUES (5, 'one');
|
INSERT INTO PRIMARY_TBL VALUES (5, 'one');
|
||||||
INSERT INTO PRIMARY_TBL (t) VALUES ('six');
|
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;
|
SELECT '' AS four, * FROM PRIMARY_TBL;
|
||||||
four | i | t
|
four | i | t
|
||||||
------+---+-------
|
------+---+-------
|
||||||
@ -314,7 +314,7 @@ INSERT INTO PRIMARY_TBL VALUES (1, 'three');
|
|||||||
INSERT INTO PRIMARY_TBL VALUES (4, 'three');
|
INSERT INTO PRIMARY_TBL VALUES (4, 'three');
|
||||||
INSERT INTO PRIMARY_TBL VALUES (5, 'one');
|
INSERT INTO PRIMARY_TBL VALUES (5, 'one');
|
||||||
INSERT INTO PRIMARY_TBL (t) VALUES ('six');
|
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;
|
SELECT '' AS three, * FROM PRIMARY_TBL;
|
||||||
three | i | t
|
three | i | t
|
||||||
-------+---+-------
|
-------+---+-------
|
||||||
|
Reference in New Issue
Block a user