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

Create a distinction between Lists of integers and Lists of OIDs, to get

rid of the assumption that sizeof(Oid)==sizeof(int).  This is one small
step towards someday supporting 8-byte OIDs.  For the moment, it doesn't
do much except get rid of a lot of unsightly casts.
This commit is contained in:
Tom Lane
2003-02-09 06:56:28 +00:00
parent 3646ab58b4
commit 39b7ec3309
34 changed files with 357 additions and 302 deletions

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.260 2003/01/17 03:25:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.261 2003/02/09 06:56:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1793,7 +1793,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
lefttl = leftmostQuery->targetList;
foreach(dtlist, sostmt->colTypes)
{
Oid colType = (Oid) lfirsti(dtlist);
Oid colType = lfirsto(dtlist);
Resdom *leftResdom = ((TargetEntry *) lfirst(lefttl))->resdom;
char *colName = pstrdup(leftResdom->resname);
Resdom *resdom;
@ -2030,13 +2030,13 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
op->colTypes = NIL;
while (lcoltypes != NIL)
{
Oid lcoltype = (Oid) lfirsti(lcoltypes);
Oid rcoltype = (Oid) lfirsti(rcoltypes);
Oid lcoltype = lfirsto(lcoltypes);
Oid rcoltype = lfirsto(rcoltypes);
Oid rescoltype;
rescoltype = select_common_type(makeListi2(lcoltype, rcoltype),
rescoltype = select_common_type(makeListo2(lcoltype, rcoltype),
context);
op->colTypes = lappendi(op->colTypes, rescoltype);
op->colTypes = lappendo(op->colTypes, rescoltype);
lcoltypes = lnext(lcoltypes);
rcoltypes = lnext(rcoltypes);
}
@ -2069,7 +2069,7 @@ getSetColTypes(ParseState *pstate, Node *node)
if (resnode->resjunk)
continue;
result = lappendi(result, resnode->restype);
result = lappendo(result, resnode->restype);
}
return result;
}
@ -2333,7 +2333,7 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
TypeName *tn = lfirst(l);
Oid toid = typenameTypeId(tn);
argtype_oids = lappendi(argtype_oids, toid);
argtype_oids = lappendo(argtype_oids, toid);
argtoids[i++] = toid;
}
}
@ -2400,7 +2400,7 @@ transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
elog(ERROR, "Cannot use aggregates in EXECUTE parameters");
given_type_id = exprType(expr);
expected_type_id = (Oid) lfirsti(paramtypes);
expected_type_id = lfirsto(paramtypes);
expr = coerce_to_target_type(expr, given_type_id,
expected_type_id, -1,
@ -2533,7 +2533,7 @@ relationHasPrimaryKey(Oid relationOid)
foreach(indexoidscan, indexoidlist)
{
Oid indexoid = lfirsti(indexoidscan);
Oid indexoid = lfirsto(indexoidscan);
HeapTuple indexTuple;
indexTuple = SearchSysCache(INDEXRELID,

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.399 2003/02/05 20:16:42 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.400 2003/02/09 06:56:28 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -2276,7 +2276,7 @@ DefineStmt:
case 3:
r->catalogname = strVal(lfirst($3));
r->schemaname = strVal(lsecond($3));
r->relname = strVal(lfirst(lnext(lnext($3))));
r->relname = strVal(lthird($3));
break;
default:
elog(ERROR,
@ -6857,7 +6857,7 @@ qualified_name:
case 3:
$$->catalogname = strVal(lfirst($1));
$$->schemaname = strVal(lsecond($1));
$$->relname = strVal(lfirst(lnext(lnext($1))));
$$->relname = strVal(lthird($1));
break;
default:
elog(ERROR,

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.104 2003/02/08 20:20:55 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.105 2003/02/09 06:56:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -854,7 +854,7 @@ buildMergedJoinVar(JoinType jointype, Var *l_colvar, Var *r_colvar)
outcoltypmod = l_colvar->vartypmod;
if (outcoltype != r_colvar->vartype)
{
outcoltype = select_common_type(makeListi2(l_colvar->vartype,
outcoltype = select_common_type(makeListo2(l_colvar->vartype,
r_colvar->vartype),
"JOIN/USING");
outcoltypmod = -1; /* ie, unknown */

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.92 2003/02/03 21:15:44 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.93 2003/02/09 06:56:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -553,7 +553,7 @@ coerce_to_boolean(Node *node, const char *constructName)
* This is used for determining the output type of CASE and UNION
* constructs.
*
* typeids is a nonempty integer list of type OIDs. Note that earlier items
* typeids is a nonempty list of type OIDs. Note that earlier items
* in the list will be preferred if there is doubt.
* 'context' is a phrase to use in the error message if we fail to select
* a usable type.
@ -566,11 +566,11 @@ select_common_type(List *typeids, const char *context)
List *l;
Assert(typeids != NIL);
ptype = (Oid) lfirsti(typeids);
ptype = lfirsto(typeids);
pcategory = TypeCategory(ptype);
foreach(l, lnext(typeids))
{
Oid ntype = (Oid) lfirsti(l);
Oid ntype = lfirsto(l);
/* move on to next one if no new information... */
if ((ntype != InvalidOid) && (ntype != UNKNOWNOID) && (ntype != ptype))

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.142 2003/02/03 21:15:44 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.143 2003/02/09 06:56:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -488,7 +488,7 @@ transformExpr(ParseState *pstate, Node *expr)
" to be used with quantified predicate subquery",
opname);
sublink->operOids = lappendi(sublink->operOids,
sublink->operOids = lappendo(sublink->operOids,
oprid(optup));
ReleaseSysCache(optup);
@ -554,7 +554,7 @@ transformExpr(ParseState *pstate, Node *expr)
neww->result = (Expr *) transformExpr(pstate, warg);
newargs = lappend(newargs, neww);
typeids = lappendi(typeids, exprType((Node *) neww->result));
typeids = lappendo(typeids, exprType((Node *) neww->result));
}
newc->args = newargs;
@ -583,7 +583,7 @@ transformExpr(ParseState *pstate, Node *expr)
* code worked before, but it seems a little bogus to me
* --- tgl
*/
typeids = lconsi(exprType((Node *) newc->defresult), typeids);
typeids = lconso(exprType((Node *) newc->defresult), typeids);
ptype = select_common_type(typeids, "CASE");
newc->casetype = ptype;
@ -830,7 +830,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
{
char *name1 = strVal(lfirst(cref->fields));
char *name2 = strVal(lsecond(cref->fields));
char *name3 = strVal(lfirst(lnext(lnext(cref->fields))));
char *name3 = strVal(lthird(cref->fields));
/* Whole-row reference? */
if (strcmp(name3, "*") == 0)
@ -863,8 +863,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
{
char *name1 = strVal(lfirst(cref->fields));
char *name2 = strVal(lsecond(cref->fields));
char *name3 = strVal(lfirst(lnext(lnext(cref->fields))));
char *name4 = strVal(lfirst(lnext(lnext(lnext(cref->fields)))));
char *name3 = strVal(lthird(cref->fields));
char *name4 = strVal(lfourth(cref->fields));
/*
* We check the catalog name and then ignore it.

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.143 2002/12/12 15:49:39 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.144 2003/02/09 06:56:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -972,7 +972,7 @@ find_inheritors(Oid relid, Oid **supervec)
* Use queue to do a breadth-first traversal of the inheritance graph
* from the relid supplied up to the root. At the top of the loop,
* relid is the OID of the reltype to check next, queue is the list of
* pending rels to check after this one, and visited is the list of
* pending relids to check after this one, and visited is the list of
* relids we need to output.
*/
do
@ -989,7 +989,7 @@ find_inheritors(Oid relid, Oid **supervec)
{
Form_pg_inherits inh = (Form_pg_inherits) GETSTRUCT(inhtup);
queue = lappendi(queue, inh->inhparent);
queue = lappendo(queue, inh->inhparent);
}
heap_endscan(inhscan);
@ -999,9 +999,9 @@ find_inheritors(Oid relid, Oid **supervec)
newrelid = false;
while (queue != NIL)
{
relid = lfirsti(queue);
relid = lfirsto(queue);
queue = lnext(queue);
if (!intMember(relid, visited))
if (!oidMember(relid, visited))
{
newrelid = true;
break;
@ -1010,7 +1010,7 @@ find_inheritors(Oid relid, Oid **supervec)
if (newrelid)
{
visited = lappendi(visited, relid);
visited = lappendo(visited, relid);
nvisited++;
}
} while (newrelid);
@ -1025,7 +1025,7 @@ find_inheritors(Oid relid, Oid **supervec)
foreach(elt, visited)
{
/* return the type id, rather than the relation id */
*relidvec++ = get_rel_type_id((Oid) lfirsti(elt));
*relidvec++ = get_rel_type_id(lfirsto(elt));
}
}
else

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.94 2002/12/12 20:35:13 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.95 2003/02/09 06:56:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -146,7 +146,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
if (strcmp(name1, DatabaseName) != 0)
elog(ERROR, "Cross-database references are not implemented");
schemaname = strVal(lsecond(fields));
relname = strVal(lfirst(lnext(lnext(fields))));
relname = strVal(lthird(fields));
break;
}
default:

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.50 2002/09/04 20:31:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.51 2003/02/09 06:56:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -67,13 +67,13 @@ LookupTypeName(const TypeName *typename)
case 3:
rel->schemaname = strVal(lfirst(typename->names));
rel->relname = strVal(lsecond(typename->names));
field = strVal(lfirst(lnext(lnext(typename->names))));
field = strVal(lthird(typename->names));
break;
case 4:
rel->catalogname = strVal(lfirst(typename->names));
rel->schemaname = strVal(lsecond(typename->names));
rel->relname = strVal(lfirst(lnext(lnext(typename->names))));
field = strVal(lfirst(lnext(lnext(lnext(typename->names)))));
rel->relname = strVal(lthird(typename->names));
field = strVal(lfourth(typename->names));
break;
default:
elog(ERROR, "Improper %%TYPE reference (too many dotted names): %s",