77 * Portions Copyright (c) 1994, Regents of the University of California
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.43 2000/07/02 22:00:48 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.44 2000/07/23 03:50:26 tgl Exp $
1111 *
1212 * NOTES
1313 * Eventually, the index information should go through here, too.
2424/*---------- AMOP CACHES ---------- */
2525
2626/*
27- * op_class -
27+ * op_class
2828 *
2929 *Return t iff operator 'opid' is in operator class 'opclass' for
3030 *access method 'amopid'.
31- *
3231 */
3332bool
3433op_class (Oid opid ,Oid opclass ,Oid amopid )
@@ -46,11 +45,10 @@ op_class(Oid opid, Oid opclass, Oid amopid)
4645/*---------- ATTRIBUTE CACHES ---------- */
4746
4847/*
49- * get_attname -
48+ * get_attname
5049 *
5150 *Given the relation id and the attribute number,
5251 *return the "attname" field from the attribute relation.
53- *
5452 */
5553char *
5654get_attname (Oid relid ,AttrNumber attnum )
@@ -59,7 +57,7 @@ get_attname(Oid relid, AttrNumber attnum)
5957
6058tp = SearchSysCacheTuple (ATTNUM ,
6159ObjectIdGetDatum (relid ),
62- UInt16GetDatum (attnum ),
60+ Int16GetDatum (attnum ),
63610 ,0 );
6462if (HeapTupleIsValid (tp ))
6563{
@@ -72,11 +70,10 @@ get_attname(Oid relid, AttrNumber attnum)
7270}
7371
7472/*
75- * get_attnum -
73+ * get_attnum
7674 *
7775 *Given the relation id and the attribute name,
7876 *return the "attnum" field from the attribute relation.
79- *
8077 */
8178AttrNumber
8279get_attnum (Oid relid ,char * attname )
@@ -98,11 +95,10 @@ get_attnum(Oid relid, char *attname)
9895}
9996
10097/*
101- * get_atttype -
98+ * get_atttype
10299 *
103100 *Given the relation OID and the attribute number with the relation,
104101 *return the attribute type OID.
105- *
106102 */
107103Oid
108104get_atttype (Oid relid ,AttrNumber attnum )
@@ -111,7 +107,7 @@ get_atttype(Oid relid, AttrNumber attnum)
111107
112108tp = SearchSysCacheTuple (ATTNUM ,
113109ObjectIdGetDatum (relid ),
114- UInt16GetDatum (attnum ),
110+ Int16GetDatum (attnum ),
1151110 ,0 );
116112if (HeapTupleIsValid (tp ))
117113{
@@ -147,11 +143,10 @@ get_attisset(Oid relid, char *attname)
147143}
148144
149145/*
150- * get_atttypmod -
146+ * get_atttypmod
151147 *
152148 *Given the relation id and the attribute number,
153149 *return the "atttypmod" field from the attribute relation.
154- *
155150 */
156151int32
157152get_atttypmod (Oid relid ,AttrNumber attnum )
@@ -160,7 +155,7 @@ get_atttypmod(Oid relid, AttrNumber attnum)
160155
161156tp = SearchSysCacheTuple (ATTNUM ,
162157ObjectIdGetDatum (relid ),
163- UInt16GetDatum (attnum ),
158+ Int16GetDatum (attnum ),
1641590 ,0 );
165160if (HeapTupleIsValid (tp ))
166161{
@@ -272,11 +267,10 @@ get_attdisbursion(Oid relid, AttrNumber attnum, double min_estimate)
272267/*---------- OPERATOR CACHE ---------- */
273268
274269/*
275- * get_opcode -
270+ * get_opcode
276271 *
277272 *Returns the regproc id of the routine used to implement an
278273 *operator given the operator oid.
279- *
280274 */
281275RegProcedure
282276get_opcode (Oid opno )
@@ -297,7 +291,7 @@ get_opcode(Oid opno)
297291}
298292
299293/*
300- * get_opname -
294+ * get_opname
301295 * returns the name of the operator with the given opno
302296 *
303297 * Note: returns a palloc'd copy of the string, or NULL if no such operator.
@@ -321,11 +315,10 @@ get_opname(Oid opno)
321315}
322316
323317/*
324- * op_mergejoinable -
318+ * op_mergejoinable
325319 *
326320 *Returns the left and right sort operators and types corresponding to a
327321 *mergejoinable operator, or nil if the operator is not mergejoinable.
328- *
329322 */
330323bool
331324op_mergejoinable (Oid opno ,Oid ltype ,Oid rtype ,Oid * leftOp ,Oid * rightOp )
@@ -344,8 +337,8 @@ op_mergejoinable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp)
344337optup -> oprleft == ltype &&
345338optup -> oprright == rtype )
346339{
347- * leftOp = ObjectIdGetDatum ( optup -> oprlsortop ) ;
348- * rightOp = ObjectIdGetDatum ( optup -> oprrsortop ) ;
340+ * leftOp = optup -> oprlsortop ;
341+ * rightOp = optup -> oprrsortop ;
349342return true;
350343}
351344}
@@ -356,8 +349,7 @@ op_mergejoinable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp)
356349 * op_hashjoinable
357350 *
358351 * Returns the hash operator corresponding to a hashjoinable operator,
359- * or nil if the operator is not hashjoinable.
360- *
352+ * or InvalidOid if the operator is not hashjoinable.
361353 */
362354Oid
363355op_hashjoinable (Oid opno ,Oid ltype ,Oid rtype )
@@ -393,10 +385,9 @@ get_operator_tuple(Oid opno)
393385}
394386
395387/*
396- * get_commutator -
388+ * get_commutator
397389 *
398390 *Returns the corresponding commutator of an operator.
399- *
400391 */
401392Oid
402393get_commutator (Oid opno )
@@ -417,10 +408,9 @@ get_commutator(Oid opno)
417408}
418409
419410/*
420- * get_negator -
411+ * get_negator
421412 *
422413 *Returns the corresponding negator of an operator.
423- *
424414 */
425415Oid
426416get_negator (Oid opno )
@@ -441,10 +431,9 @@ get_negator(Oid opno)
441431}
442432
443433/*
444- * get_oprrest -
434+ * get_oprrest
445435 *
446436 *Returns procedure id for computing selectivity of an operator.
447- *
448437 */
449438RegProcedure
450439get_oprrest (Oid opno )
@@ -465,10 +454,9 @@ get_oprrest(Oid opno)
465454}
466455
467456/*
468- * get_oprjoin -
457+ * get_oprjoin
469458 *
470459 *Returns procedure id for computing selectivity of a join.
471- *
472460 */
473461RegProcedure
474462get_oprjoin (Oid opno )
@@ -498,29 +486,23 @@ Oid
498486get_func_rettype (Oid funcid )
499487{
500488HeapTuple func_tuple ;
501- Oid funcrettype ;
502489
503490func_tuple = SearchSysCacheTuple (PROCOID ,
504491ObjectIdGetDatum (funcid ),
5054920 ,0 ,0 );
506-
507493if (!HeapTupleIsValid (func_tuple ))
508494elog (ERROR ,"Function OID %u does not exist" ,funcid );
509495
510- funcrettype = (Oid )
511- ((Form_pg_proc )GETSTRUCT (func_tuple ))-> prorettype ;
512-
513- return funcrettype ;
496+ return ((Form_pg_proc )GETSTRUCT (func_tuple ))-> prorettype ;
514497}
515498
516499/*---------- RELATION CACHE ---------- */
517500
518501#ifdef NOT_USED
519502/*
520- * get_relnatts -
503+ * get_relnatts
521504 *
522505 *Returns the number of attributes for a given relation.
523- *
524506 */
525507int
526508get_relnatts (Oid relid )
@@ -542,10 +524,9 @@ get_relnatts(Oid relid)
542524#endif
543525
544526/*
545- * get_rel_name -
527+ * get_rel_name
546528 *
547529 *Returns the name of a given relation.
548- *
549530 */
550531char *
551532get_rel_name (Oid relid )
@@ -568,10 +549,9 @@ get_rel_name(Oid relid)
568549/*---------- TYPE CACHE ---------- */
569550
570551/*
571- * get_typlen -
552+ * get_typlen
572553 *
573554 *Given the type OID, return the length of the type.
574- *
575555 */
576556int16
577557get_typlen (Oid typid )
@@ -592,11 +572,10 @@ get_typlen(Oid typid)
592572}
593573
594574/*
595- * get_typbyval -
575+ * get_typbyval
596576 *
597577 *Given the type OID, determine whether the type is returned by value or
598- *not. Returns 1 if by value, 0 if by reference.
599- *
578+ *not. Returns true if by value, false if by reference.
600579 */
601580bool
602581get_typbyval (Oid typid )
@@ -610,7 +589,7 @@ get_typbyval(Oid typid)
610589{
611590Form_pg_type typtup = (Form_pg_type )GETSTRUCT (tp );
612591
613- return ( bool ) typtup -> typbyval ;
592+ return typtup -> typbyval ;
614593}
615594else
616595return false;
@@ -638,7 +617,7 @@ get_typalign(Oid typid)
638617#endif
639618
640619/*
641- * get_typdefault -
620+ * get_typdefault
642621 *
643622 * Given a type OID, return the typdefault field associated with that
644623 * type, or Datum(NULL) if there is no typdefault. (This implies
@@ -744,12 +723,11 @@ get_typdefault(Oid typid)
744723}
745724
746725/*
747- * get_typtype -
726+ * get_typtype
748727 *
749728 *Given the type OID, find if it is a basic type, a named relation
750729 *or the generic type 'relation'.
751730 *It returns the null char if the cache lookup fails...
752- *
753731 */
754732#ifdef NOT_USED
755733char