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
263263foreach (lptr ,namespaceSearchPath )
264264{
265- Oid namespaceId = ( Oid ) lfirsti (lptr );
265+ Oid namespaceId = lfirsto (lptr );
266266
267267relid = get_relname_relid (relname ,namespaceId );
268268if (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 */
305305relnamespace = relform -> relnamespace ;
306306if (relnamespace != PG_CATALOG_NAMESPACE &&
307- !intMember (relnamespace ,namespaceSearchPath ))
307+ !oidMember (relnamespace ,namespaceSearchPath ))
308308visible = false;
309309else
310310{
@@ -342,7 +342,7 @@ TypenameGetTypid(const char *typname)
342342
343343foreach (lptr ,namespaceSearchPath )
344344{
345- Oid namespaceId = ( Oid ) lfirsti (lptr );
345+ Oid namespaceId = lfirsto (lptr );
346346
347347typid = GetSysCacheOid (TYPENAMENSP ,
348348PointerGetDatum (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 */
387387typnamespace = typform -> typnamespace ;
388388if (typnamespace != PG_CATALOG_NAMESPACE &&
389- !intMember (typnamespace ,namespaceSearchPath ))
389+ !oidMember (typnamespace ,namespaceSearchPath ))
390390visible = false;
391391else
392392{
@@ -480,7 +480,7 @@ FuncnameGetCandidates(List *names, int nargs)
480480
481481foreach (nsp ,namespaceSearchPath )
482482{
483- if (procform -> pronamespace == ( Oid ) lfirsti (nsp ))
483+ if (procform -> pronamespace == lfirsto (nsp ))
484484break ;
485485pathpos ++ ;
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 */
588588pronamespace = procform -> pronamespace ;
589589if (pronamespace != PG_CATALOG_NAMESPACE &&
590- !intMember (pronamespace ,namespaceSearchPath ))
590+ !oidMember (pronamespace ,namespaceSearchPath ))
591591visible = false;
592592else
593593{
@@ -695,7 +695,7 @@ OpernameGetCandidates(List *names, char oprkind)
695695
696696foreach (nsp ,namespaceSearchPath )
697697{
698- if (operform -> oprnamespace == ( Oid ) lfirsti (nsp ))
698+ if (operform -> oprnamespace == lfirsto (nsp ))
699699break ;
700700pathpos ++ ;
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 */
800800oprnamespace = oprform -> oprnamespace ;
801801if (oprnamespace != PG_CATALOG_NAMESPACE &&
802- !intMember (oprnamespace ,namespaceSearchPath ))
802+ !oidMember (oprnamespace ,namespaceSearchPath ))
803803visible = false;
804804else
805805{
@@ -871,7 +871,7 @@ OpclassGetCandidates(Oid amid)
871871/* Consider only opclasses that are in the search path */
872872foreach (nsp ,namespaceSearchPath )
873873{
874- if (opcform -> opcnamespace == ( Oid ) lfirsti (nsp ))
874+ if (opcform -> opcnamespace == lfirsto (nsp ))
875875break ;
876876pathpos ++ ;
877877}
@@ -967,7 +967,7 @@ OpclassnameGetOpcid(Oid amid, const char *opcname)
967967
968968foreach (lptr ,namespaceSearchPath )
969969{
970- Oid namespaceId = ( Oid ) lfirsti (lptr );
970+ Oid namespaceId = lfirsto (lptr );
971971
972972opcid = GetSysCacheOid (CLAAMNAMENSP ,
973973ObjectIdGetDatum (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 */
10131013opcnamespace = opcform -> opcnamespace ;
10141014if (opcnamespace != PG_CATALOG_NAMESPACE &&
1015- !intMember (opcnamespace ,namespaceSearchPath ))
1015+ !oidMember (opcnamespace ,namespaceSearchPath ))
10161016visible = false;
10171017else
10181018{
@@ -1049,7 +1049,7 @@ ConversionGetConid(const char *conname)
10491049
10501050foreach (lptr ,namespaceSearchPath )
10511051{
1052- Oid namespaceId = ( Oid ) lfirsti (lptr );
1052+ Oid namespaceId = lfirsto (lptr );
10531053
10541054conid = GetSysCacheOid (CONNAMENSP ,
10551055PointerGetDatum (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 */
10941094connamespace = conform -> connamespace ;
10951095if (connamespace != PG_CATALOG_NAMESPACE &&
1096- !intMember (connamespace ,namespaceSearchPath ))
1096+ !oidMember (connamespace ,namespaceSearchPath ))
10971097visible = false;
10981098else
10991099{
@@ -1141,7 +1141,7 @@ DeconstructQualifiedName(List *names,
11411141case 3 :
11421142catalogname = strVal (lfirst (names ));
11431143schemaname = 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)
12511251case 3 :
12521252rel -> catalogname = strVal (lfirst (names ));
12531253rel -> schemaname = strVal (lsecond (names ));
1254- rel -> relname = strVal (lfirst ( lnext ( lnext ( names )) ));
1254+ rel -> relname = strVal (lthird ( names ));
12551255break ;
12561256default :
12571257elog (ERROR ,"Improper relation name (too many dotted names)" );
@@ -1402,7 +1402,7 @@ FindConversionByName(List *name)
14021402
14031403foreach (lptr ,namespaceSearchPath )
14041404{
1405- namespaceId = ( Oid ) lfirsti (lptr );
1405+ namespaceId = lfirsto (lptr );
14061406conoid = FindConversion (conversion_name ,namespaceId );
14071407if (OidIsValid (conoid ))
14081408return conoid ;
@@ -1426,7 +1426,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
14261426
14271427foreach (lptr ,namespaceSearchPath )
14281428{
1429- Oid namespaceId = ( Oid ) lfirsti (lptr );
1429+ Oid namespaceId = lfirsto (lptr );
14301430
14311431proc = FindDefaultConversion (namespaceId ,for_encoding ,to_encoding );
14321432if (OidIsValid (proc ))
@@ -1499,10 +1499,10 @@ recomputeNamespacePath(void)
149914990 ,0 ,0 );
15001500ReleaseSysCache (tuple );
15011501if (OidIsValid (namespaceId )&&
1502- !intMember (namespaceId ,oidlist )&&
1502+ !oidMember (namespaceId ,oidlist )&&
15031503pg_namespace_aclcheck (namespaceId ,userId ,
15041504ACL_USAGE )== ACLCHECK_OK )
1505- oidlist = lappendi (oidlist ,namespaceId );
1505+ oidlist = lappendo (oidlist ,namespaceId );
15061506}
15071507}
15081508else
@@ -1512,10 +1512,10 @@ recomputeNamespacePath(void)
15121512CStringGetDatum (curname ),
151315130 ,0 ,0 );
15141514if (OidIsValid (namespaceId )&&
1515- !intMember (namespaceId ,oidlist )&&
1515+ !oidMember (namespaceId ,oidlist )&&
15161516pg_namespace_aclcheck (namespaceId ,userId ,
15171517ACL_USAGE )== ACLCHECK_OK )
1518- oidlist = lappendi (oidlist ,namespaceId );
1518+ oidlist = lappendo (oidlist ,namespaceId );
15191519}
15201520}
15211521
@@ -1525,23 +1525,23 @@ recomputeNamespacePath(void)
15251525if (oidlist == NIL )
15261526firstNS = InvalidOid ;
15271527else
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
15381538if (OidIsValid (myTempNamespace )&&
1539- !intMember (myTempNamespace ,oidlist ))
1540- oidlist = lconsi (myTempNamespace ,oidlist );
1539+ !oidMember (myTempNamespace ,oidlist ))
1540+ oidlist = lconso (myTempNamespace ,oidlist );
15411541
15421542if (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)
18011801MemoryContext oldcxt ;
18021802
18031803oldcxt = MemoryContextSwitchTo (TopMemoryContext );
1804- namespaceSearchPath = makeListi1 (PG_CATALOG_NAMESPACE );
1804+ namespaceSearchPath = makeListo1 (PG_CATALOG_NAMESPACE );
18051805MemoryContextSwitchTo (oldcxt );
18061806defaultCreationNamespace = PG_CATALOG_NAMESPACE ;
18071807firstExplicitNamespace = PG_CATALOG_NAMESPACE ;
@@ -1851,7 +1851,7 @@ fetch_search_path(bool includeImplicit)
18511851result = namespaceSearchPath ;
18521852if (!includeImplicit )
18531853{
1854- while (result && ( Oid ) lfirsti (result )!= firstExplicitNamespace )
1854+ while (result && lfirsto (result )!= firstExplicitNamespace )
18551855result = lnext (result );
18561856}
18571857