1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Remove 'func_tlist' from Func expression nodes, likewise 'param_tlist'

from Param nodes, per discussion a few days ago on pghackers.  Add new
expression node type FieldSelect that implements the functionality where
it's actually needed.  Clean up some other unused fields in Func nodes
as well.
NOTE: initdb forced due to change in stored expression trees for rules.
This commit is contained in:
Tom Lane
2000-08-08 15:43:12 +00:00
parent 8fc32374be
commit 62e29fe2e7
31 changed files with 378 additions and 476 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.91 2000/08/03 16:34:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.92 2000/08/08 15:41:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1339,9 +1339,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
*/
test_oper = makeOper(test_op, /* opno */
InvalidOid, /* opid */
BOOLOID, /* opresulttype */
0, /* opsize */
NULL); /* op_fcache */
BOOLOID); /* opresulttype */
replace_opid(test_oper);
test_expr = make_opclause(test_oper,
@ -1934,7 +1932,7 @@ prefix_quals(Var *leftop, Oid expr_op,
if (oproid == InvalidOid)
elog(ERROR, "prefix_quals: no = operator for type %u", datatype);
con = string_to_const(prefix, datatype);
op = makeOper(oproid, InvalidOid, BOOLOID, 0, NULL);
op = makeOper(oproid, InvalidOid, BOOLOID);
expr = make_opclause(op, leftop, (Var *) con);
result = lcons(expr, NIL);
return result;
@ -1949,7 +1947,7 @@ prefix_quals(Var *leftop, Oid expr_op,
if (oproid == InvalidOid)
elog(ERROR, "prefix_quals: no >= operator for type %u", datatype);
con = string_to_const(prefix, datatype);
op = makeOper(oproid, InvalidOid, BOOLOID, 0, NULL);
op = makeOper(oproid, InvalidOid, BOOLOID);
expr = make_opclause(op, leftop, (Var *) con);
result = lcons(expr, NIL);
@ -1964,7 +1962,7 @@ prefix_quals(Var *leftop, Oid expr_op,
if (oproid == InvalidOid)
elog(ERROR, "prefix_quals: no < operator for type %u", datatype);
con = string_to_const(greaterstr, datatype);
op = makeOper(oproid, InvalidOid, BOOLOID, 0, NULL);
op = makeOper(oproid, InvalidOid, BOOLOID);
expr = make_opclause(op, leftop, (Var *) con);
result = lappend(result, expr);
pfree(greaterstr);

View File

@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.23 2000/07/24 03:10:56 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.24 2000/08/08 15:41:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -436,12 +436,7 @@ build_index_pathkeys(Query *root,
funcnode->funcid = index->indproc;
funcnode->functype = get_func_rettype(index->indproc);
funcnode->funcisindex = false;
funcnode->funcsize = 0;
funcnode->func_fcache = NULL;
/* we assume here that the function returns a base type... */
funcnode->func_tlist = setup_base_tlist(funcnode->functype);
funcnode->func_planlist = NIL;
while (*indexkeys != 0)
{

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.47 2000/07/24 03:11:01 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.48 2000/08/08 15:41:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -382,9 +382,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
clause->opType = OP_EXPR;
clause->oper = (Node *) makeOper(oprid(eq_operator), /* opno */
InvalidOid, /* opid */
BOOLOID, /* operator result type */
0,
NULL);
BOOLOID); /* operator result type */
clause->args = lcons(item1, lcons(item2, NIL));
add_restrict_and_join_to_rel(root, (Node *) clause);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.86 2000/07/27 23:15:57 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.87 2000/08/08 15:41:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -373,8 +373,6 @@ union_planner(Query *parse,
TIDOID,
-1,
resname,
0,
0,
true);
var = makeVar(rowmark->rti, -1, TIDOID, -1, 0);
@ -761,8 +759,6 @@ make_subplanTargetList(Query *parse,
exprType(groupexpr),
exprTypmod(groupexpr),
NULL,
(Index) 0,
(Oid) 0,
false),
groupexpr);
sub_tlist = lappend(sub_tlist, te);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.26 2000/06/08 22:37:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.27 2000/08/08 15:41:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -504,8 +504,7 @@ push_nots(Expr *qual)
{
Oper *op = (Oper *) makeOper(negator,
InvalidOid,
oper->opresulttype,
0, NULL);
oper->opresulttype);
return make_opclause(op, get_leftop(qual), get_rightop(qual));
}

View File

@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.37 2000/07/22 06:19:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.38 2000/08/08 15:41:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -75,8 +75,6 @@ preprocess_targetlist(List *tlist,
TIDOID,
-1,
pstrdup("ctid"),
0,
0,
true);
var = makeVar(result_relation, SelfItemPointerAttributeNumber,
@ -219,8 +217,6 @@ expand_targetlist(List *tlist, int command_type,
atttype,
-1,
pstrdup(attrname),
0,
(Oid) 0,
false),
(Node *) temp_const);
break;
@ -251,8 +247,6 @@ expand_targetlist(List *tlist, int command_type,
atttype,
atttypmod,
pstrdup(attrname),
0,
(Oid) 0,
false),
(Node *) temp_var);
break;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.69 2000/07/12 02:37:11 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.70 2000/08/08 15:41:53 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -910,9 +910,7 @@ CommuteClause(Expr *clause)
commu = makeOper(heapTup->t_data->t_oid,
commuTup->oprcode,
commuTup->oprresult,
((Oper *) clause->oper)->opsize,
NULL);
commuTup->oprresult);
/*
* re-form the clause in-place!
@ -1596,6 +1594,8 @@ bool
return true;
}
break;
case T_FieldSelect:
return walker(((FieldSelect *) node)->arg, context);
case T_RelabelType:
return walker(((RelabelType *) node)->arg, context);
case T_CaseExpr:
@ -1824,6 +1824,16 @@ Node *
return (Node *) newnode;
}
break;
case T_FieldSelect:
{
FieldSelect *fselect = (FieldSelect *) node;
FieldSelect *newnode;
FLATCOPY(newnode, fselect, FieldSelect);
MUTATE(newnode->arg, fselect->arg, Node *);
return (Node *) newnode;
}
break;
case T_RelabelType:
{
RelabelType *relabel = (RelabelType *) node;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.46 2000/06/08 22:37:16 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.47 2000/08/08 15:41:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -110,8 +110,6 @@ create_tl_element(Var *var, int resdomno)
var->vartype,
var->vartypmod,
NULL,
(Index) 0,
(Oid) 0,
false),
(Node *) var);
}
@ -199,8 +197,6 @@ add_to_flat_tlist(List *tlist, List *vars)
var->vartype,
var->vartypmod,
NULL,
(Index) 0,
(Oid) 0,
false);
tlist = lappend(tlist,
makeTargetEntry(r, copyObject(var)));