Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1440acd

Browse files
committed
Wups, didn't mean to commit that just yet.
1 parent0da6cf5 commit1440acd

File tree

1 file changed

+46
-45
lines changed

1 file changed

+46
-45
lines changed

‎src/backend/executor/execQual.c

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.104 2002/08/31 19:09:27 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.105 2002/08/31 19:10:08 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -69,9 +69,8 @@ static Datum ExecEvalNullTest(NullTest *ntest, ExprContext *econtext,
6969
bool*isNull,ExprDoneCond*isDone);
7070
staticDatumExecEvalBooleanTest(BooleanTest*btest,ExprContext*econtext,
7171
bool*isNull,ExprDoneCond*isDone);
72-
staticDatumExecEvalConstraintTest(ConstraintTest*constraint,
73-
ExprContext*econtext,
74-
bool*isNull,ExprDoneCond*isDone);
72+
staticDatumExecEvalConstraint(Constraint*constraint,ExprContext*econtext,
73+
bool*isNull,ExprDoneCond*isDone);
7574

7675

7776
/*----------
@@ -1466,6 +1465,43 @@ ExecEvalNullTest(NullTest *ntest,
14661465
}
14671466
}
14681467

1468+
/*
1469+
* ExecEvalConstraint
1470+
*
1471+
* Test the constraint against the data provided. If the data fits
1472+
* within the constraint specifications, pass it through (return the
1473+
* datum) otherwise throw an error.
1474+
*/
1475+
staticDatum
1476+
ExecEvalConstraint(Constraint*constraint,ExprContext*econtext,
1477+
bool*isNull,ExprDoneCond*isDone)
1478+
{
1479+
Datumresult;
1480+
1481+
result=ExecEvalExpr(constraint->raw_expr,econtext,isNull,isDone);
1482+
1483+
/* Test for the constraint type */
1484+
switch(constraint->contype)
1485+
{
1486+
caseCONSTR_NOTNULL:
1487+
if (*isNull)
1488+
{
1489+
elog(ERROR,"Domain %s does not allow NULL values",constraint->name);
1490+
}
1491+
break;
1492+
caseCONSTR_CHECK:
1493+
1494+
elog(ERROR,"ExecEvalConstraint: Domain CHECK Constraints not yet implemented");
1495+
break;
1496+
default:
1497+
elog(ERROR,"ExecEvalConstraint: Constraint type unknown");
1498+
break;
1499+
}
1500+
1501+
/* If all has gone well (constraint did not fail) return the datum */
1502+
returnresult;
1503+
}
1504+
14691505
/* ----------------------------------------------------------------
14701506
*ExecEvalBooleanTest
14711507
*
@@ -1546,41 +1582,6 @@ ExecEvalBooleanTest(BooleanTest *btest,
15461582
}
15471583
}
15481584

1549-
/*
1550-
* ExecEvalConstraintTest
1551-
*
1552-
* Test the constraint against the data provided. If the data fits
1553-
* within the constraint specifications, pass it through (return the
1554-
* datum) otherwise throw an error.
1555-
*/
1556-
staticDatum
1557-
ExecEvalConstraintTest(ConstraintTest*constraint,ExprContext*econtext,
1558-
bool*isNull,ExprDoneCond*isDone)
1559-
{
1560-
Datumresult;
1561-
1562-
result=ExecEvalExpr(constraint->arg,econtext,isNull,isDone);
1563-
1564-
switch (constraint->testtype)
1565-
{
1566-
caseCONSTR_TEST_NOTNULL:
1567-
if (*isNull)
1568-
elog(ERROR,"Domain %s does not allow NULL values",
1569-
constraint->name);
1570-
break;
1571-
caseCONSTR_TEST_CHECK:
1572-
/* TODO: Add CHECK Constraints to domains */
1573-
elog(ERROR,"Domain CHECK Constraints not yet implemented");
1574-
break;
1575-
default:
1576-
elog(ERROR,"ExecEvalConstraintTest: Constraint type unknown");
1577-
break;
1578-
}
1579-
1580-
/* If all has gone well (constraint did not fail) return the datum */
1581-
returnresult;
1582-
}
1583-
15841585
/* ----------------------------------------------------------------
15851586
*ExecEvalFieldSelect
15861587
*
@@ -1748,6 +1749,12 @@ ExecEvalExpr(Node *expression,
17481749
isNull,
17491750
isDone);
17501751
break;
1752+
caseT_Constraint:
1753+
retDatum=ExecEvalConstraint((Constraint*)expression,
1754+
econtext,
1755+
isNull,
1756+
isDone);
1757+
break;
17511758
caseT_CaseExpr:
17521759
retDatum=ExecEvalCase((CaseExpr*)expression,
17531760
econtext,
@@ -1766,12 +1773,6 @@ ExecEvalExpr(Node *expression,
17661773
isNull,
17671774
isDone);
17681775
break;
1769-
caseT_ConstraintTest:
1770-
retDatum=ExecEvalConstraintTest((ConstraintTest*)expression,
1771-
econtext,
1772-
isNull,
1773-
isDone);
1774-
break;
17751776

17761777
default:
17771778
elog(ERROR,"ExecEvalExpr: unknown expression type %d",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp