7
7
*
8
8
* Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $Id: pg_type.h,v 1.55 1999/03/10 05:02:34 tgl Exp $
10
+ * $Id: pg_type.h,v 1.56 1999/03/25 03:49:25 tgl Exp $
11
11
*
12
12
* NOTES
13
13
* the genbki.sh script reads this file and generates .bki
21
21
#include <utils/rel.h>
22
22
23
23
/* ----------------
24
- * postgres.h contains the system type definintions and the
24
+ * postgres.h contains the system type definitions and the
25
25
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
26
26
* can be read by both genbki.sh and the C compiler.
27
27
* ----------------
@@ -53,44 +53,38 @@ CATALOG(pg_type) BOOTSTRAP
53
53
54
54
/*
55
55
* typbyval determines whether internal Postgres routines pass a value
56
- * of this type by value or by reference. Postgres uses a 4 byte area
57
- * for passing a field value info, so if the value is not 1, 2, or 4
58
- * bytes long, Postgres does not have the option of passing by value
59
- * and ignores typbyval.
60
- *
61
- * (I don't understand why this column exists. The above description may
62
- * be an oversimplification. Also, there appear to be bugs in which
63
- * Postgres doesn't ignore typbyval when it should, but I'm afraid to
64
- * change them until I see proof of damage. -BRYANH 96.08).
65
- *
66
- * (Postgres crashes if typbyval is true, the declared length is 8, and
67
- * the I/O routines are written to expect pass by reference. Note that
68
- * float4 is written for pass by reference and has a declared length
69
- * of 4 bytes, so it looks like pass by reference must be consistant
70
- * with the declared length, and typbyval is used somewhere. - tgl
71
- * 1997-03-20).
56
+ * of this type by value or by reference. Only char, short, and int-
57
+ * equivalent items can be passed by value, so if the type is not
58
+ * 1, 2, or 4 bytes long, Postgres does not have the option of passing
59
+ * by value and so typbyval had better be FALSE. Variable-length types
60
+ * are always passed by reference.
61
+ * Note that typbyval can be false even if the length would allow
62
+ * pass-by-value; this is currently true for type float4, for example.
72
63
*/
73
64
char typtype ;
65
+
66
+ /*
67
+ * typtype is 'b' for a basic type and 'c' for a catalog type (ie a class).
68
+ * If typtype is 'c', typrelid is the OID of the class' entry in pg_class.
69
+ * (Why do we need an entry in pg_type for classes, anyway?)
70
+ */
74
71
bool typisdefined ;
75
72
char typdelim ;
76
- Oid typrelid ;
73
+ Oid typrelid ; /* 0 if not a class type */
77
74
Oid typelem ;
78
75
79
76
/*
80
- * typelem is NULL if this is not an array type. If this is an array
77
+ * typelem is 0 if this is not an array type. If this is an array
81
78
* type, typelem is the OID of the type of the elements of the array
82
79
* (it identifies another row in Table pg_type).
83
- *
84
- * (Note that zero ("0") rather than _null_ is used in the declarations.
85
- * - tgl 97/03/20)
86
80
*/
87
81
regproc typinput ;
88
82
regproc typoutput ;
89
83
regproc typreceive ;
90
84
regproc typsend ;
91
85
char typalign ;
92
86
93
- /*
87
+ /* ----------------
94
88
* typalign is the alignment required when storing a value of this
95
89
* type. It applies to storage on disk as well as most
96
90
* representations of the value inside Postgres. When multiple values
@@ -99,11 +93,18 @@ CATALOG(pg_type) BOOTSTRAP
99
93
* type so that it begins on the specified boundary. The alignment
100
94
* reference is the beginning of the first datum in the sequence.
101
95
*
102
- * 'c' = 1 byte alignment. 's' = 2 byte alignment. 'i' = 4 byte
103
- * alignment. 'd' = 8 byte alignment.
96
+ * 'c' = CHAR alignment, ie no alignment needed.
97
+ * 's' = SHORT alignment (2 bytes on most machines).
98
+ * 'i' = INT alignment (4 bytes on most machines).
99
+ * 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all).
100
+ *
101
+ * See include/utils/memutils.h for the macros that compute these
102
+ * alignment requirements.
104
103
*
105
- * (This might actually be flexible depending on machine architecture,
106
- * but I doubt it - BRYANH 96.08).
104
+ * NOTE: for types used in system tables, it is critical that the
105
+ * size and alignment defined in pg_type agree with the way that the
106
+ * compiler will lay out the field in a struct representing a table row.
107
+ * ----------------
107
108
*/
108
109
text typdefault ; /* VARIABLE LENGTH FIELD */
109
110
} FormData_pg_type ;
@@ -218,21 +219,21 @@ DESCR("array of 8 oid, used in system tables");
218
219
DATA (insert OID = 32 ( SET PGUID - 1 - 1 f r t \054 0 - 1 textin textout textin textout i _null_ ));
219
220
DESCR ("set of tuples" );
220
221
221
- DATA (insert OID = 71 ( pg_type PGUID - 1 - 1 t b t \054 1247 0 foo bar foo bar c _null_ ));
222
- DATA (insert OID = 75 ( pg_attribute PGUID - 1 - 1 t b t \054 1249 0 foo bar foo bar c _null_ ));
223
- DATA (insert OID = 81 ( pg_proc PGUID - 1 - 1 t b t \054 1255 0 foo bar foo bar c _null_ ));
224
- DATA (insert OID = 83 ( pg_class PGUID - 1 - 1 t b t \054 1259 0 foo bar foo bar c _null_ ));
225
- DATA (insert OID = 86 ( pg_shadow PGUID - 1 - 1 t b t \054 1260 0 foo bar foo bar c _null_ ));
226
- DATA (insert OID = 87 ( pg_group PGUID - 1 - 1 t b t \054 1261 0 foo bar foo bar c _null_ ));
227
- DATA (insert OID = 88 ( pg_database PGUID - 1 - 1 t b t \054 1262 0 foo bar foo bar c _null_ ));
228
- DATA (insert OID = 90 ( pg_variable PGUID - 1 - 1 t b t \054 1264 0 foo bar foo bar c _null_ ));
229
- DATA (insert OID = 99 ( pg_log PGUID - 1 - 1 t b t \054 1269 0 foo bar foo bar c _null_ ));
222
+ DATA (insert OID = 71 ( pg_type PGUID 4 4 t c t \054 1247 0 foo bar foo bar i _null_ ));
223
+ DATA (insert OID = 75 ( pg_attribute PGUID 4 4 t c t \054 1249 0 foo bar foo bar i _null_ ));
224
+ DATA (insert OID = 81 ( pg_proc PGUID 4 4 t c t \054 1255 0 foo bar foo bar i _null_ ));
225
+ DATA (insert OID = 83 ( pg_class PGUID 4 4 t c t \054 1259 0 foo bar foo bar i _null_ ));
226
+ DATA (insert OID = 86 ( pg_shadow PGUID 4 4 t c t \054 1260 0 foo bar foo bar i _null_ ));
227
+ DATA (insert OID = 87 ( pg_group PGUID 4 4 t c t \054 1261 0 foo bar foo bar i _null_ ));
228
+ DATA (insert OID = 88 ( pg_database PGUID 4 4 t c t \054 1262 0 foo bar foo bar i _null_ ));
229
+ DATA (insert OID = 90 ( pg_variable PGUID 4 4 t c t \054 1264 0 foo bar foo bar i _null_ ));
230
+ DATA (insert OID = 99 ( pg_log PGUID 4 4 t c t \054 1269 0 foo bar foo bar i _null_ ));
230
231
231
232
/* OIDS 100 - 199 */
232
233
233
- DATA (insert OID = 109 ( pg_attrdef PGUID - 1 - 1 t b t \054 1215 0 foo bar foo bar c _null_ ));
234
- DATA (insert OID = 110 ( pg_relcheck PGUID - 1 - 1 t b t \054 1216 0 foo bar foo bar c _null_ ));
235
- DATA (insert OID = 111 ( pg_trigger PGUID - 1 - 1 t b t \054 1219 0 foo bar foo bar c _null_ ));
234
+ DATA (insert OID = 109 ( pg_attrdef PGUID 4 4 t c t \054 1215 0 foo bar foo bar i _null_ ));
235
+ DATA (insert OID = 110 ( pg_relcheck PGUID 4 4 t c t \054 1216 0 foo bar foo bar i _null_ ));
236
+ DATA (insert OID = 111 ( pg_trigger PGUID 4 4 t c t \054 1219 0 foo bar foo bar i _null_ ));
236
237
237
238
/* OIDS 200 - 299 */
238
239
0 commit comments