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

Commit3389a11

Browse files
committed
Get rid of long-since-vestigial Iter node type, in favor of adding a
returns-set boolean field in Func and Oper nodes. This allows cleaner,more reliable tests for expressions returning sets in the planner andparser. For example, a WHERE clause returning a set is now detectedand complained of in the parser, not only at runtime.
1 parentf9e4f61 commit3389a11

33 files changed

+297
-676
lines changed

‎src/backend/catalog/heap.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.198 2002/05/03 04:11:08 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.199 2002/05/12 23:43:02 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -49,6 +49,7 @@
4949
#include"optimizer/planmain.h"
5050
#include"optimizer/prep.h"
5151
#include"optimizer/var.h"
52+
#include"parser/parse_coerce.h"
5253
#include"parser/parse_expr.h"
5354
#include"parser/parse_relation.h"
5455
#include"parser/parse_target.h"
@@ -1626,9 +1627,7 @@ AddRelationRawConstraints(Relation rel,
16261627
/*
16271628
* Make sure it yields a boolean result.
16281629
*/
1629-
if (exprType(expr)!=BOOLOID)
1630-
elog(ERROR,"CHECK constraint expression '%s' does not yield boolean result",
1631-
ccname);
1630+
expr=coerce_to_boolean(expr,"CHECK");
16321631

16331632
/*
16341633
* Make sure no outside relations are referred to.
@@ -1764,6 +1763,12 @@ cookDefault(ParseState *pstate,
17641763
if (contain_var_clause(expr))
17651764
elog(ERROR,"cannot use column references in DEFAULT clause");
17661765

1766+
/*
1767+
* It can't return a set either.
1768+
*/
1769+
if (expression_returns_set(expr))
1770+
elog(ERROR,"DEFAULT clause must not return a set");
1771+
17671772
/*
17681773
* No subplans or aggregates, either...
17691774
*/

‎src/backend/commands/tablecmds.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.12 2002/04/27 21:24:34 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.13 2002/05/12 23:43:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -37,6 +37,7 @@
3737
#include"optimizer/planmain.h"
3838
#include"optimizer/prep.h"
3939
#include"parser/parse.h"
40+
#include"parser/parse_coerce.h"
4041
#include"parser/parse_expr.h"
4142
#include"parser/parse_relation.h"
4243
#include"parser/parse_type.h"
@@ -2461,9 +2462,7 @@ AlterTableAddConstraint(Oid myrelid,
24612462
/*
24622463
* Make sure it yields a boolean result.
24632464
*/
2464-
if (exprType(expr)!=BOOLOID)
2465-
elog(ERROR,"CHECK '%s' does not yield boolean result",
2466-
name);
2465+
expr=coerce_to_boolean(expr,"CHECK");
24672466

24682467
/*
24692468
* Make sure no outside relations are
@@ -2473,6 +2472,14 @@ AlterTableAddConstraint(Oid myrelid,
24732472
elog(ERROR,"Only relation '%s' can be referenced in CHECK",
24742473
RelationGetRelationName(rel));
24752474

2475+
/*
2476+
* No subplans or aggregates, either...
2477+
*/
2478+
if (contain_subplans(expr))
2479+
elog(ERROR,"cannot use subselect in CHECK constraint expression");
2480+
if (contain_agg_clause(expr))
2481+
elog(ERROR,"cannot use aggregate function in CHECK constraint expression");
2482+
24762483
/*
24772484
* Might as well try to reduce any
24782485
* constant expressions.

‎src/backend/executor/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
# Makefile for executor
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/executor/Makefile,v 1.18 2002/05/1220:10:02 tgl Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/executor/Makefile,v 1.19 2002/05/1223:43:02 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/backend/executor
1212
top_builddir = ../../..
1313
include$(top_builddir)/src/Makefile.global
1414

15-
OBJS = execAmi.oexecFlatten.oexecJunk.o execMain.o\
15+
OBJS = execAmi.o execJunk.o execMain.o\
1616
execProcnode.o execQual.o execScan.o execTuples.o\
1717
execUtils.o functions.o instrument.o nodeAppend.o nodeAgg.o nodeHash.o\
1818
nodeHashjoin.o nodeIndexscan.o nodeMaterial.o nodeMergejoin.o\

‎src/backend/executor/execFlatten.c

Lines changed: 0 additions & 243 deletions
This file was deleted.

‎src/backend/executor/execQual.c

Lines changed: 1 addition & 8 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.92 2002/05/1220:10:02 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.93 2002/05/1223:43:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -35,7 +35,6 @@
3535
#include"postgres.h"
3636

3737
#include"access/heapam.h"
38-
#include"executor/execFlatten.h"
3938
#include"executor/execdebug.h"
4039
#include"executor/functions.h"
4140
#include"executor/nodeSubplan.h"
@@ -1336,12 +1335,6 @@ ExecEvalExpr(Node *expression,
13361335
caseT_Param:
13371336
retDatum=ExecEvalParam((Param*)expression,econtext,isNull);
13381337
break;
1339-
caseT_Iter:
1340-
retDatum=ExecEvalIter((Iter*)expression,
1341-
econtext,
1342-
isNull,
1343-
isDone);
1344-
break;
13451338
caseT_Aggref:
13461339
retDatum=ExecEvalAggref((Aggref*)expression,econtext,isNull);
13471340
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp