Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39b7ec3

Browse files
committed
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 smallstep towards someday supporting 8-byte OIDs. For the moment, it doesn'tdo much except get rid of a lot of unsightly casts.
1 parent3646ab5 commit39b7ec3

34 files changed

+357
-302
lines changed

‎doc/FAQ_DEV

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,8 @@ List *i, *list;
643643
return the i'th element in list.
644644

645645
lconsi, ...
646-
There are integer versions of these: lconsi, lappendi, nthi.
647-
List's containing integers instead of Node pointers are used to
648-
hold list of relation object id's and other integer quantities.
646+
There are integer versions of these: lconsi, lappendi, etc.
647+
Also versions for OID lists: lconso, lappendo, etc.
649648

650649
You can print nodes easily inside gdb. First, to disable output
651650
truncation when you use the gdb print command:

‎doc/src/FAQ/FAQ_DEV.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -779,10 +779,8 @@ <H3><A name="2.3">2.3</A>) Why do we use <I>Node</I> and <I>List</I> to
779779

780780
<DT>lconsi, ...</DT>
781781

782-
<DD>There are integer versions of these:<I>lconsi, lappendi,
783-
nthi.</I><I>List's</I> containing integers instead of Node
784-
pointers are used to hold list of relation object id's and
785-
other integer quantities.</DD>
782+
<DD>There are integer versions of these:<I>lconsi, lappendi</I>,
783+
etc. Also versions for OID lists:<I>lconso, lappendo</I>, etc.</DD>
786784
</DL>
787785
</BLOCKQUOTE>
788786
You can print nodes easily inside<I>gdb.</I> First, to disable

‎src/backend/catalog/dependency.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.20 2003/02/07 01:33:06 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.21 2003/02/09 06:56:26 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -948,7 +948,7 @@ find_expr_references_walker(Node *node,
948948

949949
foreach(opid,sublink->operOids)
950950
{
951-
add_object_address(OCLASS_OPERATOR,(Oid)lfirsti(opid),0,
951+
add_object_address(OCLASS_OPERATOR,lfirsto(opid),0,
952952
&context->addrs);
953953
}
954954
/* fall through to examine arguments */

‎src/backend/catalog/namespace.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
1515
* IDENTIFICATION
16-
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.46 2003/02/07 01:33:06 tgl Exp $
16+
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.47 2003/02/09 06:56:26 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -262,7 +262,7 @@ RelnameGetRelid(const char *relname)
262262

263263
foreach(lptr,namespaceSearchPath)
264264
{
265-
OidnamespaceId=(Oid)lfirsti(lptr);
265+
OidnamespaceId=lfirsto(lptr);
266266

267267
relid=get_relname_relid(relname,namespaceId);
268268
if (OidIsValid(relid))
@@ -300,11 +300,11 @@ RelationIsVisible(Oid relid)
300300
/*
301301
* Quick check: if it ain't in the path at all, it ain't visible.
302302
* Items in the system namespace are surely in the path and so we
303-
* needn't even dointMember() for them.
303+
* needn't even dooidMember() for them.
304304
*/
305305
relnamespace=relform->relnamespace;
306306
if (relnamespace!=PG_CATALOG_NAMESPACE&&
307-
!intMember(relnamespace,namespaceSearchPath))
307+
!oidMember(relnamespace,namespaceSearchPath))
308308
visible= false;
309309
else
310310
{
@@ -342,7 +342,7 @@ TypenameGetTypid(const char *typname)
342342

343343
foreach(lptr,namespaceSearchPath)
344344
{
345-
OidnamespaceId=(Oid)lfirsti(lptr);
345+
OidnamespaceId=lfirsto(lptr);
346346

347347
typid=GetSysCacheOid(TYPENAMENSP,
348348
PointerGetDatum(typname),
@@ -382,11 +382,11 @@ TypeIsVisible(Oid typid)
382382
/*
383383
* Quick check: if it ain't in the path at all, it ain't visible.
384384
* Items in the system namespace are surely in the path and so we
385-
* needn't even dointMember() for them.
385+
* needn't even dooidMember() for them.
386386
*/
387387
typnamespace=typform->typnamespace;
388388
if (typnamespace!=PG_CATALOG_NAMESPACE&&
389-
!intMember(typnamespace,namespaceSearchPath))
389+
!oidMember(typnamespace,namespaceSearchPath))
390390
visible= false;
391391
else
392392
{
@@ -480,7 +480,7 @@ FuncnameGetCandidates(List *names, int nargs)
480480

481481
foreach(nsp,namespaceSearchPath)
482482
{
483-
if (procform->pronamespace==(Oid)lfirsti(nsp))
483+
if (procform->pronamespace==lfirsto(nsp))
484484
break;
485485
pathpos++;
486486
}
@@ -583,11 +583,11 @@ FunctionIsVisible(Oid funcid)
583583
/*
584584
* Quick check: if it ain't in the path at all, it ain't visible.
585585
* Items in the system namespace are surely in the path and so we
586-
* needn't even dointMember() for them.
586+
* needn't even dooidMember() for them.
587587
*/
588588
pronamespace=procform->pronamespace;
589589
if (pronamespace!=PG_CATALOG_NAMESPACE&&
590-
!intMember(pronamespace,namespaceSearchPath))
590+
!oidMember(pronamespace,namespaceSearchPath))
591591
visible= false;
592592
else
593593
{
@@ -695,7 +695,7 @@ OpernameGetCandidates(List *names, char oprkind)
695695

696696
foreach(nsp,namespaceSearchPath)
697697
{
698-
if (operform->oprnamespace==(Oid)lfirsti(nsp))
698+
if (operform->oprnamespace==lfirsto(nsp))
699699
break;
700700
pathpos++;
701701
}
@@ -795,11 +795,11 @@ OperatorIsVisible(Oid oprid)
795795
/*
796796
* Quick check: if it ain't in the path at all, it ain't visible.
797797
* Items in the system namespace are surely in the path and so we
798-
* needn't even dointMember() for them.
798+
* needn't even dooidMember() for them.
799799
*/
800800
oprnamespace=oprform->oprnamespace;
801801
if (oprnamespace!=PG_CATALOG_NAMESPACE&&
802-
!intMember(oprnamespace,namespaceSearchPath))
802+
!oidMember(oprnamespace,namespaceSearchPath))
803803
visible= false;
804804
else
805805
{
@@ -871,7 +871,7 @@ OpclassGetCandidates(Oid amid)
871871
/* Consider only opclasses that are in the search path */
872872
foreach(nsp,namespaceSearchPath)
873873
{
874-
if (opcform->opcnamespace==(Oid)lfirsti(nsp))
874+
if (opcform->opcnamespace==lfirsto(nsp))
875875
break;
876876
pathpos++;
877877
}
@@ -967,7 +967,7 @@ OpclassnameGetOpcid(Oid amid, const char *opcname)
967967

968968
foreach(lptr,namespaceSearchPath)
969969
{
970-
OidnamespaceId=(Oid)lfirsti(lptr);
970+
OidnamespaceId=lfirsto(lptr);
971971

972972
opcid=GetSysCacheOid(CLAAMNAMENSP,
973973
ObjectIdGetDatum(amid),
@@ -1008,11 +1008,11 @@ OpclassIsVisible(Oid opcid)
10081008
/*
10091009
* Quick check: if it ain't in the path at all, it ain't visible.
10101010
* Items in the system namespace are surely in the path and so we
1011-
* needn't even dointMember() for them.
1011+
* needn't even dooidMember() for them.
10121012
*/
10131013
opcnamespace=opcform->opcnamespace;
10141014
if (opcnamespace!=PG_CATALOG_NAMESPACE&&
1015-
!intMember(opcnamespace,namespaceSearchPath))
1015+
!oidMember(opcnamespace,namespaceSearchPath))
10161016
visible= false;
10171017
else
10181018
{
@@ -1049,7 +1049,7 @@ ConversionGetConid(const char *conname)
10491049

10501050
foreach(lptr,namespaceSearchPath)
10511051
{
1052-
OidnamespaceId=(Oid)lfirsti(lptr);
1052+
OidnamespaceId=lfirsto(lptr);
10531053

10541054
conid=GetSysCacheOid(CONNAMENSP,
10551055
PointerGetDatum(conname),
@@ -1089,11 +1089,11 @@ ConversionIsVisible(Oid conid)
10891089
/*
10901090
* Quick check: if it ain't in the path at all, it ain't visible.
10911091
* Items in the system namespace are surely in the path and so we
1092-
* needn't even dointMember() for them.
1092+
* needn't even dooidMember() for them.
10931093
*/
10941094
connamespace=conform->connamespace;
10951095
if (connamespace!=PG_CATALOG_NAMESPACE&&
1096-
!intMember(connamespace,namespaceSearchPath))
1096+
!oidMember(connamespace,namespaceSearchPath))
10971097
visible= false;
10981098
else
10991099
{
@@ -1141,7 +1141,7 @@ DeconstructQualifiedName(List *names,
11411141
case3:
11421142
catalogname=strVal(lfirst(names));
11431143
schemaname=strVal(lsecond(names));
1144-
objname=strVal(lfirst(lnext(lnext(names))));
1144+
objname=strVal(lthird(names));
11451145

11461146
/*
11471147
* We check the catalog name and then ignore it.
@@ -1251,7 +1251,7 @@ makeRangeVarFromNameList(List *names)
12511251
case3:
12521252
rel->catalogname=strVal(lfirst(names));
12531253
rel->schemaname=strVal(lsecond(names));
1254-
rel->relname=strVal(lfirst(lnext(lnext(names))));
1254+
rel->relname=strVal(lthird(names));
12551255
break;
12561256
default:
12571257
elog(ERROR,"Improper relation name (too many dotted names)");
@@ -1402,7 +1402,7 @@ FindConversionByName(List *name)
14021402

14031403
foreach(lptr,namespaceSearchPath)
14041404
{
1405-
namespaceId=(Oid)lfirsti(lptr);
1405+
namespaceId=lfirsto(lptr);
14061406
conoid=FindConversion(conversion_name,namespaceId);
14071407
if (OidIsValid(conoid))
14081408
returnconoid;
@@ -1426,7 +1426,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
14261426

14271427
foreach(lptr,namespaceSearchPath)
14281428
{
1429-
OidnamespaceId=(Oid)lfirsti(lptr);
1429+
OidnamespaceId=lfirsto(lptr);
14301430

14311431
proc=FindDefaultConversion(namespaceId,for_encoding,to_encoding);
14321432
if (OidIsValid(proc))
@@ -1499,10 +1499,10 @@ recomputeNamespacePath(void)
14991499
0,0,0);
15001500
ReleaseSysCache(tuple);
15011501
if (OidIsValid(namespaceId)&&
1502-
!intMember(namespaceId,oidlist)&&
1502+
!oidMember(namespaceId,oidlist)&&
15031503
pg_namespace_aclcheck(namespaceId,userId,
15041504
ACL_USAGE)==ACLCHECK_OK)
1505-
oidlist=lappendi(oidlist,namespaceId);
1505+
oidlist=lappendo(oidlist,namespaceId);
15061506
}
15071507
}
15081508
else
@@ -1512,10 +1512,10 @@ recomputeNamespacePath(void)
15121512
CStringGetDatum(curname),
15131513
0,0,0);
15141514
if (OidIsValid(namespaceId)&&
1515-
!intMember(namespaceId,oidlist)&&
1515+
!oidMember(namespaceId,oidlist)&&
15161516
pg_namespace_aclcheck(namespaceId,userId,
15171517
ACL_USAGE)==ACLCHECK_OK)
1518-
oidlist=lappendi(oidlist,namespaceId);
1518+
oidlist=lappendo(oidlist,namespaceId);
15191519
}
15201520
}
15211521

@@ -1525,23 +1525,23 @@ recomputeNamespacePath(void)
15251525
if (oidlist==NIL)
15261526
firstNS=InvalidOid;
15271527
else
1528-
firstNS=(Oid)lfirsti(oidlist);
1528+
firstNS=lfirsto(oidlist);
15291529

15301530
/*
15311531
* Add any implicitly-searched namespaces to the list.Note these go
15321532
* on the front, not the back; also notice that we do not check USAGE
15331533
* permissions for these.
15341534
*/
1535-
if (!intMember(PG_CATALOG_NAMESPACE,oidlist))
1536-
oidlist=lconsi(PG_CATALOG_NAMESPACE,oidlist);
1535+
if (!oidMember(PG_CATALOG_NAMESPACE,oidlist))
1536+
oidlist=lconso(PG_CATALOG_NAMESPACE,oidlist);
15371537

15381538
if (OidIsValid(myTempNamespace)&&
1539-
!intMember(myTempNamespace,oidlist))
1540-
oidlist=lconsi(myTempNamespace,oidlist);
1539+
!oidMember(myTempNamespace,oidlist))
1540+
oidlist=lconso(myTempNamespace,oidlist);
15411541

15421542
if (OidIsValid(mySpecialNamespace)&&
1543-
!intMember(mySpecialNamespace,oidlist))
1544-
oidlist=lconsi(mySpecialNamespace,oidlist);
1543+
!oidMember(mySpecialNamespace,oidlist))
1544+
oidlist=lconso(mySpecialNamespace,oidlist);
15451545

15461546
/*
15471547
* Now that we've successfully built the new list of namespace OIDs,
@@ -1801,7 +1801,7 @@ InitializeSearchPath(void)
18011801
MemoryContextoldcxt;
18021802

18031803
oldcxt=MemoryContextSwitchTo(TopMemoryContext);
1804-
namespaceSearchPath=makeListi1(PG_CATALOG_NAMESPACE);
1804+
namespaceSearchPath=makeListo1(PG_CATALOG_NAMESPACE);
18051805
MemoryContextSwitchTo(oldcxt);
18061806
defaultCreationNamespace=PG_CATALOG_NAMESPACE;
18071807
firstExplicitNamespace=PG_CATALOG_NAMESPACE;
@@ -1851,7 +1851,7 @@ fetch_search_path(bool includeImplicit)
18511851
result=namespaceSearchPath;
18521852
if (!includeImplicit)
18531853
{
1854-
while (result&&(Oid)lfirsti(result)!=firstExplicitNamespace)
1854+
while (result&&lfirsto(result)!=firstExplicitNamespace)
18551855
result=lnext(result);
18561856
}
18571857

‎src/backend/commands/cluster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.104 2002/12/30 19:45:15 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.105 2003/02/09 06:56:26 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -129,7 +129,7 @@ cluster(ClusterStmt *stmt)
129129
HeapTupleidxtuple;
130130
Form_pg_indexindexForm;
131131

132-
indexOid=lfirsti(index);
132+
indexOid=lfirsto(index);
133133
idxtuple=SearchSysCache(INDEXRELID,
134134
ObjectIdGetDatum(indexOid),
135135
0,0,0);
@@ -527,7 +527,7 @@ get_indexattr_list(Relation OldHeap, Oid OldIndex)
527527
/* Ask the relcache to produce a list of the indexes of the old rel */
528528
foreach(indlist,RelationGetIndexList(OldHeap))
529529
{
530-
OidindexOID=(Oid)lfirsti(indlist);
530+
OidindexOID=lfirsto(indlist);
531531
HeapTupleindexTuple;
532532
HeapTupleclassTuple;
533533
Form_pg_indexindexForm;

‎src/backend/commands/explain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994-5, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.101 2003/02/08 20:20:53 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.102 2003/02/09 06:56:26 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -403,7 +403,7 @@ explain_outNode(StringInfo str,
403403
{
404404
Relationrelation;
405405

406-
relation=index_open(lfirsti(l));
406+
relation=index_open(lfirsto(l));
407407
appendStringInfo(str,"%s%s",
408408
(++i>1) ?", " :"",
409409
quote_identifier(RelationGetRelationName(relation)));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp