7
7
* Portions Copyright (c) 1994, Regents of the University of California
8
8
*
9
9
* 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 $
11
11
*
12
12
* NOTES
13
13
* Eventually, the index information should go through here, too.
24
24
/*---------- AMOP CACHES ---------- */
25
25
26
26
/*
27
- * op_class -
27
+ * op_class
28
28
*
29
29
*Return t iff operator 'opid' is in operator class 'opclass' for
30
30
*access method 'amopid'.
31
- *
32
31
*/
33
32
bool
34
33
op_class (Oid opid ,Oid opclass ,Oid amopid )
@@ -46,11 +45,10 @@ op_class(Oid opid, Oid opclass, Oid amopid)
46
45
/*---------- ATTRIBUTE CACHES ---------- */
47
46
48
47
/*
49
- * get_attname -
48
+ * get_attname
50
49
*
51
50
*Given the relation id and the attribute number,
52
51
*return the "attname" field from the attribute relation.
53
- *
54
52
*/
55
53
char *
56
54
get_attname (Oid relid ,AttrNumber attnum )
@@ -59,7 +57,7 @@ get_attname(Oid relid, AttrNumber attnum)
59
57
60
58
tp = SearchSysCacheTuple (ATTNUM ,
61
59
ObjectIdGetDatum (relid ),
62
- UInt16GetDatum (attnum ),
60
+ Int16GetDatum (attnum ),
63
61
0 ,0 );
64
62
if (HeapTupleIsValid (tp ))
65
63
{
@@ -72,11 +70,10 @@ get_attname(Oid relid, AttrNumber attnum)
72
70
}
73
71
74
72
/*
75
- * get_attnum -
73
+ * get_attnum
76
74
*
77
75
*Given the relation id and the attribute name,
78
76
*return the "attnum" field from the attribute relation.
79
- *
80
77
*/
81
78
AttrNumber
82
79
get_attnum (Oid relid ,char * attname )
@@ -98,11 +95,10 @@ get_attnum(Oid relid, char *attname)
98
95
}
99
96
100
97
/*
101
- * get_atttype -
98
+ * get_atttype
102
99
*
103
100
*Given the relation OID and the attribute number with the relation,
104
101
*return the attribute type OID.
105
- *
106
102
*/
107
103
Oid
108
104
get_atttype (Oid relid ,AttrNumber attnum )
@@ -111,7 +107,7 @@ get_atttype(Oid relid, AttrNumber attnum)
111
107
112
108
tp = SearchSysCacheTuple (ATTNUM ,
113
109
ObjectIdGetDatum (relid ),
114
- UInt16GetDatum (attnum ),
110
+ Int16GetDatum (attnum ),
115
111
0 ,0 );
116
112
if (HeapTupleIsValid (tp ))
117
113
{
@@ -147,11 +143,10 @@ get_attisset(Oid relid, char *attname)
147
143
}
148
144
149
145
/*
150
- * get_atttypmod -
146
+ * get_atttypmod
151
147
*
152
148
*Given the relation id and the attribute number,
153
149
*return the "atttypmod" field from the attribute relation.
154
- *
155
150
*/
156
151
int32
157
152
get_atttypmod (Oid relid ,AttrNumber attnum )
@@ -160,7 +155,7 @@ get_atttypmod(Oid relid, AttrNumber attnum)
160
155
161
156
tp = SearchSysCacheTuple (ATTNUM ,
162
157
ObjectIdGetDatum (relid ),
163
- UInt16GetDatum (attnum ),
158
+ Int16GetDatum (attnum ),
164
159
0 ,0 );
165
160
if (HeapTupleIsValid (tp ))
166
161
{
@@ -272,11 +267,10 @@ get_attdisbursion(Oid relid, AttrNumber attnum, double min_estimate)
272
267
/*---------- OPERATOR CACHE ---------- */
273
268
274
269
/*
275
- * get_opcode -
270
+ * get_opcode
276
271
*
277
272
*Returns the regproc id of the routine used to implement an
278
273
*operator given the operator oid.
279
- *
280
274
*/
281
275
RegProcedure
282
276
get_opcode (Oid opno )
@@ -297,7 +291,7 @@ get_opcode(Oid opno)
297
291
}
298
292
299
293
/*
300
- * get_opname -
294
+ * get_opname
301
295
* returns the name of the operator with the given opno
302
296
*
303
297
* Note: returns a palloc'd copy of the string, or NULL if no such operator.
@@ -321,11 +315,10 @@ get_opname(Oid opno)
321
315
}
322
316
323
317
/*
324
- * op_mergejoinable -
318
+ * op_mergejoinable
325
319
*
326
320
*Returns the left and right sort operators and types corresponding to a
327
321
*mergejoinable operator, or nil if the operator is not mergejoinable.
328
- *
329
322
*/
330
323
bool
331
324
op_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)
344
337
optup -> oprleft == ltype &&
345
338
optup -> oprright == rtype )
346
339
{
347
- * leftOp = ObjectIdGetDatum ( optup -> oprlsortop ) ;
348
- * rightOp = ObjectIdGetDatum ( optup -> oprrsortop ) ;
340
+ * leftOp = optup -> oprlsortop ;
341
+ * rightOp = optup -> oprrsortop ;
349
342
return true;
350
343
}
351
344
}
@@ -356,8 +349,7 @@ op_mergejoinable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp)
356
349
* op_hashjoinable
357
350
*
358
351
* 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.
361
353
*/
362
354
Oid
363
355
op_hashjoinable (Oid opno ,Oid ltype ,Oid rtype )
@@ -393,10 +385,9 @@ get_operator_tuple(Oid opno)
393
385
}
394
386
395
387
/*
396
- * get_commutator -
388
+ * get_commutator
397
389
*
398
390
*Returns the corresponding commutator of an operator.
399
- *
400
391
*/
401
392
Oid
402
393
get_commutator (Oid opno )
@@ -417,10 +408,9 @@ get_commutator(Oid opno)
417
408
}
418
409
419
410
/*
420
- * get_negator -
411
+ * get_negator
421
412
*
422
413
*Returns the corresponding negator of an operator.
423
- *
424
414
*/
425
415
Oid
426
416
get_negator (Oid opno )
@@ -441,10 +431,9 @@ get_negator(Oid opno)
441
431
}
442
432
443
433
/*
444
- * get_oprrest -
434
+ * get_oprrest
445
435
*
446
436
*Returns procedure id for computing selectivity of an operator.
447
- *
448
437
*/
449
438
RegProcedure
450
439
get_oprrest (Oid opno )
@@ -465,10 +454,9 @@ get_oprrest(Oid opno)
465
454
}
466
455
467
456
/*
468
- * get_oprjoin -
457
+ * get_oprjoin
469
458
*
470
459
*Returns procedure id for computing selectivity of a join.
471
- *
472
460
*/
473
461
RegProcedure
474
462
get_oprjoin (Oid opno )
@@ -498,29 +486,23 @@ Oid
498
486
get_func_rettype (Oid funcid )
499
487
{
500
488
HeapTuple func_tuple ;
501
- Oid funcrettype ;
502
489
503
490
func_tuple = SearchSysCacheTuple (PROCOID ,
504
491
ObjectIdGetDatum (funcid ),
505
492
0 ,0 ,0 );
506
-
507
493
if (!HeapTupleIsValid (func_tuple ))
508
494
elog (ERROR ,"Function OID %u does not exist" ,funcid );
509
495
510
- funcrettype = (Oid )
511
- ((Form_pg_proc )GETSTRUCT (func_tuple ))-> prorettype ;
512
-
513
- return funcrettype ;
496
+ return ((Form_pg_proc )GETSTRUCT (func_tuple ))-> prorettype ;
514
497
}
515
498
516
499
/*---------- RELATION CACHE ---------- */
517
500
518
501
#ifdef NOT_USED
519
502
/*
520
- * get_relnatts -
503
+ * get_relnatts
521
504
*
522
505
*Returns the number of attributes for a given relation.
523
- *
524
506
*/
525
507
int
526
508
get_relnatts (Oid relid )
@@ -542,10 +524,9 @@ get_relnatts(Oid relid)
542
524
#endif
543
525
544
526
/*
545
- * get_rel_name -
527
+ * get_rel_name
546
528
*
547
529
*Returns the name of a given relation.
548
- *
549
530
*/
550
531
char *
551
532
get_rel_name (Oid relid )
@@ -568,10 +549,9 @@ get_rel_name(Oid relid)
568
549
/*---------- TYPE CACHE ---------- */
569
550
570
551
/*
571
- * get_typlen -
552
+ * get_typlen
572
553
*
573
554
*Given the type OID, return the length of the type.
574
- *
575
555
*/
576
556
int16
577
557
get_typlen (Oid typid )
@@ -592,11 +572,10 @@ get_typlen(Oid typid)
592
572
}
593
573
594
574
/*
595
- * get_typbyval -
575
+ * get_typbyval
596
576
*
597
577
*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.
600
579
*/
601
580
bool
602
581
get_typbyval (Oid typid )
@@ -610,7 +589,7 @@ get_typbyval(Oid typid)
610
589
{
611
590
Form_pg_type typtup = (Form_pg_type )GETSTRUCT (tp );
612
591
613
- return ( bool ) typtup -> typbyval ;
592
+ return typtup -> typbyval ;
614
593
}
615
594
else
616
595
return false;
@@ -638,7 +617,7 @@ get_typalign(Oid typid)
638
617
#endif
639
618
640
619
/*
641
- * get_typdefault -
620
+ * get_typdefault
642
621
*
643
622
* Given a type OID, return the typdefault field associated with that
644
623
* type, or Datum(NULL) if there is no typdefault. (This implies
@@ -744,12 +723,11 @@ get_typdefault(Oid typid)
744
723
}
745
724
746
725
/*
747
- * get_typtype -
726
+ * get_typtype
748
727
*
749
728
*Given the type OID, find if it is a basic type, a named relation
750
729
*or the generic type 'relation'.
751
730
*It returns the null char if the cache lookup fails...
752
- *
753
731
*/
754
732
#ifdef NOT_USED
755
733
char