*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.63 1998/10/26 00:59:21 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.63.2.1 1999/02/07 16:50:51 wieck Exp $
*
*-------------------------------------------------------------------------
*/
Node **indexPred = NULL;
TupleDesc rtupdesc;
ExprContext *econtext = NULL;
+ EState *estate = makeNode(EState);
#ifndef OMIT_PARTIAL_INDEX
TupleTable tupleTable;
{
HeapTuple newtuple;
- newtuple = ExecConstraints("CopyFrom", rel, tuple);
+ newtuple = ExecConstraints("CopyFrom", rel, tuple, estate);
if (newtuple != tuple)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.58 1998/10/14 05:10:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.58.2.1 1999/02/07 16:50:52 wieck Exp $
*
*-------------------------------------------------------------------------
*/
{
HeapTuple newtuple;
- newtuple = ExecConstraints("ExecAppend", resultRelationDesc, tuple);
+ newtuple = ExecConstraints("ExecAppend", resultRelationDesc,
+ tuple, estate);
if (newtuple != tuple) /* modified by DEFAULT */
{
{
HeapTuple newtuple;
- newtuple = ExecConstraints("ExecReplace", resultRelationDesc, tuple);
+ newtuple = ExecConstraints("ExecReplace", resultRelationDesc,
+ tuple, estate);
if (newtuple != tuple) /* modified by DEFAULT */
{
#endif
static char *
-ExecRelCheck(Relation rel, HeapTuple tuple)
+ExecRelCheck(Relation rel, HeapTuple tuple, EState *estate)
{
int ncheck = rel->rd_att->constr->num_check;
ConstrCheck *check = rel->rd_att->constr->check;
econtext->ecxt_param_exec_vals = NULL; /* exec param values */
econtext->ecxt_range_table = rtlist; /* range table */
+ if (estate->es_result_relation_constraints == NULL)
+ {
+ estate->es_result_relation_constraints =
+ (List **)palloc(ncheck * sizeof(List *));
+
+ for (i = 0; i < ncheck; i++)
+ {
+ qual = (List *) stringToNode(check[i].ccbin);
+ estate->es_result_relation_constraints[i] = qual;
+ }
+ }
+
for (i = 0; i < ncheck; i++)
{
- qual = (List *) stringToNode(check[i].ccbin);
+ qual = estate->es_result_relation_constraints[i];
res = ExecQual(qual, econtext);
- pfree(qual);
-
if (!res)
return check[i].ccname;
}
}
HeapTuple
-ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
+ExecConstraints(char *caller, Relation rel, HeapTuple tuple, EState *estate)
{
HeapTuple newtuple = tuple;
{
char *failed;
- if ((failed = ExecRelCheck(rel, tuple)) != NULL)
+ if ((failed = ExecRelCheck(rel, tuple, estate)) != NULL)
elog(ERROR, "%s: rejected due to CHECK constraint %s", caller, failed);
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: executor.h,v 1.27 1998/10/14 05:10:05 momjian Exp $
+ * $Id: executor.h,v 1.27.2.1 1999/02/07 16:50:54 wieck Exp $
*
*-------------------------------------------------------------------------
*/
extern TupleDesc ExecutorStart(QueryDesc *queryDesc, EState *estate);
extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count);
extern void ExecutorEnd(QueryDesc *queryDesc, EState *estate);
-extern HeapTuple ExecConstraints(char *caller, Relation rel, HeapTuple tuple);
+extern HeapTuple ExecConstraints(char *caller, Relation rel, HeapTuple tuple,
+ EState *estate);
#ifdef QUERY_LIMIT
extern int ExecutorLimit(int limit);
extern int ExecutorGetLimit(void);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: execnodes.h,v 1.18 1998/09/01 04:36:35 momjian Exp $
+ * $Id: execnodes.h,v 1.18.2.1 1999/02/07 16:50:55 wieck Exp $
*
*-------------------------------------------------------------------------
*/
Snapshot es_snapshot;
List *es_range_table;
RelationInfo *es_result_relation_info;
+ List **es_result_relation_constraints;
Relation es_into_relation_descriptor;
ParamListInfo es_param_list_info;
ParamExecData *es_param_exec_vals; /* this is for subselects */