mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +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:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.104 2002/12/30 19:45:15 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.105 2003/02/09 06:56:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -129,7 +129,7 @@ cluster(ClusterStmt *stmt)
|
||||
HeapTuple idxtuple;
|
||||
Form_pg_index indexForm;
|
||||
|
||||
indexOid = lfirsti(index);
|
||||
indexOid = lfirsto(index);
|
||||
idxtuple = SearchSysCache(INDEXRELID,
|
||||
ObjectIdGetDatum(indexOid),
|
||||
0, 0, 0);
|
||||
@@ -527,7 +527,7 @@ get_indexattr_list(Relation OldHeap, Oid OldIndex)
|
||||
/* Ask the relcache to produce a list of the indexes of the old rel */
|
||||
foreach(indlist, RelationGetIndexList(OldHeap))
|
||||
{
|
||||
Oid indexOID = (Oid) lfirsti(indlist);
|
||||
Oid indexOID = lfirsto(indlist);
|
||||
HeapTuple indexTuple;
|
||||
HeapTuple classTuple;
|
||||
Form_pg_index indexForm;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.101 2003/02/08 20:20:53 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.102 2003/02/09 06:56:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -403,7 +403,7 @@ explain_outNode(StringInfo str,
|
||||
{
|
||||
Relation relation;
|
||||
|
||||
relation = index_open(lfirsti(l));
|
||||
relation = index_open(lfirsto(l));
|
||||
appendStringInfo(str, "%s%s",
|
||||
(++i > 1) ? ", " : "",
|
||||
quote_identifier(RelationGetRelationName(relation)));
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.65 2003/01/08 22:06:23 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.66 2003/02/09 06:56:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -456,7 +456,7 @@ TruncateRelation(const RangeVar *relation)
|
||||
* 'istemp' is TRUE if we are creating a temp relation.
|
||||
*
|
||||
* Output arguments:
|
||||
* 'supOids' receives an integer list of the OIDs of the parent relations.
|
||||
* 'supOids' receives a list of the OIDs of the parent relations.
|
||||
* 'supconstr' receives a list of constraints belonging to the parents,
|
||||
* updated as necessary to be valid for the child.
|
||||
* 'supHasOids' is set TRUE if any parent has OIDs, else it is set FALSE.
|
||||
@@ -575,11 +575,11 @@ MergeAttributes(List *schema, List *supers, bool istemp,
|
||||
/*
|
||||
* Reject duplications in the list of parents.
|
||||
*/
|
||||
if (intMember(RelationGetRelid(relation), parentOids))
|
||||
if (oidMember(RelationGetRelid(relation), parentOids))
|
||||
elog(ERROR, "CREATE TABLE: inherited relation \"%s\" duplicated",
|
||||
parent->relname);
|
||||
|
||||
parentOids = lappendi(parentOids, RelationGetRelid(relation));
|
||||
parentOids = lappendo(parentOids, RelationGetRelid(relation));
|
||||
setRelhassubclassInRelation(RelationGetRelid(relation), true);
|
||||
|
||||
parentHasOids |= relation->rd_rel->relhasoids;
|
||||
@@ -879,8 +879,8 @@ change_varattnos_of_a_node(Node *node, const AttrNumber *newattno)
|
||||
* StoreCatalogInheritance
|
||||
* Updates the system catalogs with proper inheritance information.
|
||||
*
|
||||
* supers is an integer list of the OIDs of the new relation's direct
|
||||
* ancestors. NB: it is destructively changed to include indirect ancestors.
|
||||
* supers is a list of the OIDs of the new relation's direct ancestors.
|
||||
* NB: it is destructively changed to include indirect ancestors.
|
||||
*/
|
||||
static void
|
||||
StoreCatalogInheritance(Oid relationId, List *supers)
|
||||
@@ -909,7 +909,7 @@ StoreCatalogInheritance(Oid relationId, List *supers)
|
||||
seqNumber = 1;
|
||||
foreach(entry, supers)
|
||||
{
|
||||
Oid entryOid = lfirsti(entry);
|
||||
Oid entryOid = lfirsto(entry);
|
||||
Datum datum[Natts_pg_inherits];
|
||||
char nullarr[Natts_pg_inherits];
|
||||
ObjectAddress childobject,
|
||||
@@ -963,13 +963,12 @@ StoreCatalogInheritance(Oid relationId, List *supers)
|
||||
*/
|
||||
foreach(entry, supers)
|
||||
{
|
||||
Oid id = lfirsto(entry);
|
||||
HeapTuple tuple;
|
||||
Oid id;
|
||||
int16 number;
|
||||
List *next;
|
||||
List *current;
|
||||
List *next;
|
||||
|
||||
id = (Oid) lfirsti(entry);
|
||||
current = entry;
|
||||
next = lnext(entry);
|
||||
|
||||
@@ -982,13 +981,12 @@ StoreCatalogInheritance(Oid relationId, List *supers)
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
break;
|
||||
|
||||
lnext(current) = lconsi(((Form_pg_inherits)
|
||||
lnext(current) = lconso(((Form_pg_inherits)
|
||||
GETSTRUCT(tuple))->inhparent,
|
||||
NIL);
|
||||
current = lnext(current);
|
||||
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
current = lnext(current);
|
||||
}
|
||||
lnext(current) = next;
|
||||
}
|
||||
@@ -1003,11 +1001,11 @@ StoreCatalogInheritance(Oid relationId, List *supers)
|
||||
List *rest;
|
||||
|
||||
again:
|
||||
thisone = lfirsti(entry);
|
||||
found = false;
|
||||
thisone = lfirsto(entry);
|
||||
foreach(rest, lnext(entry))
|
||||
{
|
||||
if (thisone == lfirsti(rest))
|
||||
if (thisone == lfirsto(rest))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
@@ -1018,7 +1016,7 @@ again:
|
||||
/*
|
||||
* found a later duplicate, so remove this entry.
|
||||
*/
|
||||
lfirsti(entry) = lfirsti(lnext(entry));
|
||||
lfirsto(entry) = lfirsto(lnext(entry));
|
||||
lnext(entry) = lnext(lnext(entry));
|
||||
|
||||
goto again;
|
||||
@@ -1151,7 +1149,7 @@ renameatt(Oid myrelid,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
|
||||
if (childrelid == myrelid)
|
||||
continue;
|
||||
@@ -1216,7 +1214,7 @@ renameatt(Oid myrelid,
|
||||
|
||||
foreach(indexoidscan, indexoidlist)
|
||||
{
|
||||
Oid indexoid = lfirsti(indexoidscan);
|
||||
Oid indexoid = lfirsto(indexoidscan);
|
||||
HeapTuple indextup;
|
||||
|
||||
/*
|
||||
@@ -1668,7 +1666,7 @@ AlterTableAddColumn(Oid myrelid,
|
||||
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
HeapTuple tuple;
|
||||
Form_pg_attribute childatt;
|
||||
Relation childrel;
|
||||
@@ -1934,7 +1932,7 @@ AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
|
||||
if (childrelid == myrelid)
|
||||
continue;
|
||||
@@ -1967,7 +1965,7 @@ AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
|
||||
|
||||
foreach(indexoidscan, indexoidlist)
|
||||
{
|
||||
Oid indexoid = lfirsti(indexoidscan);
|
||||
Oid indexoid = lfirsto(indexoidscan);
|
||||
HeapTuple indexTuple;
|
||||
Form_pg_index indexStruct;
|
||||
int i;
|
||||
@@ -2068,7 +2066,7 @@ AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
|
||||
if (childrelid == myrelid)
|
||||
continue;
|
||||
@@ -2186,7 +2184,7 @@ AlterTableAlterColumnDefault(Oid myrelid, bool recurse,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
|
||||
if (childrelid == myrelid)
|
||||
continue;
|
||||
@@ -2334,7 +2332,7 @@ AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
|
||||
if (childrelid == myrelid)
|
||||
continue;
|
||||
@@ -2451,7 +2449,7 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
|
||||
attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock);
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
Relation childrel;
|
||||
HeapTuple tuple;
|
||||
Form_pg_attribute childatt;
|
||||
@@ -2499,7 +2497,7 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
|
||||
attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock);
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
Relation childrel;
|
||||
HeapTuple tuple;
|
||||
Form_pg_attribute childatt;
|
||||
@@ -2599,7 +2597,7 @@ AlterTableAddConstraint(Oid myrelid, bool recurse,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
|
||||
if (childrelid == myrelid)
|
||||
continue;
|
||||
@@ -3042,7 +3040,7 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
|
||||
|
||||
foreach(indexoidscan, indexoidlist)
|
||||
{
|
||||
Oid indexoid = lfirsti(indexoidscan);
|
||||
Oid indexoid = lfirsto(indexoidscan);
|
||||
|
||||
indexTuple = SearchSysCache(INDEXRELID,
|
||||
ObjectIdGetDatum(indexoid),
|
||||
@@ -3117,7 +3115,7 @@ transformFkeyCheckAttrs(Relation pkrel,
|
||||
Form_pg_index indexStruct;
|
||||
int i, j;
|
||||
|
||||
indexoid = lfirsti(indexoidscan);
|
||||
indexoid = lfirsto(indexoidscan);
|
||||
indexTuple = SearchSysCache(INDEXRELID,
|
||||
ObjectIdGetDatum(indexoid),
|
||||
0, 0, 0);
|
||||
@@ -3564,7 +3562,7 @@ AlterTableDropConstraint(Oid myrelid, bool recurse,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
Oid childrelid = lfirsti(child);
|
||||
Oid childrelid = lfirsto(child);
|
||||
Relation inhrel;
|
||||
|
||||
if (childrelid == myrelid)
|
||||
@@ -3647,7 +3645,7 @@ AlterTableOwner(Oid relationOid, int32 newOwnerSysId)
|
||||
|
||||
/* For each index, recursively change its ownership */
|
||||
foreach(i, index_oid_list)
|
||||
AlterTableOwner(lfirsti(i), newOwnerSysId);
|
||||
AlterTableOwner(lfirsto(i), newOwnerSysId);
|
||||
|
||||
freeList(index_oid_list);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.144 2003/01/08 22:29:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.145 2003/02/09 06:56:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -2245,7 +2245,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
|
||||
cname);
|
||||
|
||||
constr_oid = HeapTupleGetOid(htup);
|
||||
loid = lappendi(loid, constr_oid);
|
||||
loid = lappendo(loid, constr_oid);
|
||||
found = true;
|
||||
}
|
||||
|
||||
@@ -2271,7 +2271,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
|
||||
foreach(ls, deftrig_trigstates)
|
||||
{
|
||||
state = (DeferredTriggerStatus) lfirst(ls);
|
||||
if (state->dts_tgoid == (Oid) lfirsti(l))
|
||||
if (state->dts_tgoid == lfirsto(l))
|
||||
{
|
||||
state->dts_tgisdeferred = stmt->deferred;
|
||||
found = true;
|
||||
@@ -2282,7 +2282,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
|
||||
{
|
||||
state = (DeferredTriggerStatus)
|
||||
palloc(sizeof(DeferredTriggerStatusData));
|
||||
state->dts_tgoid = (Oid) lfirsti(l);
|
||||
state->dts_tgoid = lfirsto(l);
|
||||
state->dts_tgisdeferred = stmt->deferred;
|
||||
|
||||
deftrig_trigstates =
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.246 2003/01/07 22:23:17 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.247 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -283,7 +283,7 @@ vacuum(VacuumStmt *vacstmt)
|
||||
*/
|
||||
foreach(cur, vrl)
|
||||
{
|
||||
Oid relid = (Oid) lfirsti(cur);
|
||||
Oid relid = lfirsto(cur);
|
||||
|
||||
if (vacstmt->vacuum)
|
||||
{
|
||||
@@ -382,7 +382,7 @@ getrels(const RangeVar *vacrel, const char *stmttype)
|
||||
|
||||
/* Make a relation list entry for this guy */
|
||||
oldcontext = MemoryContextSwitchTo(vac_context);
|
||||
vrl = lappendi(vrl, relid);
|
||||
vrl = lappendo(vrl, relid);
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
}
|
||||
else
|
||||
@@ -406,7 +406,7 @@ getrels(const RangeVar *vacrel, const char *stmttype)
|
||||
{
|
||||
/* Make a relation list entry for this guy */
|
||||
oldcontext = MemoryContextSwitchTo(vac_context);
|
||||
vrl = lappendi(vrl, HeapTupleGetOid(tuple));
|
||||
vrl = lappendo(vrl, HeapTupleGetOid(tuple));
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
}
|
||||
|
||||
@@ -2957,7 +2957,7 @@ vac_open_indexes(Relation relation, int *nindexes, Relation **Irel)
|
||||
i = 0;
|
||||
foreach(indexoidscan, indexoidlist)
|
||||
{
|
||||
Oid indexoid = lfirsti(indexoidscan);
|
||||
Oid indexoid = lfirsto(indexoidscan);
|
||||
|
||||
(*Irel)[i] = index_open(indexoid);
|
||||
i++;
|
||||
|
||||
Reference in New Issue
Block a user