Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
4327a367
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4327a367
编写于
9月 25, 1998
作者:
T
Thomas G. Lockhart
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up existing debugging print statements.
Modify comment blocks to insulate from pgindent.
上级
ee88006c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
218 addition
and
217 deletion
+218
-217
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+112
-112
src/backend/executor/execQual.c
src/backend/executor/execQual.c
+104
-104
src/backend/executor/nodeSeqscan.c
src/backend/executor/nodeSeqscan.c
+2
-1
未找到文件。
src/backend/executor/execMain.c
浏览文件 @
4327a367
...
...
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.5
5 1998/09/01 04:28:16 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.5
6 1998/09/25 13:38:30 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -168,16 +168,16 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
CommandDest
dest
;
void
(
*
destination
)
();
/*
----------------
/*
*****************
* sanity checks
*
----------------
*
*****************
*/
Assert
(
queryDesc
!=
NULL
);
/*
----------------
/*
*****************
* extract information from the query descriptor
* and the query feature.
*
----------------
*
*****************
*/
operation
=
queryDesc
->
operation
;
parseTree
=
queryDesc
->
parsetree
;
...
...
@@ -209,9 +209,9 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
destination
);
break
;
/*
----------------
/*
*****************
* retrieve next n "backward" tuples
*
----------------
*
*****************
*/
case
EXEC_BACK
:
result
=
ExecutePlan
(
estate
,
...
...
@@ -223,10 +223,10 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
destination
);
break
;
/*
----------------
/*
*****************
* return one tuple but don't "retrieve" it.
* (this is used by the rule manager..) -cim 9/14/89
*
----------------
*
*****************
*/
case
EXEC_RETONE
:
result
=
ExecutePlan
(
estate
,
...
...
@@ -389,40 +389,40 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
List
*
targetList
;
int
len
;
/*
----------------
/*
*****************
* get information from query descriptor
*
----------------
*
*****************
*/
rangeTable
=
parseTree
->
rtable
;
resultRelation
=
parseTree
->
resultRelation
;
/*
----------------
/*
*****************
* initialize the node's execution state
*
----------------
*
*****************
*/
estate
->
es_range_table
=
rangeTable
;
/*
----------------
/*
*****************
* initialize the BaseId counter so node base_id's
* are assigned correctly. Someday baseid's will have to
* be stored someplace other than estate because they
* should be unique per query planned.
*
----------------
*
*****************
*/
estate
->
es_BaseId
=
1
;
/*
----------------
/*
*****************
* initialize result relation stuff
*
----------------
*
*****************
*/
if
(
resultRelation
!=
0
&&
operation
!=
CMD_SELECT
)
{
/*
----------------
/*
*****************
* if we have a result relation, open it and
* initialize the result relation info stuff.
*
----------------
*
*****************
*/
RelationInfo
*
resultRelationInfo
;
Index
resultRelationIndex
;
...
...
@@ -455,10 +455,10 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
resultRelationInfo
->
ri_IndexRelationDescs
=
NULL
;
resultRelationInfo
->
ri_IndexRelationInfo
=
NULL
;
/*
----------------
/*
*****************
* open indices on result relation and save descriptors
* in the result relation information..
*
----------------
*
*****************
*/
ExecOpenIndices
(
resultRelationOid
,
resultRelationInfo
);
...
...
@@ -466,9 +466,9 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
}
else
{
/*
----------------
/*
*****************
* if no result relation, then set state appropriately
*
----------------
*
*****************
*/
estate
->
es_result_relation_info
=
NULL
;
}
...
...
@@ -477,9 +477,9 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
ExecCheckPerms
(
operation
,
resultRelation
,
rangeTable
,
parseTree
);
#endif
/*
----------------
/*
*****************
* initialize the executor "tuple" table.
*
----------------
*
*****************
*/
{
int
nSlots
=
ExecCountSlotsNode
(
plan
);
...
...
@@ -488,33 +488,33 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
estate
->
es_tupleTable
=
tupleTable
;
}
/*
----------------
/*
*****************
* initialize the private state information for
* all the nodes in the query tree. This opens
* files, allocates storage and leaves us ready
* to start processing tuples..
*
----------------
*
*****************
*/
ExecInitNode
(
plan
,
estate
,
NULL
);
/*
----------------
/*
*****************
* get the tuple descriptor describing the type
* of tuples to return.. (this is especially important
* if we are creating a relation with "retrieve into")
*
----------------
*
*****************
*/
tupType
=
ExecGetTupType
(
plan
);
/* tuple descriptor */
targetList
=
plan
->
targetlist
;
len
=
ExecTargetListLength
(
targetList
);
/* number of attributes */
/*
----------------
/*
*****************
* now that we have the target list, initialize the junk filter
* if this is a REPLACE or a DELETE query.
* We also init the junk filter if this is an append query
* (there might be some rule lock info there...)
* NOTE: in the future we might want to initialize the junk
* filter for all queries.
*
----------------
*
*****************
* SELECT added by daveh@insightdist.com 5/20/98 to allow
* ORDER/GROUP BY have an identifier missing from the target.
*/
...
...
@@ -551,9 +551,9 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
estate
->
es_junkFilter
=
NULL
;
}
/*
----------------
/*
*****************
* initialize the "into" relation
*
----------------
*
*****************
*/
intoRelationDesc
=
(
Relation
)
NULL
;
...
...
@@ -571,9 +571,9 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
*/
if
(
parseTree
->
into
!=
NULL
)
{
/*
----------------
/*
*****************
* create the "into" relation
*
----------------
*
*****************
*/
intoName
=
parseTree
->
into
;
...
...
@@ -587,11 +587,11 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
FreeTupleDesc
(
tupdesc
);
/*
----------------
/*
*****************
* XXX rather than having to call setheapoverride(true)
* and then back to false, we should change the
* arguments to heap_open() instead..
*
----------------
*
*****************
*/
setheapoverride
(
true
);
...
...
@@ -619,22 +619,22 @@ EndPlan(Plan *plan, EState *estate)
RelationInfo
*
resultRelationInfo
;
Relation
intoRelationDesc
;
/*
----------------
/*
*****************
* get information from state
*
----------------
*
*****************
*/
resultRelationInfo
=
estate
->
es_result_relation_info
;
intoRelationDesc
=
estate
->
es_into_relation_descriptor
;
/*
----------------
/*
*****************
* shut down the query
*
----------------
*
*****************
*/
ExecEndNode
(
plan
,
plan
);
/*
----------------
/*
*****************
* destroy the executor "tuple" table.
*
----------------
*
*****************
*/
{
TupleTable
tupleTable
=
(
TupleTable
)
estate
->
es_tupleTable
;
...
...
@@ -643,9 +643,9 @@ EndPlan(Plan *plan, EState *estate)
estate
->
es_tupleTable
=
NULL
;
}
/*
----------------
/*
*****************
* close the result relations if necessary
*
----------------
*
*****************
*/
if
(
resultRelationInfo
!=
NULL
)
{
...
...
@@ -654,16 +654,16 @@ EndPlan(Plan *plan, EState *estate)
resultRelationDesc
=
resultRelationInfo
->
ri_RelationDesc
;
heap_close
(
resultRelationDesc
);
/*
----------------
/*
*****************
* close indices on the result relation
*
----------------
*
*****************
*/
ExecCloseIndices
(
resultRelationInfo
);
}
/*
----------------
/*
*****************
* close the "into" relation if necessary
*
----------------
*
*****************
*/
if
(
intoRelationDesc
!=
NULL
)
heap_close
(
intoRelationDesc
);
...
...
@@ -702,42 +702,42 @@ ExecutePlan(EState *estate,
int
current_tuple_count
;
TupleTableSlot
*
result
;
/*
----------------
/*
*****************
* initialize local variables
*
----------------
*
*****************
*/
slot
=
NULL
;
current_tuple_count
=
0
;
result
=
NULL
;
/*
----------------
/*
*****************
* Set the direction.
*
----------------
*
*****************
*/
estate
->
es_direction
=
direction
;
/*
----------------
/*
*****************
* Loop until we've processed the proper number
* of tuples from the plan..
*
----------------
*
*****************
*/
for
(;;)
{
if
(
operation
!=
CMD_NOTIFY
)
{
/*
----------------
/*
*****************
* Execute the plan and obtain a tuple
*
----------------
*
*****************
*/
/* at the top level, the parent of a plan (2nd arg) is itself */
slot
=
ExecProcNode
(
plan
,
plan
);
/*
----------------
/*
*****************
* if the tuple is null, then we assume
* there is nothing more to process so
* we just return null...
*
----------------
*
*****************
*/
if
(
TupIsNull
(
slot
))
{
...
...
@@ -746,15 +746,15 @@ ExecutePlan(EState *estate,
}
}
/*
----------------
/*
*****************
* if we have a junk filter, then project a new
* tuple with the junk removed.
*
* Store this new "clean" tuple in the place of the
* original tuple.
*
* Also, extract all the junk i
fn
ormation we need.
*
----------------
* Also, extract all the junk i
nf
ormation we need.
*
*****************
*/
if
((
junkfilter
=
estate
->
es_junkFilter
)
!=
(
JunkFilter
*
)
NULL
)
{
...
...
@@ -764,9 +764,9 @@ ExecutePlan(EState *estate,
HeapTuple
newTuple
;
bool
isNull
;
/*
---------------
/*
*****************
* extract the 'ctid' junk attribute.
*
---------------
*
*****************
*/
if
(
operation
==
CMD_UPDATE
||
operation
==
CMD_DELETE
)
{
...
...
@@ -786,10 +786,10 @@ ExecutePlan(EState *estate,
tupleid
=
&
tuple_ctid
;
}
/*
---------------
/*
*****************
* Finally create a new "clean" tuple with all junk attributes
* removed
*
---------------
*
*****************
*/
newTuple
=
ExecRemoveJunk
(
junkfilter
,
slot
);
...
...
@@ -800,12 +800,12 @@ ExecutePlan(EState *estate,
true
);
/* tuple should be pfreed */
}
/* if (junkfilter... */
/*
----------------
/*
*****************
* now that we have a tuple, do the appropriate thing
* with it.. either return it to the user, add
* it to a relation someplace, delete it from a
* relation, or modify some of it's attributes.
*
----------------
*
*****************
*/
switch
(
operation
)
...
...
@@ -855,21 +855,21 @@ ExecutePlan(EState *estate,
result
=
NULL
;
break
;
}
/*
----------------
/*
*****************
* check our tuple count.. if we've returned the
* proper number then return, else loop again and
* process more tuples..
*
----------------
*
*****************
*/
current_tuple_count
+=
1
;
if
(
numberTuples
==
current_tuple_count
)
break
;
}
/*
----------------
/*
*****************
* here, result is either a slot containing a tuple in the case
* of a RETRIEVE or NULL otherwise.
*
----------------
*
*****************
*/
return
result
;
}
...
...
@@ -892,16 +892,16 @@ ExecRetrieve(TupleTableSlot *slot,
HeapTuple
tuple
;
TupleDesc
attrtype
;
/*
----------------
/*
*****************
* get the heap tuple out of the tuple table slot
*
----------------
*
*****************
*/
tuple
=
slot
->
val
;
attrtype
=
slot
->
ttc_tupleDescriptor
;
/*
----------------
/*
*****************
* insert the tuple into the "into relation"
*
----------------
*
*****************
*/
if
(
estate
->
es_into_relation_descriptor
!=
NULL
)
{
...
...
@@ -909,9 +909,9 @@ ExecRetrieve(TupleTableSlot *slot,
IncrAppended
();
}
/*
----------------
/*
*****************
* send the tuple to the front end (or the screen)
*
----------------
*
*****************
*/
(
*
printfunc
)
(
tuple
,
attrtype
);
IncrRetrieved
();
...
...
@@ -938,23 +938,23 @@ ExecAppend(TupleTableSlot *slot,
int
numIndices
;
Oid
newId
;
/*
----------------
/*
*****************
* get the heap tuple out of the tuple table slot
*
----------------
*
*****************
*/
tuple
=
slot
->
val
;
/*
----------------
/*
*****************
* get information on the result relation
*
----------------
*
*****************
*/
resultRelationInfo
=
estate
->
es_result_relation_info
;
resultRelationDesc
=
resultRelationInfo
->
ri_RelationDesc
;
/*
----------------
/*
*****************
* have to add code to preform unique checking here.
* cim -12/1/89
*
----------------
*
*****************
*/
/* BEFORE ROW INSERT Triggers */
...
...
@@ -976,9 +976,9 @@ ExecAppend(TupleTableSlot *slot,
}
}
/*
----------------
/*
*****************
* Check the constraints of a tuple
*
----------------
*
*****************
*/
if
(
resultRelationDesc
->
rd_att
->
constr
)
...
...
@@ -995,21 +995,21 @@ ExecAppend(TupleTableSlot *slot,
}
}
/*
----------------
/*
*****************
* insert the tuple
*
----------------
*
*****************
*/
newId
=
heap_insert
(
resultRelationDesc
,
/* relation desc */
tuple
);
/* heap tuple */
IncrAppended
();
/*
----------------
/*
*****************
* process indices
*
* Note: heap_insert adds a new tuple to a relation. As a side
* effect, the tupleid of the new tuple is placed in the new
* tuple's t_ctid field.
*
----------------
*
*****************
*/
numIndices
=
resultRelationInfo
->
ri_NumIndices
;
if
(
numIndices
>
0
)
...
...
@@ -1038,9 +1038,9 @@ ExecDelete(TupleTableSlot *slot,
RelationInfo
*
resultRelationInfo
;
Relation
resultRelationDesc
;
/*
----------------
/*
*****************
* get the result relation information
*
----------------
*
*****************
*/
resultRelationInfo
=
estate
->
es_result_relation_info
;
resultRelationDesc
=
resultRelationInfo
->
ri_RelationDesc
;
...
...
@@ -1057,9 +1057,9 @@ ExecDelete(TupleTableSlot *slot,
return
;
}
/*
----------------
/*
*****************
* delete the tuple
*
----------------
*
*****************
*/
if
(
heap_delete
(
resultRelationDesc
,
/* relation desc */
tupleid
))
/* item pointer to tuple */
...
...
@@ -1068,7 +1068,7 @@ ExecDelete(TupleTableSlot *slot,
IncrDeleted
();
(
estate
->
es_processed
)
++
;
/*
----------------
/*
*****************
* Note: Normally one would think that we have to
* delete index tuples associated with the
* heap tuple now..
...
...
@@ -1077,7 +1077,7 @@ ExecDelete(TupleTableSlot *slot,
* because the vacuum daemon automatically
* opens an index scan and deletes index tuples
* when it finds deleted heap tuples. -cim 9/27/89
*
----------------
*
*****************
*/
/* AFTER ROW DELETE Triggers */
...
...
@@ -1109,9 +1109,9 @@ ExecReplace(TupleTableSlot *slot,
Relation
resultRelationDesc
;
int
numIndices
;
/*
----------------
/*
*****************
* abort the operation if not running transactions
*
----------------
*
*****************
*/
if
(
IsBootstrapProcessingMode
())
{
...
...
@@ -1119,25 +1119,25 @@ ExecReplace(TupleTableSlot *slot,
return
;
}
/*
----------------
/*
*****************
* get the heap tuple out of the tuple table slot
*
----------------
*
*****************
*/
tuple
=
slot
->
val
;
/*
----------------
/*
*****************
* get the result relation information
*
----------------
*
*****************
*/
resultRelationInfo
=
estate
->
es_result_relation_info
;
resultRelationDesc
=
resultRelationInfo
->
ri_RelationDesc
;
/*
----------------
/*
*****************
* have to add code to preform unique checking here.
* in the event of unique tuples, this becomes a deletion
* of the original tuple affected by the replace.
* cim -12/1/89
*
----------------
*
*****************
*/
/* BEFORE ROW UPDATE Triggers */
...
...
@@ -1159,9 +1159,9 @@ ExecReplace(TupleTableSlot *slot,
}
}
/*
----------------
/*
*****************
* Check the constraints of a tuple
*
----------------
*
*****************
*/
if
(
resultRelationDesc
->
rd_att
->
constr
)
...
...
@@ -1178,13 +1178,13 @@ ExecReplace(TupleTableSlot *slot,
}
}
/*
----------------
/*
*****************
* replace the heap tuple
*
* Don't want to continue if our heap_replace didn't actually
* do a replace. This would be the case if heap_replace
* detected a non-functional update. -kw 12/30/93
*
----------------
*
*****************
*/
if
(
heap_replace
(
resultRelationDesc
,
/* relation desc */
tupleid
,
/* item ptr of tuple to replace */
...
...
@@ -1196,7 +1196,7 @@ ExecReplace(TupleTableSlot *slot,
IncrReplaced
();
(
estate
->
es_processed
)
++
;
/*
----------------
/*
*****************
* Note: instead of having to update the old index tuples
* associated with the heap tuple, all we do is form
* and insert new index tuples.. This is because
...
...
@@ -1204,10 +1204,10 @@ ExecReplace(TupleTableSlot *slot,
* index tuple deletion is done automagically by
* the vaccuum deamon.. All we do is insert new
* index tuples. -cim 9/27/89
*
----------------
*
*****************
*/
/*
----------------
/*
*****************
* process indices
*
* heap_replace updates a tuple in the base relation by invalidating
...
...
@@ -1215,7 +1215,7 @@ ExecReplace(TupleTableSlot *slot,
* effect, the tupleid of the new tuple is placed in the new
* tuple's t_ctid field. So we now insert index tuples using
* the new tupleid stored there.
*
----------------
*
*****************
*/
numIndices
=
resultRelationInfo
->
ri_NumIndices
;
...
...
src/backend/executor/execQual.c
浏览文件 @
4327a367
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.3
6 1998/09/01 04:28:18 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.3
7 1998/09/25 13:38:31 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -53,9 +53,9 @@
#include "utils/memutils.h"
/*
----------------
/*
*****************
* externs and constants
*
----------------
*
*****************
*/
/*
...
...
@@ -84,15 +84,14 @@ static Datum ExecMakeFunctionResult(Node *node, List *arguments,
ExprContext
*
econtext
,
bool
*
isNull
,
bool
*
isDone
);
static
bool
ExecQualClause
(
Node
*
clause
,
ExprContext
*
econtext
);
/*
--------------------------------
/*
*****************
* ExecEvalArrayRef
*
* This function takes an ArrayRef and returns a Const Node if it
* is an array reference or returns the changed Array Node if it is
* an array assignment.
*
* --------------------------------
*/
******************/
static
Datum
ExecEvalArrayRef
(
ArrayRef
*
arrayRef
,
ExprContext
*
econtext
,
...
...
@@ -234,9 +233,9 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
bool
byval
;
int16
len
;
/*
----------------
/*
*****************
* get the slot we want
*
----------------
*
*****************
*/
switch
(
variable
->
varno
)
{
...
...
@@ -254,9 +253,9 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
break
;
}
/*
----------------
/*
*****************
* extract tuple information from the slot
*
----------------
*
*****************
*/
heapTuple
=
slot
->
val
;
tuple_type
=
slot
->
ttc_tupleDescriptor
;
...
...
@@ -303,14 +302,14 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
tuple_type
,
/* tuple descriptor of tuple */
isNull
);
/* return: is attribute null? */
/*
----------------
/*
*****************
* return null if att is null
*
----------------
*
*****************
*/
if
(
*
isNull
)
return
(
Datum
)
NULL
;
/*
----------------
/*
*****************
* get length and type information..
* ??? what should we do about variable length attributes
* - variable length attributes have their length stored
...
...
@@ -318,15 +317,15 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
* returned value.. If we can determine that the type
* is a variable length type, we can do the right thing.
* -cim 9/15/89
*
----------------
*
*****************
*/
if
(
attnum
<
0
)
{
/*
----------------
/*
*****************
* If this is a pseudo-att, we get the type and fake the length.
* There ought to be a routine to return the real lengths, so
* we'll mark this one ... XXX -mao
*
----------------
*
*****************
*/
len
=
heap_sysattrlen
(
attnum
);
/* XXX see -mao above */
byval
=
heap_sysattrbyval
(
attnum
);
/* XXX see -mao above */
...
...
@@ -491,7 +490,7 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
* ----------------------------------------------------------------
*/
/*
----------------
/*
*****************
* GetAttributeByName
* GetAttributeByNum
*
...
...
@@ -499,7 +498,7 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
* named attribute out of the tuple from the arg slot. User defined
* C functions which take a tuple as an argument are expected
* to use this. Ex: overpaid(EMP) might call GetAttributeByNum().
*
----------------
*
*****************
*/
/* static but gets called from external functions */
char
*
...
...
@@ -621,12 +620,12 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
i
=
0
;
foreach
(
arg
,
argList
)
{
/*
----------------
/*
*****************
* evaluate the expression, in general functions cannot take
* sets as arguments but we make an exception in the case of
* nested dot expressions. We have to watch out for this case
* here.
*
----------------
*
*****************
*/
argV
[
i
]
=
(
Datum
)
ExecEvalExpr
((
Node
*
)
lfirst
(
arg
),
...
...
@@ -649,9 +648,9 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
}
}
/*
----------------
/*
*****************
* ExecMakeFunctionResult
*
----------------
*
*****************
*/
static
Datum
ExecMakeFunctionResult
(
Node
*
node
,
...
...
@@ -684,12 +683,12 @@ ExecMakeFunctionResult(Node *node,
fcache
=
operNode
->
op_fcache
;
}
/*
----------------
/*
*****************
* arguments is a list of expressions to evaluate
* before passing to the function manager.
* We collect the results of evaluating the expressions
* into a datum array (argV) and pass this array to arrayFmgr()
*
----------------
*
*****************
*/
if
(
fcache
->
nargs
!=
0
)
{
...
...
@@ -757,10 +756,10 @@ ExecMakeFunctionResult(Node *node,
}
}
/*
----------------
/*
*****************
* now return the value gotten by calling the function manager,
* passing the function the evaluated parameter values.
*
----------------
*
*****************
*/
if
(
fcache
->
language
==
SQLlanguageId
)
{
...
...
@@ -858,14 +857,14 @@ ExecEvalOper(Expr *opClause, ExprContext *econtext, bool *isNull)
FunctionCachePtr
fcache
;
bool
isDone
;
/*
----------------
/*
*****************
* an opclause is a list (op args). (I think)
*
* we extract the oid of the function associated with
* the op and then pass the work onto ExecMakeFunctionResult
* which evaluates the arguments and returns the result of
* calling the function on the evaluated arguments.
*
----------------
*
*****************
*/
op
=
(
Oper
*
)
opClause
->
oper
;
argList
=
opClause
->
args
;
...
...
@@ -881,10 +880,10 @@ ExecEvalOper(Expr *opClause, ExprContext *econtext, bool *isNull)
fcache
=
op
->
op_fcache
;
}
/*
-----------
/*
*****************
* call ExecMakeFunctionResult() with a dummy isDone that we ignore.
* We don't have operator whose arguments are sets.
*
-----------
*
*****************
*/
return
ExecMakeFunctionResult
((
Node
*
)
op
,
argList
,
econtext
,
isNull
,
&
isDone
);
...
...
@@ -905,7 +904,7 @@ ExecEvalFunc(Expr *funcClause,
List
*
argList
;
FunctionCachePtr
fcache
;
/*
----------------
/*
*****************
* an funcclause is a list (func args). (I think)
*
* we extract the oid of the function associated with
...
...
@@ -914,7 +913,7 @@ ExecEvalFunc(Expr *funcClause,
* calling the function on the evaluated arguments.
*
* this is nearly identical to the ExecEvalOper code.
*
----------------
*
*****************
*/
func
=
(
Func
*
)
funcClause
->
oper
;
argList
=
funcClause
->
args
;
...
...
@@ -959,25 +958,25 @@ ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull)
clause
=
lfirst
(
notclause
->
args
);
/*
----------------
/*
*****************
* We don't iterate over sets in the quals, so pass in an isDone
* flag, but ignore it.
*
----------------
*
*****************
*/
expr_value
=
ExecEvalExpr
(
clause
,
econtext
,
isNull
,
&
isDone
);
/*
----------------
/*
*****************
* if the expression evaluates to null, then we just
* cascade the null back to whoever called us.
*
----------------
*
*****************
*/
if
(
*
isNull
)
return
expr_value
;
/*
----------------
/*
*****************
* evaluation of 'not' is simple.. expr is false, then
* return 'true' and vice versa.
*
----------------
*
*****************
*/
if
(
DatumGetInt32
(
expr_value
)
==
0
)
return
(
Datum
)
true
;
...
...
@@ -1001,7 +1000,7 @@ ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull)
IsNull
=
false
;
clauses
=
orExpr
->
args
;
/*
----------------
/*
*****************
* we use three valued logic functions here...
* we evaluate each of the clauses in turn,
* as soon as one is true we return that
...
...
@@ -1011,51 +1010,52 @@ ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull)
* should be false) with *isNull set to false else
* if none is true and at least one clause evaluated
* to NULL we set *isNull flag to true -
*
----------------
*
*****************
*/
foreach
(
clause
,
clauses
)
{
/*
----------------
/*
*****************
* We don't iterate over sets in the quals, so pass in an isDone
* flag, but ignore it.
*
----------------
*
*****************
*/
const_value
=
ExecEvalExpr
((
Node
*
)
lfirst
(
clause
),
econtext
,
isNull
,
&
isDone
);
/*
----------------
/*
*****************
* if the expression evaluates to null, then we
* remember it in the local IsNull flag, if none of the
* clauses are true then we need to set *isNull
* to true again.
*
----------------
*
*****************
*/
if
(
*
isNull
)
{
IsNull
=
*
isNull
;
/*
* Many functions don't (or can't!) check i
s an argument
NULL
/*
************
* Many functions don't (or can't!) check i
f an argument is
NULL
* or NOT_NULL and may return TRUE (1) with *isNull TRUE
* (an_int4_column <> 1: int4ne returns TRUE for NULLs). Not
* having time to fix function manager I want to fix OR: if we
* had 'x <> 1 OR x isnull' then TRUE, TRUE were returned by
* 'x <> 1' for NULL ... but ExecQualClause say that
* qualification *fails* if isnull is TRUE for all values
* returned by ExecEvalExpr. So, force this rule here: if
* isnull is TRUE then clause failed. Note: nullvalue() &
* nonnullvalue() always set isnull to FALSE for NULLs. -
* vadim 09/22/97
*/
* (an_int4_column <> 1: int4ne returns TRUE for NULLs).
* Not having time to fix the function manager I want to fix OR:
* if we had 'x <> 1 OR x isnull' then when x is NULL
* TRUE was returned by the 'x <> 1' clause ...
* but ExecQualClause says that the qualification should *fail*
* if isnull is TRUE for any value returned by ExecEvalExpr.
* So, force this rule here:
* if isnull is TRUE then the clause failed.
* Note: nullvalue() & nonnullvalue() always sets isnull to FALSE for NULLs.
* - vadim 09/22/97
*************/
const_value
=
0
;
}
/*
----------------
/*
*****************
* if we have a true result, then we return it.
*
----------------
*
*****************
*/
if
(
DatumGetInt32
(
const_value
)
!=
0
)
return
const_value
;
...
...
@@ -1083,41 +1083,41 @@ ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull)
clauses
=
andExpr
->
args
;
/*
----------------
/*
*****************
* we evaluate each of the clauses in turn,
* as soon as one is false we return that
* value. If none are false or NULL then we return
* the value of the last clause evaluated, which
* should be true.
*
----------------
*
*****************
*/
foreach
(
clause
,
clauses
)
{
/*
----------------
/*
*****************
* We don't iterate over sets in the quals, so pass in an isDone
* flag, but ignore it.
*
----------------
*
*****************
*/
const_value
=
ExecEvalExpr
((
Node
*
)
lfirst
(
clause
),
econtext
,
isNull
,
&
isDone
);
/*
----------------
/*
*****************
* if the expression evaluates to null, then we
* remember it in IsNull, if none of the clauses after
* this evaluates to false we will have to set *isNull
* to true again.
*
----------------
*
*****************
*/
if
(
*
isNull
)
IsNull
=
*
isNull
;
/*
----------------
/*
*****************
* if we have a false result, then we return it, since the
* conjunction must be false.
*
----------------
*
*****************
*/
if
(
DatumGetInt32
(
const_value
)
==
0
)
return
const_value
;
...
...
@@ -1164,10 +1164,10 @@ ExecEvalExpr(Node *expression,
if
(
isDone
)
*
isDone
=
true
;
/*
----------------
/*
*****************
* here we dispatch the work to the appropriate type
* of function given the type of our expression.
*
----------------
*
*****************
*/
if
(
expression
==
NULL
)
{
...
...
@@ -1281,19 +1281,19 @@ ExecQualClause(Node *clause, ExprContext *econtext)
expr_value
=
(
Datum
)
ExecEvalExpr
(
clause
,
econtext
,
&
isNull
,
&
isDone
);
/*
----------------
/*
*****************
* this is interesting behaviour here. When a clause evaluates
* to null, then we consider this as passing the qualification.
* it seems kind of like, if the qual is NULL, then there's no
* qual..
*
----------------
*
*****************
*/
if
(
isNull
)
return
true
;
/*
----------------
/*
*****************
* remember, we return true when the qualification fails..
*
----------------
*
*****************
*/
if
(
DatumGetInt32
(
expr_value
)
==
0
)
return
true
;
...
...
@@ -1314,9 +1314,9 @@ ExecQual(List *qual, ExprContext *econtext)
List
*
clause
;
bool
result
;
/*
----------------
/*
*****************
* debugging stuff
*
----------------
*
*****************
*/
EV_printf
(
"ExecQual: qual is "
);
EV_nodeDisplay
(
qual
);
...
...
@@ -1324,21 +1324,21 @@ ExecQual(List *qual, ExprContext *econtext)
IncrProcessed
();
/*
----------------
/*
*****************
* return true immediately if no qual
*
----------------
*
*****************
*/
if
(
qual
==
NIL
)
return
true
;
/*
----------------
/*
*****************
* a "qual" is a list of clauses. To evaluate the
* qual, we evaluate each of the clauses in the list.
*
* ExecQualClause returns true when we know the qualification
* *failed* so we just pass each clause in qual to it until
* we know the qual failed or there are no more clauses.
*
----------------
*
*****************
*/
result
=
false
;
...
...
@@ -1349,11 +1349,11 @@ ExecQual(List *qual, ExprContext *econtext)
break
;
}
/*
----------------
/*
*****************
* if result is true, then it means a clause failed so we
* return false. if result is false then it means no clause
* failed so we return true.
*
----------------
*
*****************
*/
if
(
result
==
true
)
return
false
;
...
...
@@ -1409,23 +1409,23 @@ ExecTargetList(List *targetlist,
HeapTuple
newTuple
;
bool
isNull
;
/*
----------------
/*
*****************
* debugging stuff
*
----------------
*
*****************
*/
EV_printf
(
"ExecTargetList: tl is "
);
EV_nodeDisplay
(
targetlist
);
EV_printf
(
"
\n
"
);
/*
----------------
/*
*****************
* Return a dummy tuple if the targetlist is empty .
* the dummy tuple is necessary to differentiate
* between passing and failing the qualification.
*
----------------
*
*****************
*/
if
(
targetlist
==
NIL
)
{
/*
----------------
/*
*****************
* I now think that the only time this makes
* any sence is when we run a delete query. Then
* we need to return something other than nil
...
...
@@ -1439,18 +1439,18 @@ ExecTargetList(List *targetlist,
* is this a new phenomenon? it might cause bogus behavior
* if we try to free this tuple later!! I put a hook in
* ExecProject to watch out for this case -mer 24 Aug 1992
*
----------------
*
*****************
*/
CXT1_printf
(
"ExecTargetList: context is %d
\n
"
,
CurrentMemoryContext
);
*
isDone
=
true
;
return
(
HeapTuple
)
true
;
}
/*
----------------
/*
*****************
* allocate an array of char's to hold the "null" information
* only if we have a really large targetlist. otherwise we use
* the stack.
*
----------------
*
*****************
*/
if
(
nodomains
>
64
)
{
...
...
@@ -1463,23 +1463,23 @@ ExecTargetList(List *targetlist,
fjIsNull
=
&
fjNullArray
[
0
];
}
/*
----------------
/*
*****************
* evaluate all the expressions in the target list
*
----------------
*
*****************
*/
EV_printf
(
"ExecTargetList: setting target list values
\n
"
);
*
isDone
=
true
;
foreach
(
tl
,
targetlist
)
{
/*
----------------
/*
*****************
* remember, a target list is a list of lists:
*
* ((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...)
*
* tl is a pointer to successive cdr's of the targetlist
* tle is a pointer to the target list entry in tl
*
----------------
*
*****************
*/
tle
=
lfirst
(
tl
);
...
...
@@ -1553,16 +1553,16 @@ ExecTargetList(List *targetlist,
}
}
/*
----------------
/*
*****************
* form the new result tuple (in the "normal" context)
*
----------------
*
*****************
*/
newTuple
=
(
HeapTuple
)
heap_formtuple
(
targettype
,
values
,
null_head
);
/*
----------------
/*
*****************
* free the nulls array if we allocated one..
*
----------------
*
*****************
*/
if
(
nodomains
>
64
)
pfree
(
null_head
);
...
...
@@ -1595,16 +1595,16 @@ ExecProject(ProjectionInfo *projInfo, bool *isDone)
ExprContext
*
econtext
;
HeapTuple
newTuple
;
/*
----------------
/*
*****************
* sanity checks
*
----------------
*
*****************
*/
if
(
projInfo
==
NULL
)
return
(
TupleTableSlot
*
)
NULL
;
/*
----------------
/*
*****************
* get the projection info we want
*
----------------
*
*****************
*/
slot
=
projInfo
->
pi_slot
;
targetlist
=
projInfo
->
pi_targetlist
;
...
...
@@ -1620,9 +1620,9 @@ ExecProject(ProjectionInfo *projInfo, bool *isDone)
return
(
TupleTableSlot
*
)
NULL
;
}
/*
----------------
/*
*****************
* form a new (result) tuple
*
----------------
*
*****************
*/
newTuple
=
ExecTargetList
(
targetlist
,
len
,
...
...
@@ -1631,13 +1631,13 @@ ExecProject(ProjectionInfo *projInfo, bool *isDone)
econtext
,
isDone
);
/*
----------------
/*
*****************
* store the tuple in the projection slot and return the slot.
*
* If there's no projection target list we don't want to pfree
* the bogus tuple that ExecTargetList passes back to us.
* -mer 24 Aug 1992
*
----------------
*
*****************
*/
return
(
TupleTableSlot
*
)
ExecStoreTuple
(
newTuple
,
/* tuple to store */
...
...
src/backend/executor/nodeSeqscan.c
浏览文件 @
4327a367
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.1
4 1998/09/01 04:28:37 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.1
5 1998/09/25 13:38:32 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,6 +29,7 @@
#include "executor/nodeSeqscan.h"
#include "access/heapam.h"
#include "parser/parsetree.h"
#include "nodes/print.h"
static
Oid
InitScanRelation
(
SeqScan
*
node
,
EState
*
estate
,
CommonScanState
*
scanstate
,
Plan
*
outerPlan
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录