diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-09 06:56:28 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-09 06:56:28 +0000 |
commit | 39b7ec330923b5a2746720101fbd83c1dd418aea (patch) | |
tree | 42cce57b7c823f65091b5e10c434a494716e0f82 /src/backend/commands | |
parent | 3646ab58b435e53dabd863d11b052e03220bb964 (diff) | |
download | postgresql-39b7ec330923b5a2746720101fbd83c1dd418aea.tar.gz postgresql-39b7ec330923b5a2746720101fbd83c1dd418aea.zip |
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.
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/cluster.c | 6 | ||||
-rw-r--r-- | src/backend/commands/explain.c | 4 | ||||
-rw-r--r-- | src/backend/commands/tablecmds.c | 60 | ||||
-rw-r--r-- | src/backend/commands/trigger.c | 8 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 10 |
5 files changed, 43 insertions, 45 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 4858504f58d..0a0e0afae34 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -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; diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 631c2817cc0..a816036693a 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -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))); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 84ea31885d6..c7b19124db1 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -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); } diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 65b3ed865d2..613dfbcb724 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -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 = diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index dd78db51493..c1b17bba86b 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -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++; |