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

Commitf893ee2

Browse files
committed
Remove unused constisset and constiscast fields of Const nodes. Clean
up code and documentation associated with Param nodes.
1 parentdbe100c commitf893ee2

File tree

22 files changed

+159
-248
lines changed

22 files changed

+159
-248
lines changed

‎src/backend/commands/copy.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.181 2002/11/23 03:59:07 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.182 2002/11/25 21:29:34 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -860,9 +860,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
860860
attr[i]->attlen,
861861
(Datum)0,
862862
true,/* is null */
863-
attr[i]->attbyval,
864-
false,/* not a set */
865-
false);/* not coerced */
863+
attr[i]->attbyval);
866864

867865
node=coerce_type_constraints((Node*)con,attr[i]->atttypid,
868866
COERCE_IMPLICIT_CAST);

‎src/backend/executor/execQual.c

Lines changed: 52 additions & 86 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.109 2002/11/15 02:50:06 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.110 2002/11/25 21:29:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -392,123 +392,89 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
392392
*Returns the value of a parameter. A param node contains
393393
*something like ($.name) and the expression context contains
394394
*the current parameter bindings (name = "sam") (age = 34)...
395-
*so our job is to replace the param node with the datum
396-
*containing the appropriate information ("sam").
395+
*so our job is to find and return the appropriate datum ("sam").
397396
*
398397
*Q: if we have a parameter ($.foo) without a binding, i.e.
399398
* there is no (foo = xxx) in the parameter list info,
400399
* is this a fatal error or should this be a "not available"
401-
* (in which case we shoud return a Const node with the
402-
*isnull flag) ?-cim 10/13/89
403-
*
404-
*Minor modification: Param nodes now have an extra field,
405-
*`paramkind' which specifies the type of parameter
406-
*(see params.h). So while searching the paramList for
407-
*a paramname/value pair, we have also to check for `kind'.
408-
*
409-
*NOTE: The last entry in `paramList' is always an
410-
*entry with kind == PARAM_INVALID.
400+
* (in which case we could return NULL)?-cim 10/13/89
411401
* ----------------------------------------------------------------
412402
*/
413403
Datum
414404
ExecEvalParam(Param*expression,ExprContext*econtext,bool*isNull)
415405
{
416-
char*thisParameterName;
417-
intthisParameterKind=expression->paramkind;
418-
AttrNumberthisParameterId=expression->paramid;
419-
intmatchFound;
420-
ParamListInfoparamList;
406+
intthisParamKind=expression->paramkind;
407+
AttrNumberthisParamId=expression->paramid;
421408

422-
if (thisParameterKind==PARAM_EXEC)
409+
if (thisParamKind==PARAM_EXEC)
423410
{
411+
/*
412+
* PARAM_EXEC params (internal executor parameters) are stored in
413+
* the ecxt_param_exec_vals array, and can be accessed by array index.
414+
*/
424415
ParamExecData*prm;
425416

426-
prm=&(econtext->ecxt_param_exec_vals[thisParameterId]);
417+
prm=&(econtext->ecxt_param_exec_vals[thisParamId]);
427418
if (prm->execPlan!=NULL)
428419
{
420+
/* Parameter not evaluated yet, so go do it */
429421
ExecSetParamPlan(prm->execPlan,econtext);
430422
/* ExecSetParamPlan should have processed this param... */
431423
Assert(prm->execPlan==NULL);
432424
}
433425
*isNull=prm->isnull;
434426
returnprm->value;
435427
}
436-
437-
thisParameterName=expression->paramname;
438-
paramList=econtext->ecxt_param_list_info;
439-
440-
*isNull= false;
441-
442-
/*
443-
* search the list with the parameter info to find a matching name. An
444-
* entry with an InvalidName denotes the last element in the array.
445-
*/
446-
matchFound=0;
447-
if (paramList!=NULL)
428+
else
448429
{
449430
/*
450-
* search for an entry in 'paramList' that matches the
451-
* `expression'.
431+
* All other parameter types must be sought in ecxt_param_list_info.
432+
* NOTE: The last entry in the param array is always an
433+
* entry with kind == PARAM_INVALID.
452434
*/
453-
while (paramList->kind!=PARAM_INVALID&& !matchFound)
435+
ParamListInfoparamList=econtext->ecxt_param_list_info;
436+
char*thisParamName=expression->paramname;
437+
boolmatchFound= false;
438+
439+
if (paramList!=NULL)
454440
{
455-
switch (thisParameterKind)
441+
while (paramList->kind!=PARAM_INVALID&& !matchFound)
456442
{
457-
casePARAM_NAMED:
458-
if (thisParameterKind==paramList->kind&&
459-
strcmp(paramList->name,thisParameterName)==0)
460-
matchFound=1;
461-
break;
462-
casePARAM_NUM:
463-
if (thisParameterKind==paramList->kind&&
464-
paramList->id==thisParameterId)
465-
matchFound=1;
466-
break;
467-
casePARAM_OLD:
468-
casePARAM_NEW:
469-
if (thisParameterKind==paramList->kind&&
470-
paramList->id==thisParameterId)
443+
if (thisParamKind==paramList->kind)
444+
{
445+
switch (thisParamKind)
471446
{
472-
matchFound=1;
473-
474-
/*
475-
* sanity check
476-
*/
477-
if (strcmp(paramList->name,thisParameterName)!=0)
478-
{
479-
elog(ERROR,
480-
"ExecEvalParam: new/old params with same id & diff names");
481-
}
447+
casePARAM_NAMED:
448+
if (strcmp(paramList->name,thisParamName)==0)
449+
matchFound= true;
450+
break;
451+
casePARAM_NUM:
452+
if (paramList->id==thisParamId)
453+
matchFound= true;
454+
break;
455+
default:
456+
elog(ERROR,"ExecEvalParam: invalid paramkind %d",
457+
thisParamKind);
482458
}
483-
break;
484-
default:
459+
}
460+
if (!matchFound)
461+
paramList++;
462+
}/* while */
463+
}/* if */
485464

486-
/*
487-
* oops! this is not supposed to happen!
488-
*/
489-
elog(ERROR,"ExecEvalParam: invalid paramkind %d",
490-
thisParameterKind);
491-
}
492-
if (!matchFound)
493-
paramList++;
494-
}/* while */
495-
}/* if */
465+
if (!matchFound)
466+
{
467+
if (thisParamKind==PARAM_NAMED)
468+
elog(ERROR,"ExecEvalParam: Unknown value for parameter %s",
469+
thisParamName);
470+
else
471+
elog(ERROR,"ExecEvalParam: Unknown value for parameter %d",
472+
thisParamId);
473+
}
496474

497-
if (!matchFound)
498-
{
499-
/*
500-
* ooops! we couldn't find this parameter in the parameter list.
501-
* Signal an error
502-
*/
503-
elog(ERROR,"ExecEvalParam: Unknown value for parameter %s",
504-
thisParameterName);
475+
*isNull=paramList->isnull;
476+
returnparamList->value;
505477
}
506-
507-
/*
508-
* return the value.
509-
*/
510-
*isNull=paramList->isnull;
511-
returnparamList->value;
512478
}
513479

514480

‎src/backend/nodes/copyfuncs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.222 2002/11/2503:33:27 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.223 2002/11/2521:29:36 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -769,8 +769,6 @@ _copyConst(Const *from)
769769

770770
COPY_SCALAR_FIELD(constisnull);
771771
COPY_SCALAR_FIELD(constbyval);
772-
COPY_SCALAR_FIELD(constisset);
773-
COPY_SCALAR_FIELD(constiscast);
774772

775773
returnnewnode;
776774
}

‎src/backend/nodes/equalfuncs.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Portions Copyright (c) 1994, Regents of the University of California
2121
*
2222
* IDENTIFICATION
23-
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.168 2002/11/2503:33:27 tgl Exp $
23+
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.169 2002/11/2521:29:36 tgl Exp $
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -190,7 +190,6 @@ _equalConst(Const *a, Const *b)
190190
COMPARE_SCALAR_FIELD(constlen);
191191
COMPARE_SCALAR_FIELD(constisnull);
192192
COMPARE_SCALAR_FIELD(constbyval);
193-
/* XXX What about constisset and constiscast? */
194193

195194
/*
196195
* We treat all NULL constants of the same type as equal. Someday this
@@ -212,19 +211,12 @@ _equalParam(Param *a, Param *b)
212211
switch (a->paramkind)
213212
{
214213
casePARAM_NAMED:
215-
casePARAM_NEW:
216-
casePARAM_OLD:
217214
COMPARE_STRING_FIELD(paramname);
218215
break;
219216
casePARAM_NUM:
220217
casePARAM_EXEC:
221218
COMPARE_SCALAR_FIELD(paramid);
222219
break;
223-
casePARAM_INVALID:
224-
/*
225-
* XXX: Hmmm... What are we supposed to return in this case ??
226-
*/
227-
break;
228220
default:
229221
elog(ERROR,"_equalParam: Invalid paramkind value: %d",
230222
a->paramkind);

‎src/backend/nodes/makefuncs.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.35 2002/09/18 21:35:21 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.36 2002/11/25 21:29:36 tgl Exp $
1212
*/
1313
#include"postgres.h"
1414

@@ -157,9 +157,7 @@ makeConst(Oid consttype,
157157
intconstlen,
158158
Datumconstvalue,
159159
boolconstisnull,
160-
boolconstbyval,
161-
boolconstisset,
162-
boolconstiscast)
160+
boolconstbyval)
163161
{
164162
Const*cnst=makeNode(Const);
165163

@@ -168,8 +166,7 @@ makeConst(Oid consttype,
168166
cnst->constvalue=constvalue;
169167
cnst->constisnull=constisnull;
170168
cnst->constbyval=constbyval;
171-
cnst->constisset=constisset;
172-
cnst->constiscast=constiscast;
169+
173170
returncnst;
174171
}
175172

@@ -188,9 +185,7 @@ makeNullConst(Oid consttype)
188185
(int)typLen,
189186
(Datum)0,
190187
true,
191-
typByVal,
192-
false,
193-
false);
188+
typByVal);
194189
}
195190

196191
/*

‎src/backend/nodes/outfuncs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.182 2002/11/2518:12:09 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.183 2002/11/2521:29:36 tgl Exp $
1212
*
1313
* NOTES
1414
* Every node type that can appear in stored rules' parsetrees *must*
@@ -735,7 +735,6 @@ _outConst(StringInfo str, Const *node)
735735
WRITE_INT_FIELD(constlen);
736736
WRITE_BOOL_FIELD(constbyval);
737737
WRITE_BOOL_FIELD(constisnull);
738-
/* XXX what about constisset, constiscast? */
739738

740739
appendStringInfo(str," :constvalue ");
741740
if (node->constisnull)

‎src/backend/nodes/readfuncs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.139 2002/11/2518:12:10 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.140 2002/11/2521:29:38 tgl Exp $
1212
*
1313
* NOTES
1414
* Path and Plan nodes do not have any readfuncs support, because we
@@ -390,7 +390,6 @@ _readConst(void)
390390
READ_INT_FIELD(constlen);
391391
READ_BOOL_FIELD(constbyval);
392392
READ_BOOL_FIELD(constisnull);
393-
/* XXX what about constisset, constiscast? */
394393

395394
token=pg_strtok(&length);/* skip :constvalue */
396395
if (local_node->constisnull)

‎src/backend/optimizer/path/clausesel.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.52 2002/10/19 02:56:16 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.53 2002/11/25 21:29:39 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,8 +29,7 @@
2929

3030
/* note that pg_type.h hardwires size of bool as 1 ... duplicate it */
3131
#defineMAKEBOOLCONST(val,isnull) \
32-
((Node *) makeConst(BOOLOID, 1, (Datum) (val), \
33-
(isnull), true, false, false))
32+
((Node *) makeConst(BOOLOID, 1, (Datum) (val), (isnull), true))
3433

3534

3635
/*

‎src/backend/optimizer/path/indxpath.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.125 2002/11/24 21:52:14 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.126 2002/11/25 21:29:39 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -2167,7 +2167,7 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
21672167
op=makeOper(opr1oid,InvalidOid,BOOLOID, false);
21682168
expr=make_opclause(op,leftop,
21692169
(Var*)makeConst(datatype,-1,opr1right,
2170-
false, false, false, false));
2170+
false, false));
21712171
result=makeList1(expr);
21722172

21732173
/* create clause "key <= network_scan_last( rightop )" */
@@ -2182,7 +2182,7 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
21822182
op=makeOper(opr2oid,InvalidOid,BOOLOID, false);
21832183
expr=make_opclause(op,leftop,
21842184
(Var*)makeConst(datatype,-1,opr2right,
2185-
false, false, false, false));
2185+
false, false));
21862186
result=lappend(result,expr);
21872187

21882188
returnresult;
@@ -2233,5 +2233,5 @@ string_to_const(const char *str, Oid datatype)
22332233
Datumconval=string_to_datum(str,datatype);
22342234

22352235
returnmakeConst(datatype, ((datatype==NAMEOID) ?NAMEDATALEN :-1),
2236-
conval, false, false, false, false);
2236+
conval, false, false);
22372237
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp