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:
parent
3646ab58b4
commit
39b7ec3309
@ -643,9 +643,8 @@ List *i, *list;
|
||||
return the i'th element in list.
|
||||
|
||||
lconsi, ...
|
||||
There are integer versions of these: lconsi, lappendi, nthi.
|
||||
List's containing integers instead of Node pointers are used to
|
||||
hold list of relation object id's and other integer quantities.
|
||||
There are integer versions of these: lconsi, lappendi, etc.
|
||||
Also versions for OID lists: lconso, lappendo, etc.
|
||||
|
||||
You can print nodes easily inside gdb. First, to disable output
|
||||
truncation when you use the gdb print command:
|
||||
|
@ -779,10 +779,8 @@
|
||||
|
||||
<DT>lconsi, ...</DT>
|
||||
|
||||
<DD>There are integer versions of these: <I>lconsi, lappendi,
|
||||
nthi.</I> <I>List's</I> containing integers instead of Node
|
||||
pointers are used to hold list of relation object id's and
|
||||
other integer quantities.</DD>
|
||||
<DD>There are integer versions of these: <I>lconsi, lappendi</I>,
|
||||
etc. Also versions for OID lists: <I>lconso, lappendo</I>, etc.</DD>
|
||||
</DL>
|
||||
</BLOCKQUOTE>
|
||||
You can print nodes easily inside <I>gdb.</I> First, to disable
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.20 2003/02/07 01:33:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.21 2003/02/09 06:56:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -948,7 +948,7 @@ find_expr_references_walker(Node *node,
|
||||
|
||||
foreach(opid, sublink->operOids)
|
||||
{
|
||||
add_object_address(OCLASS_OPERATOR, (Oid) lfirsti(opid), 0,
|
||||
add_object_address(OCLASS_OPERATOR, lfirsto(opid), 0,
|
||||
&context->addrs);
|
||||
}
|
||||
/* fall through to examine arguments */
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.46 2003/02/07 01:33:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.47 2003/02/09 06:56:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -262,7 +262,7 @@ RelnameGetRelid(const char *relname)
|
||||
|
||||
foreach(lptr, namespaceSearchPath)
|
||||
{
|
||||
Oid namespaceId = (Oid) lfirsti(lptr);
|
||||
Oid namespaceId = lfirsto(lptr);
|
||||
|
||||
relid = get_relname_relid(relname, namespaceId);
|
||||
if (OidIsValid(relid))
|
||||
@ -300,11 +300,11 @@ RelationIsVisible(Oid relid)
|
||||
/*
|
||||
* Quick check: if it ain't in the path at all, it ain't visible.
|
||||
* Items in the system namespace are surely in the path and so we
|
||||
* needn't even do intMember() for them.
|
||||
* needn't even do oidMember() for them.
|
||||
*/
|
||||
relnamespace = relform->relnamespace;
|
||||
if (relnamespace != PG_CATALOG_NAMESPACE &&
|
||||
!intMember(relnamespace, namespaceSearchPath))
|
||||
!oidMember(relnamespace, namespaceSearchPath))
|
||||
visible = false;
|
||||
else
|
||||
{
|
||||
@ -342,7 +342,7 @@ TypenameGetTypid(const char *typname)
|
||||
|
||||
foreach(lptr, namespaceSearchPath)
|
||||
{
|
||||
Oid namespaceId = (Oid) lfirsti(lptr);
|
||||
Oid namespaceId = lfirsto(lptr);
|
||||
|
||||
typid = GetSysCacheOid(TYPENAMENSP,
|
||||
PointerGetDatum(typname),
|
||||
@ -382,11 +382,11 @@ TypeIsVisible(Oid typid)
|
||||
/*
|
||||
* Quick check: if it ain't in the path at all, it ain't visible.
|
||||
* Items in the system namespace are surely in the path and so we
|
||||
* needn't even do intMember() for them.
|
||||
* needn't even do oidMember() for them.
|
||||
*/
|
||||
typnamespace = typform->typnamespace;
|
||||
if (typnamespace != PG_CATALOG_NAMESPACE &&
|
||||
!intMember(typnamespace, namespaceSearchPath))
|
||||
!oidMember(typnamespace, namespaceSearchPath))
|
||||
visible = false;
|
||||
else
|
||||
{
|
||||
@ -480,7 +480,7 @@ FuncnameGetCandidates(List *names, int nargs)
|
||||
|
||||
foreach(nsp, namespaceSearchPath)
|
||||
{
|
||||
if (procform->pronamespace == (Oid) lfirsti(nsp))
|
||||
if (procform->pronamespace == lfirsto(nsp))
|
||||
break;
|
||||
pathpos++;
|
||||
}
|
||||
@ -583,11 +583,11 @@ FunctionIsVisible(Oid funcid)
|
||||
/*
|
||||
* Quick check: if it ain't in the path at all, it ain't visible.
|
||||
* Items in the system namespace are surely in the path and so we
|
||||
* needn't even do intMember() for them.
|
||||
* needn't even do oidMember() for them.
|
||||
*/
|
||||
pronamespace = procform->pronamespace;
|
||||
if (pronamespace != PG_CATALOG_NAMESPACE &&
|
||||
!intMember(pronamespace, namespaceSearchPath))
|
||||
!oidMember(pronamespace, namespaceSearchPath))
|
||||
visible = false;
|
||||
else
|
||||
{
|
||||
@ -695,7 +695,7 @@ OpernameGetCandidates(List *names, char oprkind)
|
||||
|
||||
foreach(nsp, namespaceSearchPath)
|
||||
{
|
||||
if (operform->oprnamespace == (Oid) lfirsti(nsp))
|
||||
if (operform->oprnamespace == lfirsto(nsp))
|
||||
break;
|
||||
pathpos++;
|
||||
}
|
||||
@ -795,11 +795,11 @@ OperatorIsVisible(Oid oprid)
|
||||
/*
|
||||
* Quick check: if it ain't in the path at all, it ain't visible.
|
||||
* Items in the system namespace are surely in the path and so we
|
||||
* needn't even do intMember() for them.
|
||||
* needn't even do oidMember() for them.
|
||||
*/
|
||||
oprnamespace = oprform->oprnamespace;
|
||||
if (oprnamespace != PG_CATALOG_NAMESPACE &&
|
||||
!intMember(oprnamespace, namespaceSearchPath))
|
||||
!oidMember(oprnamespace, namespaceSearchPath))
|
||||
visible = false;
|
||||
else
|
||||
{
|
||||
@ -871,7 +871,7 @@ OpclassGetCandidates(Oid amid)
|
||||
/* Consider only opclasses that are in the search path */
|
||||
foreach(nsp, namespaceSearchPath)
|
||||
{
|
||||
if (opcform->opcnamespace == (Oid) lfirsti(nsp))
|
||||
if (opcform->opcnamespace == lfirsto(nsp))
|
||||
break;
|
||||
pathpos++;
|
||||
}
|
||||
@ -967,7 +967,7 @@ OpclassnameGetOpcid(Oid amid, const char *opcname)
|
||||
|
||||
foreach(lptr, namespaceSearchPath)
|
||||
{
|
||||
Oid namespaceId = (Oid) lfirsti(lptr);
|
||||
Oid namespaceId = lfirsto(lptr);
|
||||
|
||||
opcid = GetSysCacheOid(CLAAMNAMENSP,
|
||||
ObjectIdGetDatum(amid),
|
||||
@ -1008,11 +1008,11 @@ OpclassIsVisible(Oid opcid)
|
||||
/*
|
||||
* Quick check: if it ain't in the path at all, it ain't visible.
|
||||
* Items in the system namespace are surely in the path and so we
|
||||
* needn't even do intMember() for them.
|
||||
* needn't even do oidMember() for them.
|
||||
*/
|
||||
opcnamespace = opcform->opcnamespace;
|
||||
if (opcnamespace != PG_CATALOG_NAMESPACE &&
|
||||
!intMember(opcnamespace, namespaceSearchPath))
|
||||
!oidMember(opcnamespace, namespaceSearchPath))
|
||||
visible = false;
|
||||
else
|
||||
{
|
||||
@ -1049,7 +1049,7 @@ ConversionGetConid(const char *conname)
|
||||
|
||||
foreach(lptr, namespaceSearchPath)
|
||||
{
|
||||
Oid namespaceId = (Oid) lfirsti(lptr);
|
||||
Oid namespaceId = lfirsto(lptr);
|
||||
|
||||
conid = GetSysCacheOid(CONNAMENSP,
|
||||
PointerGetDatum(conname),
|
||||
@ -1089,11 +1089,11 @@ ConversionIsVisible(Oid conid)
|
||||
/*
|
||||
* Quick check: if it ain't in the path at all, it ain't visible.
|
||||
* Items in the system namespace are surely in the path and so we
|
||||
* needn't even do intMember() for them.
|
||||
* needn't even do oidMember() for them.
|
||||
*/
|
||||
connamespace = conform->connamespace;
|
||||
if (connamespace != PG_CATALOG_NAMESPACE &&
|
||||
!intMember(connamespace, namespaceSearchPath))
|
||||
!oidMember(connamespace, namespaceSearchPath))
|
||||
visible = false;
|
||||
else
|
||||
{
|
||||
@ -1141,7 +1141,7 @@ DeconstructQualifiedName(List *names,
|
||||
case 3:
|
||||
catalogname = strVal(lfirst(names));
|
||||
schemaname = strVal(lsecond(names));
|
||||
objname = strVal(lfirst(lnext(lnext(names))));
|
||||
objname = strVal(lthird(names));
|
||||
|
||||
/*
|
||||
* We check the catalog name and then ignore it.
|
||||
@ -1251,7 +1251,7 @@ makeRangeVarFromNameList(List *names)
|
||||
case 3:
|
||||
rel->catalogname = strVal(lfirst(names));
|
||||
rel->schemaname = strVal(lsecond(names));
|
||||
rel->relname = strVal(lfirst(lnext(lnext(names))));
|
||||
rel->relname = strVal(lthird(names));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "Improper relation name (too many dotted names)");
|
||||
@ -1402,7 +1402,7 @@ FindConversionByName(List *name)
|
||||
|
||||
foreach(lptr, namespaceSearchPath)
|
||||
{
|
||||
namespaceId = (Oid) lfirsti(lptr);
|
||||
namespaceId = lfirsto(lptr);
|
||||
conoid = FindConversion(conversion_name, namespaceId);
|
||||
if (OidIsValid(conoid))
|
||||
return conoid;
|
||||
@ -1426,7 +1426,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
|
||||
|
||||
foreach(lptr, namespaceSearchPath)
|
||||
{
|
||||
Oid namespaceId = (Oid) lfirsti(lptr);
|
||||
Oid namespaceId = lfirsto(lptr);
|
||||
|
||||
proc = FindDefaultConversion(namespaceId, for_encoding, to_encoding);
|
||||
if (OidIsValid(proc))
|
||||
@ -1499,10 +1499,10 @@ recomputeNamespacePath(void)
|
||||
0, 0, 0);
|
||||
ReleaseSysCache(tuple);
|
||||
if (OidIsValid(namespaceId) &&
|
||||
!intMember(namespaceId, oidlist) &&
|
||||
!oidMember(namespaceId, oidlist) &&
|
||||
pg_namespace_aclcheck(namespaceId, userId,
|
||||
ACL_USAGE) == ACLCHECK_OK)
|
||||
oidlist = lappendi(oidlist, namespaceId);
|
||||
oidlist = lappendo(oidlist, namespaceId);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1512,10 +1512,10 @@ recomputeNamespacePath(void)
|
||||
CStringGetDatum(curname),
|
||||
0, 0, 0);
|
||||
if (OidIsValid(namespaceId) &&
|
||||
!intMember(namespaceId, oidlist) &&
|
||||
!oidMember(namespaceId, oidlist) &&
|
||||
pg_namespace_aclcheck(namespaceId, userId,
|
||||
ACL_USAGE) == ACLCHECK_OK)
|
||||
oidlist = lappendi(oidlist, namespaceId);
|
||||
oidlist = lappendo(oidlist, namespaceId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1525,23 +1525,23 @@ recomputeNamespacePath(void)
|
||||
if (oidlist == NIL)
|
||||
firstNS = InvalidOid;
|
||||
else
|
||||
firstNS = (Oid) lfirsti(oidlist);
|
||||
firstNS = lfirsto(oidlist);
|
||||
|
||||
/*
|
||||
* Add any implicitly-searched namespaces to the list. Note these go
|
||||
* on the front, not the back; also notice that we do not check USAGE
|
||||
* permissions for these.
|
||||
*/
|
||||
if (!intMember(PG_CATALOG_NAMESPACE, oidlist))
|
||||
oidlist = lconsi(PG_CATALOG_NAMESPACE, oidlist);
|
||||
if (!oidMember(PG_CATALOG_NAMESPACE, oidlist))
|
||||
oidlist = lconso(PG_CATALOG_NAMESPACE, oidlist);
|
||||
|
||||
if (OidIsValid(myTempNamespace) &&
|
||||
!intMember(myTempNamespace, oidlist))
|
||||
oidlist = lconsi(myTempNamespace, oidlist);
|
||||
!oidMember(myTempNamespace, oidlist))
|
||||
oidlist = lconso(myTempNamespace, oidlist);
|
||||
|
||||
if (OidIsValid(mySpecialNamespace) &&
|
||||
!intMember(mySpecialNamespace, oidlist))
|
||||
oidlist = lconsi(mySpecialNamespace, oidlist);
|
||||
!oidMember(mySpecialNamespace, oidlist))
|
||||
oidlist = lconso(mySpecialNamespace, oidlist);
|
||||
|
||||
/*
|
||||
* Now that we've successfully built the new list of namespace OIDs,
|
||||
@ -1801,7 +1801,7 @@ InitializeSearchPath(void)
|
||||
MemoryContext oldcxt;
|
||||
|
||||
oldcxt = MemoryContextSwitchTo(TopMemoryContext);
|
||||
namespaceSearchPath = makeListi1(PG_CATALOG_NAMESPACE);
|
||||
namespaceSearchPath = makeListo1(PG_CATALOG_NAMESPACE);
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
defaultCreationNamespace = PG_CATALOG_NAMESPACE;
|
||||
firstExplicitNamespace = PG_CATALOG_NAMESPACE;
|
||||
@ -1851,7 +1851,7 @@ fetch_search_path(bool includeImplicit)
|
||||
result = namespaceSearchPath;
|
||||
if (!includeImplicit)
|
||||
{
|
||||
while (result && (Oid) lfirsti(result) != firstExplicitNamespace)
|
||||
while (result && lfirsto(result) != firstExplicitNamespace)
|
||||
result = lnext(result);
|
||||
}
|
||||
|
||||
|
@ -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++;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.97 2003/02/09 00:30:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.98 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -677,7 +677,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
|
||||
i = 0;
|
||||
foreach(indexoidscan, indexoidlist)
|
||||
{
|
||||
Oid indexOid = lfirsti(indexoidscan);
|
||||
Oid indexOid = lfirsto(indexoidscan);
|
||||
Relation indexDesc;
|
||||
IndexInfo *ii;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.78 2003/02/03 15:07:07 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.79 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -897,7 +897,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
||||
listscan = indxid;
|
||||
for (i = 0; i < numIndices; i++)
|
||||
{
|
||||
Oid indexOid = (Oid) lfirsti(listscan);
|
||||
Oid indexOid = lfirsto(listscan);
|
||||
|
||||
indexDescs[i] = index_open(indexOid);
|
||||
scanDescs[i] = index_beginscan(currentRelation,
|
||||
|
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.241 2003/02/09 00:30:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.242 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -47,6 +47,10 @@
|
||||
#define COPY_INTLIST_FIELD(fldname) \
|
||||
(newnode->fldname = listCopy(from->fldname))
|
||||
|
||||
/* Copy a field that is a pointer to a list of Oids */
|
||||
#define COPY_OIDLIST_FIELD(fldname) \
|
||||
(newnode->fldname = listCopy(from->fldname))
|
||||
|
||||
/* Copy a field that is a pointer to a Bitmapset */
|
||||
#define COPY_BITMAPSET_FIELD(fldname) \
|
||||
(newnode->fldname = bms_copy(from->fldname))
|
||||
@ -69,31 +73,38 @@
|
||||
* This copy function only copies the "cons-cells" of the list, not the
|
||||
* pointed-to objects. (Use copyObject if you want a "deep" copy.)
|
||||
*
|
||||
* We also use this function for copying lists of integers, which is
|
||||
* grotty but unlikely to break --- it could fail if sizeof(pointer)
|
||||
* is less than sizeof(int), but I don't know any such machines...
|
||||
* We also use this function for copying lists of integers and Oids,
|
||||
* which is notationally a bit ugly, but perfectly safe.
|
||||
*
|
||||
* Note that copyObject will surely coredump if applied to a list
|
||||
* of integers!
|
||||
* of integers or Oids!
|
||||
*/
|
||||
List *
|
||||
listCopy(List *list)
|
||||
{
|
||||
List *newlist,
|
||||
*l,
|
||||
*nl;
|
||||
*oldl,
|
||||
*newcell,
|
||||
*prev;
|
||||
|
||||
/* rather ugly coding for speed... */
|
||||
if (list == NIL)
|
||||
return NIL;
|
||||
|
||||
newlist = nl = makeList1(lfirst(list));
|
||||
newcell = makeNode(List);
|
||||
newcell->elem = list->elem;
|
||||
|
||||
foreach(l, lnext(list))
|
||||
newlist = prev = newcell;
|
||||
|
||||
foreach(oldl, lnext(list))
|
||||
{
|
||||
lnext(nl) = makeList1(lfirst(l));
|
||||
nl = lnext(nl);
|
||||
newcell = makeNode(List);
|
||||
newcell->elem = oldl->elem;
|
||||
prev->next = newcell;
|
||||
prev = newcell;
|
||||
}
|
||||
prev->next = NIL;
|
||||
|
||||
return newlist;
|
||||
}
|
||||
|
||||
@ -248,7 +259,7 @@ _copyIndexScan(IndexScan *from)
|
||||
/*
|
||||
* copy remainder of node
|
||||
*/
|
||||
COPY_INTLIST_FIELD(indxid);
|
||||
COPY_OIDLIST_FIELD(indxid);
|
||||
COPY_NODE_FIELD(indxqual);
|
||||
COPY_NODE_FIELD(indxqualorig);
|
||||
COPY_SCALAR_FIELD(indxorderdir);
|
||||
@ -816,7 +827,7 @@ _copySubLink(SubLink *from)
|
||||
COPY_SCALAR_FIELD(useOr);
|
||||
COPY_NODE_FIELD(lefthand);
|
||||
COPY_NODE_FIELD(operName);
|
||||
COPY_INTLIST_FIELD(operOids);
|
||||
COPY_OIDLIST_FIELD(operOids);
|
||||
COPY_NODE_FIELD(subselect);
|
||||
|
||||
return newnode;
|
||||
@ -1523,7 +1534,7 @@ _copySetOperationStmt(SetOperationStmt *from)
|
||||
COPY_SCALAR_FIELD(all);
|
||||
COPY_NODE_FIELD(larg);
|
||||
COPY_NODE_FIELD(rarg);
|
||||
COPY_INTLIST_FIELD(colTypes);
|
||||
COPY_OIDLIST_FIELD(colTypes);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
@ -2271,7 +2282,7 @@ _copyPrepareStmt(PrepareStmt *from)
|
||||
|
||||
COPY_STRING_FIELD(name);
|
||||
COPY_NODE_FIELD(argtypes);
|
||||
COPY_INTLIST_FIELD(argtype_oids);
|
||||
COPY_OIDLIST_FIELD(argtype_oids);
|
||||
COPY_NODE_FIELD(query);
|
||||
|
||||
return newnode;
|
||||
@ -2527,19 +2538,26 @@ copyObject(void *from)
|
||||
case T_List:
|
||||
{
|
||||
List *list = from,
|
||||
*l,
|
||||
*nl;
|
||||
*oldl,
|
||||
*newcell,
|
||||
*prev;
|
||||
|
||||
/* rather ugly coding for speed... */
|
||||
/* Note the input list cannot be NIL if we got here. */
|
||||
nl = makeList1(copyObject(lfirst(list)));
|
||||
retval = nl;
|
||||
newcell = makeNode(List);
|
||||
lfirst(newcell) = copyObject(lfirst(list));
|
||||
|
||||
foreach(l, lnext(list))
|
||||
retval = (void *) newcell;
|
||||
prev = newcell;
|
||||
|
||||
foreach(oldl, lnext(list))
|
||||
{
|
||||
lnext(nl) = makeList1(copyObject(lfirst(l)));
|
||||
nl = lnext(nl);
|
||||
newcell = makeNode(List);
|
||||
lfirst(newcell) = copyObject(lfirst(oldl));
|
||||
prev->next = newcell;
|
||||
prev = newcell;
|
||||
}
|
||||
prev->next = NIL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.184 2003/02/08 20:20:53 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.185 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -59,6 +59,13 @@
|
||||
return false; \
|
||||
} while (0)
|
||||
|
||||
/* Compare a field that is a pointer to a list of Oids */
|
||||
#define COMPARE_OIDLIST_FIELD(fldname) \
|
||||
do { \
|
||||
if (!equalo(a->fldname, b->fldname)) \
|
||||
return false; \
|
||||
} while (0)
|
||||
|
||||
/* Compare a field that is a pointer to a Bitmapset */
|
||||
#define COMPARE_BITMAPSET_FIELD(fldname) \
|
||||
do { \
|
||||
@ -297,7 +304,7 @@ _equalSubLink(SubLink *a, SubLink *b)
|
||||
COMPARE_SCALAR_FIELD(useOr);
|
||||
COMPARE_NODE_FIELD(lefthand);
|
||||
COMPARE_NODE_FIELD(operName);
|
||||
COMPARE_INTLIST_FIELD(operOids);
|
||||
COMPARE_OIDLIST_FIELD(operOids);
|
||||
COMPARE_NODE_FIELD(subselect);
|
||||
|
||||
return true;
|
||||
@ -611,7 +618,7 @@ _equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b)
|
||||
COMPARE_SCALAR_FIELD(all);
|
||||
COMPARE_NODE_FIELD(larg);
|
||||
COMPARE_NODE_FIELD(rarg);
|
||||
COMPARE_INTLIST_FIELD(colTypes);
|
||||
COMPARE_OIDLIST_FIELD(colTypes);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1237,7 +1244,7 @@ _equalPrepareStmt(PrepareStmt *a, PrepareStmt *b)
|
||||
{
|
||||
COMPARE_STRING_FIELD(name);
|
||||
COMPARE_NODE_FIELD(argtypes);
|
||||
COMPARE_INTLIST_FIELD(argtype_oids);
|
||||
COMPARE_OIDLIST_FIELD(argtype_oids);
|
||||
COMPARE_NODE_FIELD(query);
|
||||
|
||||
return true;
|
||||
|
@ -1,14 +1,15 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* list.c
|
||||
* various list handling routines
|
||||
* POSTGRES generic list package
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.47 2003/02/08 20:20:54 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.48 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* XXX a few of the following functions are duplicated to handle
|
||||
@ -117,6 +118,21 @@ lconsi(int datum, List *list)
|
||||
return l;
|
||||
}
|
||||
|
||||
/*
|
||||
* lconso
|
||||
*
|
||||
* Same as lcons, but for Oid data
|
||||
*/
|
||||
List *
|
||||
lconso(Oid datum, List *list)
|
||||
{
|
||||
List *l = makeNode(List);
|
||||
|
||||
lfirsto(l) = datum;
|
||||
lnext(l) = list;
|
||||
return l;
|
||||
}
|
||||
|
||||
/*
|
||||
* lappend
|
||||
*
|
||||
@ -141,6 +157,17 @@ lappendi(List *list, int datum)
|
||||
return nconc(list, makeListi1(datum));
|
||||
}
|
||||
|
||||
/*
|
||||
* lappendo
|
||||
*
|
||||
* Same as lappend, but for Oids
|
||||
*/
|
||||
List *
|
||||
lappendo(List *list, Oid datum)
|
||||
{
|
||||
return nconc(list, makeListo1(datum));
|
||||
}
|
||||
|
||||
/*
|
||||
* nconc
|
||||
*
|
||||
@ -159,7 +186,7 @@ nconc(List *l1, List *l2)
|
||||
if (l2 == NIL)
|
||||
return l1;
|
||||
if (l1 == l2)
|
||||
elog(ERROR, "tryout to nconc a list to itself");
|
||||
elog(ERROR, "can't nconc a list to itself");
|
||||
|
||||
for (temp = l1; lnext(temp) != NIL; temp = lnext(temp))
|
||||
;
|
||||
@ -177,44 +204,13 @@ void *
|
||||
nth(int n, List *l)
|
||||
{
|
||||
/* XXX assume list is long enough */
|
||||
while (n > 0)
|
||||
while (n-- > 0)
|
||||
{
|
||||
l = lnext(l);
|
||||
n--;
|
||||
}
|
||||
return lfirst(l);
|
||||
}
|
||||
|
||||
/*
|
||||
* nthi
|
||||
*
|
||||
* Same as nthi, but for integers
|
||||
*/
|
||||
int
|
||||
nthi(int n, List *l)
|
||||
{
|
||||
/* XXX assume list is long enough */
|
||||
while (n > 0)
|
||||
{
|
||||
l = lnext(l);
|
||||
n--;
|
||||
}
|
||||
return lfirsti(l);
|
||||
}
|
||||
|
||||
/* this is here solely for rt_store. Get rid of me some day! */
|
||||
void
|
||||
set_nth(List *l, int n, void *elem)
|
||||
{
|
||||
/* XXX assume list is long enough */
|
||||
while (n > 0)
|
||||
{
|
||||
l = lnext(l);
|
||||
n--;
|
||||
}
|
||||
lfirst(l) = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* length
|
||||
*
|
||||
@ -253,7 +249,7 @@ llast(List *l)
|
||||
*
|
||||
* Free the List nodes of a list
|
||||
* The pointed-to nodes, if any, are NOT freed.
|
||||
* This works for integer lists too.
|
||||
* This works for integer and Oid lists too.
|
||||
*/
|
||||
void
|
||||
freeList(List *list)
|
||||
@ -289,6 +285,28 @@ equali(List *list1, List *list2)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* equalo
|
||||
* compares two lists of Oids
|
||||
*/
|
||||
bool
|
||||
equalo(List *list1, List *list2)
|
||||
{
|
||||
List *l;
|
||||
|
||||
foreach(l, list1)
|
||||
{
|
||||
if (list2 == NIL)
|
||||
return false;
|
||||
if (lfirsto(l) != lfirsto(list2))
|
||||
return false;
|
||||
list2 = lnext(list2);
|
||||
}
|
||||
if (list2 != NIL)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate the union of two lists,
|
||||
* ie, l1 plus all members of l2 that are not already in l1.
|
||||
@ -313,17 +331,17 @@ set_union(List *l1, List *l2)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* set_union for integer lists */
|
||||
/* set_union for Oid lists */
|
||||
List *
|
||||
set_unioni(List *l1, List *l2)
|
||||
set_uniono(List *l1, List *l2)
|
||||
{
|
||||
List *retval = listCopy(l1);
|
||||
List *i;
|
||||
|
||||
foreach(i, l2)
|
||||
{
|
||||
if (!intMember(lfirsti(i), retval))
|
||||
retval = lappendi(retval, lfirsti(i));
|
||||
if (!oidMember(lfirsto(i), retval))
|
||||
retval = lappendo(retval, lfirsto(i));
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@ -353,6 +371,7 @@ set_ptrUnion(List *l1, List *l2)
|
||||
* The result is a fresh List, but it points to the same member nodes
|
||||
* as were in the inputs.
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
List *
|
||||
set_intersect(List *l1, List *l2)
|
||||
{
|
||||
@ -366,20 +385,7 @@ set_intersect(List *l1, List *l2)
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
List *
|
||||
set_intersecti(List *l1, List *l2)
|
||||
{
|
||||
List *retval = NIL;
|
||||
List *i;
|
||||
|
||||
foreach(i, l1)
|
||||
{
|
||||
if (intMember(lfirsti(i), l2))
|
||||
retval = lappendi(retval, lfirsti(i));
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* member()
|
||||
@ -408,7 +414,7 @@ ptrMember(void *l1, List *l2)
|
||||
|
||||
foreach(i, l2)
|
||||
{
|
||||
if (l1 == ((void *) lfirst(i)))
|
||||
if (l1 == lfirst(i))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -430,9 +436,26 @@ intMember(int l1, List *l2)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* membership test for Oid lists
|
||||
*/
|
||||
bool
|
||||
oidMember(Oid l1, List *l2)
|
||||
{
|
||||
List *i;
|
||||
|
||||
foreach(i, l2)
|
||||
{
|
||||
if (l1 == lfirsto(i))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* lremove
|
||||
* Removes 'elem' from the linked list (destructively changing the list!).
|
||||
* (If there is more than one equal list member, the first is removed.)
|
||||
*
|
||||
* This version matches 'elem' using simple pointer comparison.
|
||||
* See also LispRemove.
|
||||
@ -464,9 +487,9 @@ lremove(void *elem, List *list)
|
||||
/*
|
||||
* LispRemove
|
||||
* Removes 'elem' from the linked list (destructively changing the list!).
|
||||
* (If there is more than one equal list member, the first is removed.)
|
||||
*
|
||||
* This version matches 'elem' using equal().
|
||||
* (If there is more than one equal list member, the first is removed.)
|
||||
* See also lremove.
|
||||
*/
|
||||
List *
|
||||
@ -572,12 +595,12 @@ set_difference(List *l1, List *l2)
|
||||
}
|
||||
|
||||
/*
|
||||
* set_differencei
|
||||
* set_differenceo
|
||||
*
|
||||
* Same as set_difference, but for integers
|
||||
* Same as set_difference, but for Oid lists
|
||||
*/
|
||||
List *
|
||||
set_differencei(List *l1, List *l2)
|
||||
set_differenceo(List *l1, List *l2)
|
||||
{
|
||||
List *result = NIL;
|
||||
List *i;
|
||||
@ -587,8 +610,8 @@ set_differencei(List *l1, List *l2)
|
||||
|
||||
foreach(i, l1)
|
||||
{
|
||||
if (!intMember(lfirsti(i), l2))
|
||||
result = lappendi(result, lfirsti(i));
|
||||
if (!oidMember(lfirsto(i), l2))
|
||||
result = lappendo(result, lfirsto(i));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.197 2003/02/09 00:30:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.198 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every node type that can appear in stored rules' parsetrees *must*
|
||||
@ -173,7 +173,7 @@ _outOidList(StringInfo str, List *list)
|
||||
|
||||
appendStringInfoChar(str, '(');
|
||||
foreach(l, list)
|
||||
appendStringInfo(str, " %u", (Oid) lfirsti(l));
|
||||
appendStringInfo(str, " %u", lfirsto(l));
|
||||
appendStringInfoChar(str, ')');
|
||||
}
|
||||
|
||||
@ -689,7 +689,7 @@ _outSubLink(StringInfo str, SubLink *node)
|
||||
WRITE_BOOL_FIELD(useOr);
|
||||
WRITE_NODE_FIELD(lefthand);
|
||||
WRITE_NODE_FIELD(operName);
|
||||
WRITE_INTLIST_FIELD(operOids);
|
||||
WRITE_OIDLIST_FIELD(operOids);
|
||||
WRITE_NODE_FIELD(subselect);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.147 2003/02/03 21:15:44 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.148 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Path and Plan nodes do not have any readfuncs support, because we
|
||||
@ -170,12 +170,12 @@ toOidList(List *list)
|
||||
*/
|
||||
if (IsA(v, Integer))
|
||||
{
|
||||
lfirsti(l) = (Oid) intVal(v);
|
||||
lfirsto(l) = (Oid) intVal(v);
|
||||
pfree(v);
|
||||
}
|
||||
else if (IsA(v, Float))
|
||||
{
|
||||
lfirsti(l) = atooid(strVal(v));
|
||||
lfirsto(l) = atooid(strVal(v));
|
||||
pfree(strVal(v));
|
||||
pfree(v);
|
||||
}
|
||||
@ -534,7 +534,7 @@ _readSubLink(void)
|
||||
READ_BOOL_FIELD(useOr);
|
||||
READ_NODE_FIELD(lefthand);
|
||||
READ_NODE_FIELD(operName);
|
||||
READ_INTLIST_FIELD(operOids);
|
||||
READ_OIDLIST_FIELD(operOids);
|
||||
READ_NODE_FIELD(subselect);
|
||||
|
||||
READ_DONE();
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.135 2003/02/08 20:20:54 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.136 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -658,7 +658,7 @@ create_indexscan_plan(Query *root,
|
||||
{
|
||||
IndexOptInfo *index = (IndexOptInfo *) lfirst(ixinfo);
|
||||
|
||||
indexids = lappendi(indexids, index->indexoid);
|
||||
indexids = lappendo(indexids, index->indexoid);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.71 2003/02/09 00:30:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.72 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -458,7 +458,7 @@ convert_sublink_opers(List *lefthand, List *operOids,
|
||||
|
||||
foreach(lst, operOids)
|
||||
{
|
||||
Oid opid = (Oid) lfirsti(lst);
|
||||
Oid opid = lfirsto(lst);
|
||||
Node *leftop = lfirst(lefthand);
|
||||
TargetEntry *te = lfirst(targetlist);
|
||||
Node *rightop;
|
||||
@ -577,7 +577,7 @@ subplan_is_hashable(SubLink *slink, SubPlan *node)
|
||||
*/
|
||||
foreach(opids, slink->operOids)
|
||||
{
|
||||
Oid opid = (Oid) lfirsti(opids);
|
||||
Oid opid = lfirsto(opids);
|
||||
HeapTuple tup;
|
||||
Form_pg_operator optup;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.89 2003/02/08 20:20:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.90 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -111,7 +111,7 @@ plan_set_operations(Query *parse)
|
||||
* recurse_set_operations
|
||||
* Recursively handle one step in a tree of set operations
|
||||
*
|
||||
* colTypes: integer list of type OIDs of expected output columns
|
||||
* colTypes: list of type OIDs of expected output columns
|
||||
* junkOK: if true, child resjunk columns may be left in the result
|
||||
* flag: if >= 0, add a resjunk output column indicating value of flag
|
||||
* refnames_tlist: targetlist to take column names from
|
||||
@ -330,7 +330,7 @@ recurse_union_children(Node *setOp, Query *parse,
|
||||
|
||||
if (op->op == top_union->op &&
|
||||
(op->all == top_union->all || op->all) &&
|
||||
equali(op->colTypes, top_union->colTypes))
|
||||
equalo(op->colTypes, top_union->colTypes))
|
||||
{
|
||||
/* Same UNION, so fold children into parent's subplan list */
|
||||
return nconc(recurse_union_children(op->larg, parse,
|
||||
@ -380,7 +380,7 @@ generate_setop_tlist(List *colTypes, int flag,
|
||||
|
||||
foreach(i, colTypes)
|
||||
{
|
||||
Oid colType = (Oid) lfirsti(i);
|
||||
Oid colType = lfirsto(i);
|
||||
TargetEntry *inputtle = (TargetEntry *) lfirst(input_tlist);
|
||||
TargetEntry *reftle = (TargetEntry *) lfirst(refnames_tlist);
|
||||
int32 colTypmod;
|
||||
@ -500,7 +500,7 @@ generate_append_tlist(List *colTypes, bool flag,
|
||||
if (subtle->resdom->resjunk)
|
||||
continue;
|
||||
Assert(curColType != NIL);
|
||||
if (subtle->resdom->restype == (Oid) lfirsti(curColType))
|
||||
if (subtle->resdom->restype == lfirsto(curColType))
|
||||
{
|
||||
/* If first subplan, copy the typmod; else compare */
|
||||
if (planl == input_plans)
|
||||
@ -525,7 +525,7 @@ generate_append_tlist(List *colTypes, bool flag,
|
||||
colindex = 0;
|
||||
foreach(curColType, colTypes)
|
||||
{
|
||||
Oid colType = (Oid) lfirsti(curColType);
|
||||
Oid colType = lfirsto(curColType);
|
||||
int32 colTypmod = colTypmods[colindex++];
|
||||
TargetEntry *reftle = (TargetEntry *) lfirst(refnames_tlist);
|
||||
|
||||
@ -591,7 +591,7 @@ tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK)
|
||||
{
|
||||
if (colTypes == NIL)
|
||||
return false;
|
||||
if (tle->resdom->restype != (Oid) lfirsti(colTypes))
|
||||
if (tle->resdom->restype != lfirsto(colTypes))
|
||||
return false;
|
||||
colTypes = lnext(colTypes);
|
||||
}
|
||||
@ -604,14 +604,14 @@ tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK)
|
||||
|
||||
/*
|
||||
* find_all_inheritors -
|
||||
* Returns an integer list of relation OIDs including the given rel plus
|
||||
* Returns a list of relation OIDs including the given rel plus
|
||||
* all relations that inherit from it, directly or indirectly.
|
||||
*/
|
||||
List *
|
||||
find_all_inheritors(Oid parentrel)
|
||||
{
|
||||
List *examined_relids = NIL;
|
||||
List *unexamined_relids = makeListi1(parentrel);
|
||||
List *unexamined_relids = makeListo1(parentrel);
|
||||
|
||||
/*
|
||||
* While the queue of unexamined relids is nonempty, remove the first
|
||||
@ -620,11 +620,11 @@ find_all_inheritors(Oid parentrel)
|
||||
*/
|
||||
while (unexamined_relids != NIL)
|
||||
{
|
||||
Oid currentrel = lfirsti(unexamined_relids);
|
||||
Oid currentrel = lfirsto(unexamined_relids);
|
||||
List *currentchildren;
|
||||
|
||||
unexamined_relids = lnext(unexamined_relids);
|
||||
examined_relids = lappendi(examined_relids, currentrel);
|
||||
examined_relids = lappendo(examined_relids, currentrel);
|
||||
currentchildren = find_inheritance_children(currentrel);
|
||||
|
||||
/*
|
||||
@ -634,8 +634,8 @@ find_all_inheritors(Oid parentrel)
|
||||
* into an infinite loop, though theoretically there can't be any
|
||||
* cycles in the inheritance graph anyway.)
|
||||
*/
|
||||
currentchildren = set_differencei(currentchildren, examined_relids);
|
||||
unexamined_relids = set_unioni(unexamined_relids, currentchildren);
|
||||
currentchildren = set_differenceo(currentchildren, examined_relids);
|
||||
unexamined_relids = set_uniono(unexamined_relids, currentchildren);
|
||||
}
|
||||
|
||||
return examined_relids;
|
||||
@ -702,7 +702,7 @@ expand_inherted_rtentry(Query *parse, Index rti, bool dup_parent)
|
||||
|
||||
foreach(l, inhOIDs)
|
||||
{
|
||||
Oid childOID = (Oid) lfirsti(l);
|
||||
Oid childOID = lfirsto(l);
|
||||
RangeTblEntry *childrte;
|
||||
Index childRTindex;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.128 2003/02/08 20:20:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.129 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -566,7 +566,7 @@ contain_mutable_functions_walker(Node *node, void *context)
|
||||
|
||||
foreach(opid, sublink->operOids)
|
||||
{
|
||||
if (op_volatile((Oid) lfirsti(opid)) != PROVOLATILE_IMMUTABLE)
|
||||
if (op_volatile(lfirsto(opid)) != PROVOLATILE_IMMUTABLE)
|
||||
return true;
|
||||
}
|
||||
/* else fall through to check args */
|
||||
@ -633,7 +633,7 @@ contain_volatile_functions_walker(Node *node, void *context)
|
||||
|
||||
foreach(opid, sublink->operOids)
|
||||
{
|
||||
if (op_volatile((Oid) lfirsti(opid)) == PROVOLATILE_VOLATILE)
|
||||
if (op_volatile(lfirsto(opid)) == PROVOLATILE_VOLATILE)
|
||||
return true;
|
||||
}
|
||||
/* else fall through to check args */
|
||||
@ -718,7 +718,7 @@ contain_nonstrict_functions_walker(Node *node, void *context)
|
||||
|
||||
foreach(opid, sublink->operOids)
|
||||
{
|
||||
if (!op_strict((Oid) lfirsti(opid)))
|
||||
if (!op_strict(lfirsto(opid)))
|
||||
return true;
|
||||
}
|
||||
/* else fall through to check args */
|
||||
@ -1679,7 +1679,7 @@ inline_function(Oid funcid, List *args, HeapTuple func_tuple,
|
||||
return NULL;
|
||||
|
||||
/* Check for recursive function, and give up trying to expand if so */
|
||||
if (intMember(funcid, active_fns))
|
||||
if (oidMember(funcid, active_fns))
|
||||
return NULL;
|
||||
|
||||
/* Check permission to call function (fail later, if not) */
|
||||
@ -1824,7 +1824,7 @@ inline_function(Oid funcid, List *args, HeapTuple func_tuple,
|
||||
* add the current function to the context list of active functions.
|
||||
*/
|
||||
newexpr = eval_const_expressions_mutator(newexpr,
|
||||
lconsi(funcid, active_fns));
|
||||
lconso(funcid, active_fns));
|
||||
|
||||
return (Expr *) newexpr;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.78 2003/02/08 20:20:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.79 2003/02/09 06:56:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -98,7 +98,7 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
|
||||
|
||||
foreach(indexoidscan, indexoidlist)
|
||||
{
|
||||
Oid indexoid = lfirsti(indexoidscan);
|
||||
Oid indexoid = lfirsto(indexoidscan);
|
||||
Relation indexRelation;
|
||||
Form_pg_index index;
|
||||
IndexOptInfo *info;
|
||||
@ -270,7 +270,7 @@ join_selectivity(Query *root,
|
||||
/*
|
||||
* find_inheritance_children
|
||||
*
|
||||
* Returns an integer list containing the OIDs of all relations which
|
||||
* Returns a list containing the OIDs of all relations which
|
||||
* inherit *directly* from the relation with OID 'inhparent'.
|
||||
*
|
||||
* XXX might be a good idea to create an index on pg_inherits' inhparent
|
||||
@ -305,7 +305,7 @@ find_inheritance_children(Oid inhparent)
|
||||
while ((inheritsTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
||||
{
|
||||
inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid;
|
||||
list = lappendi(list, inhrelid);
|
||||
list = lappendo(list, inhrelid);
|
||||
}
|
||||
heap_endscan(scan);
|
||||
heap_close(relation, AccessShareLock);
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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))
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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",
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.41 2002/09/04 20:31:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.42 2003/02/09 06:56:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -245,7 +245,7 @@ current_schema(PG_FUNCTION_ARGS)
|
||||
|
||||
if (search_path == NIL)
|
||||
PG_RETURN_NULL();
|
||||
nspname = get_namespace_name((Oid) lfirsti(search_path));
|
||||
nspname = get_namespace_name(lfirsto(search_path));
|
||||
PG_RETURN_DATUM(DirectFunctionCall1(namein, CStringGetDatum(nspname)));
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ current_schemas(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *nspname;
|
||||
|
||||
nspname = get_namespace_name((Oid) lfirsti(search_path));
|
||||
nspname = get_namespace_name(lfirsto(search_path));
|
||||
names[i] = DirectFunctionCall1(namein, CStringGetDatum(nspname));
|
||||
i++;
|
||||
search_path = lnext(search_path);
|
||||
|
16
src/backend/utils/cache/relcache.c
vendored
16
src/backend/utils/cache/relcache.c
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.183 2002/12/16 18:39:22 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.184 2003/02/09 06:56:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2642,20 +2642,20 @@ insert_ordered_oid(List *list, Oid datum)
|
||||
List *l;
|
||||
|
||||
/* Does the datum belong at the front? */
|
||||
if (list == NIL || datum < (Oid) lfirsti(list))
|
||||
return lconsi(datum, list);
|
||||
if (list == NIL || datum < lfirsto(list))
|
||||
return lconso(datum, list);
|
||||
/* No, so find the entry it belongs after */
|
||||
l = list;
|
||||
for (;;)
|
||||
{
|
||||
List *n = lnext(l);
|
||||
|
||||
if (n == NIL || datum < (Oid) lfirsti(n))
|
||||
if (n == NIL || datum < lfirsto(n))
|
||||
break; /* it belongs before n */
|
||||
l = n;
|
||||
}
|
||||
/* Insert datum into list after item l */
|
||||
lnext(l) = lconsi(datum, lnext(l));
|
||||
lnext(l) = lconso(datum, lnext(l));
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -2967,7 +2967,7 @@ load_relcache_init_file(void)
|
||||
{
|
||||
RelationCacheInsert(rels[relno]);
|
||||
/* also make a list of their OIDs, for RelationIdIsInInitFile */
|
||||
initFileRelationIds = lconsi((int) RelationGetRelid(rels[relno]),
|
||||
initFileRelationIds = lconso(RelationGetRelid(rels[relno]),
|
||||
initFileRelationIds);
|
||||
}
|
||||
|
||||
@ -3133,7 +3133,7 @@ write_relcache_init_file(void)
|
||||
|
||||
/* also make a list of their OIDs, for RelationIdIsInInitFile */
|
||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||
initFileRelationIds = lconsi((int) RelationGetRelid(rel),
|
||||
initFileRelationIds = lconso(RelationGetRelid(rel),
|
||||
initFileRelationIds);
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
}
|
||||
@ -3202,7 +3202,7 @@ write_relcache_init_file(void)
|
||||
bool
|
||||
RelationIdIsInInitFile(Oid relationId)
|
||||
{
|
||||
return intMember((int) relationId, initFileRelationIds);
|
||||
return oidMember(relationId, initFileRelationIds);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: parsenodes.h,v 1.227 2003/01/23 23:39:07 petere Exp $
|
||||
* $Id: parsenodes.h,v 1.228 2003/02/09 06:56:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -639,8 +639,7 @@ typedef struct SetOperationStmt
|
||||
/* Eventually add fields for CORRESPONDING spec here */
|
||||
|
||||
/* Fields derived during parse analysis: */
|
||||
List *colTypes; /* integer list of OIDs of output column
|
||||
* types */
|
||||
List *colTypes; /* list of OIDs of output column types */
|
||||
} SetOperationStmt;
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_list.h,v 1.34 2003/02/08 20:20:55 tgl Exp $
|
||||
* $Id: pg_list.h,v 1.35 2003/02/09 06:56:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -61,6 +61,15 @@ typedef struct Value
|
||||
|
||||
/*----------------------
|
||||
* List node
|
||||
*
|
||||
* We support three types of lists:
|
||||
* lists of pointers (in practice always pointers to Nodes, but declare as
|
||||
* "void *" to minimize casting annoyances)
|
||||
* lists of integers
|
||||
* lists of Oids
|
||||
*
|
||||
* (At this writing, ints and Oids are the same size, but they may not always
|
||||
* be so; try to be careful to maintain the distinction.)
|
||||
*----------------------
|
||||
*/
|
||||
typedef struct List
|
||||
@ -70,6 +79,7 @@ typedef struct List
|
||||
{
|
||||
void *ptr_value;
|
||||
int int_value;
|
||||
Oid oid_value;
|
||||
} elem;
|
||||
struct List *next;
|
||||
} List;
|
||||
@ -78,23 +88,31 @@ typedef struct List
|
||||
|
||||
/* ----------------
|
||||
* accessor macros
|
||||
*
|
||||
* The general naming convention is that the base name xyz() is for the
|
||||
* pointer version, xyzi() is for integers, xyzo() is for Oids. We don't
|
||||
* bother with multiple names if the same routine can handle all cases.
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* anything that doesn't end in 'i' is assumed to be referring to the */
|
||||
/* pointer version of the list (where it makes a difference) */
|
||||
#define lfirst(l) ((l)->elem.ptr_value)
|
||||
#define lfirsti(l) ((l)->elem.int_value)
|
||||
#define lfirsto(l) ((l)->elem.oid_value)
|
||||
|
||||
#define lnext(l) ((l)->next)
|
||||
|
||||
#define lsecond(l) lfirst(lnext(l))
|
||||
|
||||
#define lfirsti(l) ((l)->elem.int_value)
|
||||
#define lthird(l) lfirst(lnext(lnext(l)))
|
||||
|
||||
#define lfourth(l) lfirst(lnext(lnext(lnext(l))))
|
||||
|
||||
/*
|
||||
* foreach -
|
||||
* a convenience macro which loops through the list
|
||||
*/
|
||||
#define foreach(_elt_,_list_) \
|
||||
for(_elt_=(_list_); _elt_!=NIL; _elt_=lnext(_elt_))
|
||||
for (_elt_ = (_list_); _elt_ != NIL; _elt_ = lnext(_elt_))
|
||||
|
||||
/*
|
||||
* Convenience macros for building fixed-length lists
|
||||
@ -106,50 +124,49 @@ typedef struct List
|
||||
|
||||
#define makeListi1(x1) lconsi(x1, NIL)
|
||||
#define makeListi2(x1,x2) lconsi(x1, makeListi1(x2))
|
||||
#define makeListi3(x1,x2,x3) lconsi(x1, makeListi2(x2,x3))
|
||||
#define makeListi4(x1,x2,x3,x4) lconsi(x1, makeListi3(x2,x3,x4))
|
||||
|
||||
#define makeListo1(x1) lconso(x1, NIL)
|
||||
#define makeListo2(x1,x2) lconso(x1, makeListo1(x2))
|
||||
|
||||
/*
|
||||
* function prototypes in nodes/list.c
|
||||
*/
|
||||
extern int length(List *list);
|
||||
extern void *llast(List *list);
|
||||
extern List *nconc(List *list1, List *list2);
|
||||
extern List *lcons(void *datum, List *list);
|
||||
extern List *lconsi(int datum, List *list);
|
||||
extern bool member(void *datum, List *list);
|
||||
extern bool ptrMember(void *datum, List *list);
|
||||
extern bool intMember(int datum, List *list);
|
||||
extern Value *makeInteger(long i);
|
||||
extern Value *makeFloat(char *numericStr);
|
||||
extern Value *makeString(char *str);
|
||||
extern Value *makeBitString(char *str);
|
||||
|
||||
extern List *lcons(void *datum, List *list);
|
||||
extern List *lconsi(int datum, List *list);
|
||||
extern List *lconso(Oid datum, List *list);
|
||||
extern List *lappend(List *list, void *datum);
|
||||
extern List *lappendi(List *list, int datum);
|
||||
extern List *lappendo(List *list, Oid datum);
|
||||
extern List *nconc(List *list1, List *list2);
|
||||
extern void *nth(int n, List *l);
|
||||
extern int length(List *list);
|
||||
extern void *llast(List *list);
|
||||
extern bool member(void *datum, List *list);
|
||||
extern bool ptrMember(void *datum, List *list);
|
||||
extern bool intMember(int datum, List *list);
|
||||
extern bool oidMember(Oid datum, List *list);
|
||||
extern List *lremove(void *elem, List *list);
|
||||
extern List *LispRemove(void *elem, List *list);
|
||||
extern List *lremovei(int elem, List *list);
|
||||
extern List *ltruncate(int n, List *list);
|
||||
|
||||
extern void *nth(int n, List *l);
|
||||
extern int nthi(int n, List *l);
|
||||
extern void set_nth(List *l, int n, void *elem);
|
||||
|
||||
extern List *set_union(List *list1, List *list2);
|
||||
extern List *set_unioni(List *list1, List *list2);
|
||||
extern List *set_uniono(List *list1, List *list2);
|
||||
extern List *set_ptrUnion(List *list1, List *list2);
|
||||
extern List *set_intersect(List *l1, List *l2);
|
||||
extern List *set_intersecti(List *list1, List *list2);
|
||||
extern List *set_difference(List *list1, List *list2);
|
||||
extern List *set_differencei(List *list1, List *list2);
|
||||
extern List *set_differenceo(List *list1, List *list2);
|
||||
extern List *set_ptrDifference(List *list1, List *list2);
|
||||
|
||||
extern bool equali(List *list1, List *list2);
|
||||
extern bool equalo(List *list1, List *list2);
|
||||
|
||||
extern void freeList(List *list);
|
||||
|
||||
/* should be in nodes.h but needs List */
|
||||
|
||||
/* in copyfuncs.c */
|
||||
extern List *listCopy(List *list);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: parsetree.h,v 1.19 2002/09/04 20:31:45 momjian Exp $
|
||||
* $Id: parsetree.h,v 1.20 2003/02/09 06:56:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -26,16 +26,12 @@
|
||||
|
||||
/*
|
||||
* rt_fetch
|
||||
* rt_store
|
||||
*
|
||||
* Access and (destructively) replace rangetable entries.
|
||||
* NB: this will crash and burn if handed an out-of-range RT index
|
||||
*/
|
||||
#define rt_fetch(rangetable_index, rangetable) \
|
||||
((RangeTblEntry *) nth((rangetable_index)-1, rangetable))
|
||||
|
||||
#define rt_store(rangetable_index, rangetable, rt) \
|
||||
set_nth(rangetable, (rangetable_index)-1, rt)
|
||||
|
||||
/*
|
||||
* getrelid
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user