~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to doc/src/sgml/catalogs.sgml

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--
 
2
 Documentation of the system catalogs, directed toward PostgreSQL developers
 
3
 $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.95 2005-01-05 23:42:03 tgl Exp $
 
4
 -->
 
5
 
 
6
<chapter id="catalogs">
 
7
 <title>System Catalogs</title>
 
8
 
 
9
  <para>
 
10
   The system catalogs are the place where a relational database
 
11
   management system stores schema metadata, such as information about
 
12
   tables and columns, and internal bookkeeping information.
 
13
   <productname>PostgreSQL</productname>'s system catalogs are regular
 
14
   tables.  You can drop and recreate the tables, add columns, insert
 
15
   and update values, and severely mess up your system that way.
 
16
   Normally, one should not change the system catalogs by hand, there
 
17
   are always SQL commands to do that.  (For example, <command>CREATE
 
18
   DATABASE</command> inserts a row into the
 
19
   <structname>pg_database</structname> catalog &mdash; and actually
 
20
   creates the database on disk.)  There are some exceptions for
 
21
   particularly esoteric operations, such as adding index access methods.
 
22
  </para>
 
23
 
 
24
 <sect1 id="catalogs-overview">
 
25
  <title>Overview</title>
 
26
 
 
27
  <para>
 
28
   <xref linkend="catalog-table"> lists the system catalogs.
 
29
   More detailed documentation of each catalog follows below.
 
30
  </para>
 
31
 
 
32
  <para>
 
33
   Most system catalogs are copied from the template database during
 
34
   database creation and are thereafter database-specific. A few
 
35
   catalogs are physically shared across all databases in a cluster;
 
36
   these are noted in the descriptions of the individual catalogs.
 
37
  </para>
 
38
 
 
39
  <table id="catalog-table">
 
40
   <title>System Catalogs</title>
 
41
 
 
42
   <tgroup cols="2">
 
43
    <thead>
 
44
     <row>
 
45
      <entry>Catalog Name</entry>
 
46
      <entry>Purpose</entry>
 
47
     </row>
 
48
    </thead>
 
49
 
 
50
    <tbody>
 
51
     <row>
 
52
      <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
 
53
      <entry>aggregate functions</entry>
 
54
     </row>
 
55
 
 
56
     <row>
 
57
      <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
 
58
      <entry>index access methods</entry>
 
59
     </row>
 
60
 
 
61
     <row>
 
62
      <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
 
63
      <entry>access method operators</entry>
 
64
     </row>
 
65
 
 
66
     <row>
 
67
      <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
 
68
      <entry>access method support procedures</entry>
 
69
     </row>
 
70
 
 
71
     <row>
 
72
      <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
 
73
      <entry>column default values</entry>
 
74
     </row>
 
75
 
 
76
     <row>
 
77
      <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
 
78
      <entry>table columns (<quote>attributes</quote>)</entry>
 
79
     </row>
 
80
 
 
81
     <row>
 
82
      <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
 
83
      <entry>casts (data type conversions)</entry>
 
84
     </row>
 
85
 
 
86
     <row>
 
87
      <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
 
88
      <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
 
89
     </row>
 
90
 
 
91
     <row>
 
92
      <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
 
93
      <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
 
94
     </row>
 
95
 
 
96
     <row>
 
97
      <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
 
98
      <entry>encoding conversion information</entry>
 
99
     </row>
 
100
 
 
101
     <row>
 
102
      <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
 
103
      <entry>databases within this database cluster</entry>
 
104
     </row>
 
105
 
 
106
     <row>
 
107
      <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
 
108
      <entry>dependencies between database objects</entry>
 
109
     </row>
 
110
 
 
111
     <row>
 
112
      <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
 
113
      <entry>descriptions or comments on database objects</entry>
 
114
     </row>
 
115
 
 
116
     <row>
 
117
      <entry><link linkend="catalog-pg-group"><structname>pg_group</structname></link></entry>
 
118
      <entry>groups of database users</entry>
 
119
     </row>
 
120
 
 
121
     <row>
 
122
      <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
 
123
      <entry>additional index information</entry>
 
124
     </row>
 
125
 
 
126
     <row>
 
127
      <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
 
128
      <entry>table inheritance hierarchy</entry>
 
129
     </row>
 
130
 
 
131
     <row>
 
132
      <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
 
133
      <entry>languages for writing functions</entry>
 
134
     </row>
 
135
 
 
136
     <row>
 
137
      <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
 
138
      <entry>large objects</entry>
 
139
     </row>
 
140
 
 
141
     <row>
 
142
      <entry><link linkend="catalog-pg-listener"><structname>pg_listener</structname></link></entry>
 
143
      <entry>asynchronous notification support</entry>
 
144
     </row>
 
145
 
 
146
     <row>
 
147
      <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
 
148
      <entry>schemas</entry>
 
149
     </row>
 
150
 
 
151
     <row>
 
152
      <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
 
153
      <entry>index access method operator classes</entry>
 
154
     </row>
 
155
 
 
156
     <row>
 
157
      <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
 
158
      <entry>operators</entry>
 
159
     </row>
 
160
 
 
161
     <row>
 
162
      <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
 
163
      <entry>functions and procedures</entry>
 
164
     </row>
 
165
 
 
166
     <row>
 
167
      <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
 
168
      <entry>query rewrite rules</entry>
 
169
     </row>
 
170
 
 
171
     <row>
 
172
      <entry><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link></entry>
 
173
      <entry>database users</entry>
 
174
     </row>
 
175
 
 
176
     <row>
 
177
      <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
 
178
      <entry>planner statistics</entry>
 
179
     </row>
 
180
 
 
181
     <row>
 
182
      <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
 
183
      <entry>tablespaces within this database cluster</entry>
 
184
     </row>
 
185
 
 
186
     <row>
 
187
      <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
 
188
      <entry>triggers</entry>
 
189
     </row>
 
190
 
 
191
     <row>
 
192
      <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
 
193
      <entry>data types</entry>
 
194
     </row>
 
195
    </tbody>
 
196
   </tgroup>
 
197
  </table>
 
198
 </sect1>
 
199
 
 
200
 
 
201
 <sect1 id="catalog-pg-aggregate">
 
202
  <title><structname>pg_aggregate</structname></title>
 
203
 
 
204
  <indexterm zone="catalog-pg-aggregate">
 
205
   <primary>pg_aggregate</primary>
 
206
  </indexterm>
 
207
 
 
208
  <para>
 
209
   The catalog <structname>pg_aggregate</structname> stores information about
 
210
   aggregate functions.  An aggregate function is a function that
 
211
   operates on a set of values (typically one column from each row
 
212
   that matches a query condition) and returns a single value computed
 
213
   from all these values.  Typical aggregate functions are
 
214
   <function>sum</function>, <function>count</function>, and
 
215
   <function>max</function>.  Each entry in
 
216
   <structname>pg_aggregate</structname> is an extension of an entry
 
217
   in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
 
218
   entry carries the aggregate's name, input and output data types, and
 
219
   other information that is similar to ordinary functions.
 
220
  </para>
 
221
 
 
222
  <table>
 
223
   <title><structname>pg_aggregate</> Columns</title>
 
224
 
 
225
   <tgroup cols=4>
 
226
    <thead>
 
227
     <row>
 
228
      <entry>Name</entry>
 
229
      <entry>Type</entry>
 
230
      <entry>References</entry>
 
231
      <entry>Description</entry>
 
232
     </row>
 
233
    </thead>
 
234
    <tbody>
 
235
     <row>
 
236
      <entry><structfield>aggfnoid</structfield></entry>
 
237
      <entry><type>regproc</type></entry>
 
238
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
239
      <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
 
240
     </row>
 
241
     <row>
 
242
      <entry><structfield>aggtransfn</structfield></entry>
 
243
      <entry><type>regproc</type></entry>
 
244
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
245
      <entry>Transition function</entry>
 
246
     </row>
 
247
     <row>
 
248
      <entry><structfield>aggfinalfn</structfield></entry>
 
249
      <entry><type>regproc</type></entry>
 
250
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
251
      <entry>Final function (zero if none)</entry>
 
252
     </row>
 
253
     <row>
 
254
      <entry><structfield>aggtranstype</structfield></entry>
 
255
      <entry><type>oid</type></entry>
 
256
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
257
      <entry>The type of the aggregate function's internal transition (state) data</entry>
 
258
     </row>
 
259
     <row>
 
260
      <entry><structfield>agginitval</structfield></entry>
 
261
      <entry><type>text</type></entry>
 
262
      <entry></entry>
 
263
      <entry>
 
264
       The initial value of the transition state.  This is a text
 
265
       field containing the initial value in its external string
 
266
       representation.  If the value is null, the transition state
 
267
       value starts out null.
 
268
      </entry>
 
269
     </row>
 
270
    </tbody>
 
271
   </tgroup>
 
272
  </table>
 
273
 
 
274
  <para>
 
275
   New aggregate functions are registered with the <command>CREATE
 
276
   AGGREGATE</command> command.  See <xref linkend="xaggr"> for more
 
277
   information about writing aggregate functions and the meaning of
 
278
   the transition functions, etc.
 
279
  </para>
 
280
 
 
281
 </sect1>
 
282
 
 
283
 
 
284
 <sect1 id="catalog-pg-am">
 
285
  <title><structname>pg_am</structname></title>
 
286
 
 
287
  <indexterm zone="catalog-pg-am">
 
288
   <primary>pg_am</primary>
 
289
  </indexterm>
 
290
 
 
291
  <para>
 
292
   The catalog <structname>pg_am</structname> stores information about index access
 
293
   methods.  There is one row for each index access method supported by
 
294
   the system.
 
295
  </para>
 
296
 
 
297
  <table>
 
298
   <title><structname>pg_am</> Columns</title>
 
299
 
 
300
   <tgroup cols=4>
 
301
    <thead>
 
302
     <row>
 
303
      <entry>Name</entry>
 
304
      <entry>Type</entry>
 
305
      <entry>References</entry>
 
306
      <entry>Description</entry>
 
307
     </row>
 
308
    </thead>
 
309
    <tbody>
 
310
 
 
311
     <row>
 
312
      <entry><structfield>amname</structfield></entry>
 
313
      <entry><type>name</type></entry>
 
314
      <entry></entry>
 
315
      <entry>Name of the access method</entry>
 
316
     </row>
 
317
 
 
318
     <row>
 
319
      <entry><structfield>amowner</structfield></entry>
 
320
      <entry><type>int4</type></entry>
 
321
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
322
      <entry>User ID of the owner (currently not used)</entry>
 
323
     </row>
 
324
 
 
325
     <row>
 
326
      <entry><structfield>amstrategies</structfield></entry>
 
327
      <entry><type>int2</type></entry>
 
328
      <entry></entry>
 
329
      <entry>Number of operator strategies for this access method</entry>
 
330
     </row>
 
331
 
 
332
     <row>
 
333
      <entry><structfield>amsupport</structfield></entry>
 
334
      <entry><type>int2</type></entry>
 
335
      <entry></entry>
 
336
      <entry>Number of support routines for this access method</entry>
 
337
     </row>
 
338
 
 
339
     <row>
 
340
      <entry><structfield>amorderstrategy</structfield></entry>
 
341
      <entry><type>int2</type></entry>
 
342
      <entry></entry>
 
343
      <entry>Zero if the index offers no sort order, otherwise the strategy
 
344
      number of the strategy operator that describes the sort order</entry>
 
345
     </row>
 
346
 
 
347
     <row>
 
348
      <entry><structfield>amcanunique</structfield></entry>
 
349
      <entry><type>bool</type></entry>
 
350
      <entry></entry>
 
351
      <entry>Does the access method support unique indexes?</entry>
 
352
     </row>
 
353
 
 
354
     <row>
 
355
      <entry><structfield>amcanmulticol</structfield></entry>
 
356
      <entry><type>bool</type></entry>
 
357
      <entry></entry>
 
358
      <entry>Does the access method support multicolumn indexes?</entry>
 
359
     </row>
 
360
 
 
361
     <row>
 
362
      <entry><structfield>amindexnulls</structfield></entry>
 
363
      <entry><type>bool</type></entry>
 
364
      <entry></entry>
 
365
      <entry>Does the access method support null index entries?</entry>
 
366
     </row>
 
367
 
 
368
     <row>
 
369
      <entry><structfield>amconcurrent</structfield></entry>
 
370
      <entry><type>bool</type></entry>
 
371
      <entry></entry>
 
372
      <entry>Does the access method support concurrent updates?</entry>
 
373
     </row>
 
374
 
 
375
     <row>
 
376
      <entry><structfield>amgettuple</structfield></entry>
 
377
      <entry><type>regproc</type></entry>
 
378
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
379
      <entry><quote>Next valid tuple</quote> function</entry>
 
380
     </row>
 
381
 
 
382
     <row>
 
383
      <entry><structfield>aminsert</structfield></entry>
 
384
      <entry><type>regproc</type></entry>
 
385
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
386
      <entry><quote>Insert this tuple</quote> function</entry>
 
387
     </row>
 
388
 
 
389
     <row>
 
390
      <entry><structfield>ambeginscan</structfield></entry>
 
391
      <entry><type>regproc</type></entry>
 
392
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
393
      <entry><quote>Start new scan</quote> function</entry>
 
394
     </row>
 
395
 
 
396
     <row>
 
397
      <entry><structfield>amrescan</structfield></entry>
 
398
      <entry><type>regproc</type></entry>
 
399
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
400
      <entry><quote>Restart this scan</quote> function</entry>
 
401
     </row>
 
402
 
 
403
     <row>
 
404
      <entry><structfield>amendscan</structfield></entry>
 
405
      <entry><type>regproc</type></entry>
 
406
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
407
      <entry><quote>End this scan</quote> function</entry>
 
408
     </row>
 
409
 
 
410
     <row>
 
411
      <entry><structfield>ammarkpos</structfield></entry>
 
412
      <entry><type>regproc</type></entry>
 
413
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
414
      <entry><quote>Mark current scan position</quote> function</entry>
 
415
     </row>
 
416
 
 
417
     <row>
 
418
      <entry><structfield>amrestrpos</structfield></entry>
 
419
      <entry><type>regproc</type></entry>
 
420
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
421
      <entry><quote>Restore marked scan position</quote> function</entry>
 
422
     </row>
 
423
 
 
424
     <row>
 
425
      <entry><structfield>ambuild</structfield></entry>
 
426
      <entry><type>regproc</type></entry>
 
427
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
428
      <entry><quote>Build new index</quote> function</entry>
 
429
     </row>
 
430
 
 
431
     <row>
 
432
      <entry><structfield>ambulkdelete</structfield></entry>
 
433
      <entry><type>regproc</type></entry>
 
434
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
435
      <entry>Bulk-delete function</entry>
 
436
     </row>
 
437
 
 
438
     <row>
 
439
      <entry><structfield>amvacuumcleanup</structfield></entry>
 
440
      <entry><type>regproc</type></entry>
 
441
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
442
      <entry>Post-<command>VACUUM</command> cleanup function</entry>
 
443
     </row>
 
444
 
 
445
     <row>
 
446
      <entry><structfield>amcostestimate</structfield></entry>
 
447
      <entry><type>regproc</type></entry>
 
448
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
449
      <entry>Function to estimate cost of an index scan</entry>
 
450
     </row>
 
451
 
 
452
    </tbody>
 
453
   </tgroup>
 
454
  </table>
 
455
 
 
456
   <para>
 
457
    An index access method that supports multiple columns (has
 
458
    <structfield>amcanmulticol</structfield> true) <emphasis>must</>
 
459
    support indexing null values in columns after the first, because the planner
 
460
    will assume the index can be used for queries on just the first
 
461
    column(s).  For example, consider an index on (a,b) and a query with
 
462
    <literal>WHERE a = 4</literal>.  The system will assume the index can be used to scan for
 
463
    rows with <literal>a = 4</literal>, which is wrong if the index omits rows where <literal>b</> is null.
 
464
    It is, however, OK to omit rows where the first indexed column is null.
 
465
    (GiST currently does so.)
 
466
    <structfield>amindexnulls</structfield> should be set true only if the
 
467
    index access method indexes all rows, including arbitrary combinations of null values.
 
468
   </para>
 
469
 
 
470
 </sect1>
 
471
 
 
472
 
 
473
 <sect1 id="catalog-pg-amop">
 
474
  <title><structname>pg_amop</structname></title>
 
475
 
 
476
  <indexterm zone="catalog-pg-amop">
 
477
   <primary>pg_amop</primary>
 
478
  </indexterm>
 
479
 
 
480
  <para>
 
481
   The catalog <structname>pg_amop</structname> stores information about operators
 
482
   associated with index access method operator classes.  There is one
 
483
   row for each operator that is a member of an operator class.
 
484
  </para>
 
485
 
 
486
  <table>
 
487
   <title><structname>pg_amop</> Columns</title>
 
488
 
 
489
   <tgroup cols=4>
 
490
    <thead>
 
491
     <row>
 
492
      <entry>Name</entry>
 
493
      <entry>Type</entry>
 
494
      <entry>References</entry>
 
495
      <entry>Description</entry>
 
496
     </row>
 
497
    </thead>
 
498
    <tbody>
 
499
 
 
500
     <row>
 
501
      <entry><structfield>amopclaid</structfield></entry>
 
502
      <entry><type>oid</type></entry>
 
503
      <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
 
504
      <entry>The index operator class this entry is for</entry>
 
505
     </row>
 
506
 
 
507
     <row>
 
508
      <entry><structfield>amopsubtype</structfield></entry>
 
509
      <entry><type>oid</type></entry>
 
510
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
511
      <entry>Subtype to distinguish multiple entries for one strategy;
 
512
             zero for default</entry>
 
513
     </row>
 
514
 
 
515
     <row>
 
516
      <entry><structfield>amopstrategy</structfield></entry>
 
517
      <entry><type>int2</type></entry>
 
518
      <entry></entry>
 
519
      <entry>Operator strategy number</entry>
 
520
     </row>
 
521
 
 
522
     <row>
 
523
      <entry><structfield>amopreqcheck</structfield></entry>
 
524
      <entry><type>bool</type></entry>
 
525
      <entry></entry>
 
526
      <entry>Index hit must be rechecked</entry>
 
527
     </row>
 
528
 
 
529
     <row>
 
530
      <entry><structfield>amopopr</structfield></entry>
 
531
      <entry><type>oid</type></entry>
 
532
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
533
      <entry>OID of the operator</entry>
 
534
     </row>
 
535
 
 
536
    </tbody>
 
537
   </tgroup>
 
538
  </table>
 
539
 
 
540
 </sect1>
 
541
 
 
542
 
 
543
 <sect1 id="catalog-pg-amproc">
 
544
  <title><structname>pg_amproc</structname></title>
 
545
 
 
546
  <indexterm zone="catalog-pg-amproc">
 
547
   <primary>pg_amproc</primary>
 
548
  </indexterm>
 
549
 
 
550
  <para>
 
551
   The catalog <structname>pg_amproc</structname> stores information about support
 
552
   procedures
 
553
   associated with index access method operator classes.  There is one
 
554
   row for each support procedure belonging to an operator class.
 
555
  </para>
 
556
 
 
557
  <table>
 
558
   <title><structname>pg_amproc</structname> Columns</title>
 
559
 
 
560
   <tgroup cols=4>
 
561
    <thead>
 
562
     <row>
 
563
      <entry>Name</entry>
 
564
      <entry>Type</entry>
 
565
      <entry>References</entry>
 
566
      <entry>Description</entry>
 
567
     </row>
 
568
    </thead>
 
569
    <tbody>
 
570
 
 
571
     <row>
 
572
      <entry><structfield>amopclaid</structfield></entry>
 
573
      <entry><type>oid</type></entry>
 
574
      <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
 
575
      <entry>The index operator class this entry is for</entry>
 
576
     </row>
 
577
 
 
578
     <row>
 
579
      <entry><structfield>amprocsubtype</structfield></entry>
 
580
      <entry><type>oid</type></entry>
 
581
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
582
      <entry>Subtype, if cross-type routine, else zero</entry>
 
583
     </row>
 
584
 
 
585
     <row>
 
586
      <entry><structfield>amprocnum</structfield></entry>
 
587
      <entry><type>int2</type></entry>
 
588
      <entry></entry>
 
589
      <entry>Support procedure number</entry>
 
590
     </row>
 
591
 
 
592
     <row>
 
593
      <entry><structfield>amproc</structfield></entry>
 
594
      <entry><type>regproc</type></entry>
 
595
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
596
      <entry>OID of the procedure</entry>
 
597
     </row>
 
598
 
 
599
    </tbody>
 
600
   </tgroup>
 
601
  </table>
 
602
 
 
603
 </sect1>
 
604
 
 
605
 
 
606
 <sect1 id="catalog-pg-attrdef">
 
607
  <title><structname>pg_attrdef</structname></title>
 
608
 
 
609
  <indexterm zone="catalog-pg-attrdef">
 
610
   <primary>pg_attrdef</primary>
 
611
  </indexterm>
 
612
 
 
613
  <para>
 
614
   The catalog <structname>pg_attrdef</structname> stores column default values.  The main information
 
615
   about columns is stored in <structname>pg_attribute</structname>
 
616
   (see below).  Only columns that explicitly specify a default value
 
617
   (when the table is created or the column is added) will have an
 
618
   entry here.
 
619
  </para>
 
620
 
 
621
  <table>
 
622
   <title><structname>pg_attrdef</> Columns</title>
 
623
 
 
624
   <tgroup cols=4>
 
625
    <thead>
 
626
     <row>
 
627
      <entry>Name</entry>
 
628
      <entry>Type</entry>
 
629
      <entry>References</entry>
 
630
      <entry>Description</entry>
 
631
     </row>
 
632
    </thead>
 
633
 
 
634
    <tbody>
 
635
     <row>
 
636
      <entry><structfield>adrelid</structfield></entry>
 
637
      <entry><type>oid</type></entry>
 
638
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
639
      <entry>The table this column belongs to</entry>
 
640
     </row>
 
641
 
 
642
     <row>
 
643
      <entry><structfield>adnum</structfield></entry>
 
644
      <entry><type>int2</type></entry>
 
645
      <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
 
646
      <entry>The number of the column</entry>
 
647
     </row>
 
648
 
 
649
     <row>
 
650
      <entry><structfield>adbin</structfield></entry>
 
651
      <entry><type>text</type></entry>
 
652
      <entry></entry>
 
653
      <entry>The internal representation of the column default value</entry>
 
654
     </row>
 
655
 
 
656
     <row>
 
657
      <entry><structfield>adsrc</structfield></entry>
 
658
      <entry><type>text</type></entry>
 
659
      <entry></entry>
 
660
      <entry>A human-readable representation of the default value</entry>
 
661
     </row>
 
662
    </tbody>
 
663
   </tgroup>
 
664
  </table>
 
665
 
 
666
   <para>
 
667
    The <structfield>adsrc</structfield> field is historical, and is best
 
668
    not used, because it does not track outside changes that might affect
 
669
    the representation of the default value.  Reverse-compiling the
 
670
    <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
 
671
    example) is a better way to display the default value.
 
672
   </para>
 
673
 
 
674
 </sect1>
 
675
 
 
676
 
 
677
 <sect1 id="catalog-pg-attribute">
 
678
  <title><structname>pg_attribute</structname></title>
 
679
 
 
680
  <indexterm zone="catalog-pg-attribute">
 
681
   <primary>pg_attribute</primary>
 
682
  </indexterm>
 
683
 
 
684
  <para>
 
685
   The catalog <structname>pg_attribute</structname> stores information about
 
686
   table columns.  There will be exactly one
 
687
   <structname>pg_attribute</structname> row for every column in every
 
688
   table in the database.  (There will also be attribute entries for
 
689
   indexes, and indeed all objects that have <structname>pg_class</structname>
 
690
   entries.)
 
691
  </para>
 
692
 
 
693
  <para>
 
694
   The term attribute is equivalent to column and is used for
 
695
   historical reasons.
 
696
  </para>
 
697
 
 
698
  <table>
 
699
   <title><structname>pg_attribute</> Columns</title>
 
700
 
 
701
   <tgroup cols=4>
 
702
    <thead>
 
703
     <row>
 
704
      <entry>Name</entry>
 
705
      <entry>Type</entry>
 
706
      <entry>References</entry>
 
707
      <entry>Description</entry>
 
708
     </row>
 
709
    </thead>
 
710
 
 
711
    <tbody>
 
712
     <row>
 
713
      <entry><structfield>attrelid</structfield></entry>
 
714
      <entry><type>oid</type></entry>
 
715
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
716
      <entry>The table this column belongs to</entry>
 
717
     </row>
 
718
 
 
719
     <row>
 
720
      <entry><structfield>attname</structfield></entry>
 
721
      <entry><type>name</type></entry>
 
722
      <entry></entry>
 
723
      <entry>The column name</entry>
 
724
     </row>
 
725
 
 
726
     <row>
 
727
      <entry><structfield>atttypid</structfield></entry>
 
728
      <entry><type>oid</type></entry>
 
729
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
730
      <entry>The data type of this column</entry>
 
731
     </row>
 
732
 
 
733
     <row>
 
734
      <entry><structfield>attstattarget</structfield></entry>
 
735
      <entry><type>int4</type></entry>
 
736
      <entry></entry>
 
737
      <entry>
 
738
       <structfield>attstattarget</structfield> controls the level of detail
 
739
       of statistics accumulated for this column by
 
740
       <xref linkend="sql-analyze" endterm="sql-analyze-title">.
 
741
       A zero value indicates that no statistics should be collected.
 
742
       A negative value says to use the system default statistics target.
 
743
       The exact meaning of positive values is data type-dependent.
 
744
       For scalar data types, <structfield>attstattarget</structfield>
 
745
       is both the target number of <quote>most common values</quote>
 
746
       to collect, and the target number of histogram bins to create.
 
747
      </entry>
 
748
     </row>
 
749
 
 
750
     <row>
 
751
      <entry><structfield>attlen</structfield></entry>
 
752
      <entry><type>int2</type></entry>
 
753
      <entry></entry>
 
754
      <entry>
 
755
       A copy of <literal>pg_type.typlen</literal> of this column's
 
756
       type
 
757
      </entry>
 
758
     </row>
 
759
 
 
760
     <row>
 
761
      <entry><structfield>attnum</structfield></entry>
 
762
      <entry><type>int2</type></entry>
 
763
      <entry></entry>
 
764
      <entry>
 
765
       The number of the column.  Ordinary columns are numbered from 1
 
766
       up.  System columns, such as <structfield>oid</structfield>,
 
767
       have (arbitrary) negative numbers.
 
768
      </entry>
 
769
     </row>
 
770
 
 
771
     <row>
 
772
      <entry><structfield>attndims</structfield></entry>
 
773
      <entry><type>int4</type></entry>
 
774
      <entry></entry>
 
775
      <entry>
 
776
       Number of dimensions, if the column is an array type; otherwise 0.
 
777
       (Presently, the number of dimensions of an array is not enforced,
 
778
       so any nonzero value effectively means <quote>it's an array</>.)
 
779
      </entry>
 
780
     </row>
 
781
 
 
782
     <row>
 
783
      <entry><structfield>attcacheoff</structfield></entry>
 
784
      <entry><type>int4</type></entry>
 
785
      <entry></entry>
 
786
      <entry>
 
787
       Always -1 in storage, but when loaded into a row descriptor
 
788
       in memory this may be updated to cache the offset of the attribute
 
789
       within the row.
 
790
      </entry>
 
791
     </row>
 
792
 
 
793
     <row>
 
794
      <entry><structfield>atttypmod</structfield></entry>
 
795
      <entry><type>int4</type></entry>
 
796
      <entry></entry>
 
797
      <entry>
 
798
       <structfield>atttypmod</structfield> records type-specific data
 
799
       supplied at table creation time (for example, the maximum
 
800
       length of a <type>varchar</type> column).  It is passed to
 
801
       type-specific input functions and length coercion functions.
 
802
       The value will generally be -1 for types that do not need <structfield>atttypmod</>.
 
803
      </entry>
 
804
     </row>
 
805
 
 
806
     <row>
 
807
      <entry><structfield>attbyval</structfield></entry>
 
808
      <entry><type>bool</type></entry>
 
809
      <entry></entry>
 
810
      <entry>
 
811
       A copy of <literal>pg_type.typbyval</> of this column's type
 
812
      </entry>
 
813
     </row>
 
814
 
 
815
     <row>
 
816
      <entry><structfield>attstorage</structfield></entry>
 
817
      <entry><type>char</type></entry>
 
818
      <entry></entry>
 
819
      <entry>
 
820
       Normally a copy of <literal>pg_type.typstorage</> of this
 
821
       column's type.  For TOAST-able data types, this can be altered
 
822
       after column creation to control storage policy.
 
823
      </entry>
 
824
     </row>
 
825
 
 
826
     <row>
 
827
      <entry><structfield>attalign</structfield></entry>
 
828
      <entry><type>char</type></entry>
 
829
      <entry></entry>
 
830
      <entry>
 
831
       A copy of <literal>pg_type.typalign</> of this column's type
 
832
      </entry>
 
833
     </row>
 
834
 
 
835
     <row>
 
836
      <entry><structfield>attnotnull</structfield></entry>
 
837
      <entry><type>bool</type></entry>
 
838
      <entry></entry>
 
839
      <entry>
 
840
       This represents a not-null constraint.  It is possible to
 
841
       change this column to enable or disable the constraint.
 
842
      </entry>
 
843
     </row>
 
844
 
 
845
     <row>
 
846
      <entry><structfield>atthasdef</structfield></entry>
 
847
      <entry><type>bool</type></entry>
 
848
      <entry></entry>
 
849
      <entry>
 
850
       This column has a default value, in which case there will be a
 
851
       corresponding entry in the <structname>pg_attrdef</structname>
 
852
       catalog that actually defines the value.
 
853
      </entry>
 
854
     </row>
 
855
 
 
856
     <row>
 
857
      <entry><structfield>attisdropped</structfield></entry>
 
858
      <entry><type>bool</type></entry>
 
859
      <entry></entry>
 
860
      <entry>
 
861
       This column has been dropped and is no longer valid.  A dropped
 
862
       column is still physically present in the table, but is
 
863
       ignored by the parser and so cannot be accessed via SQL.
 
864
      </entry>
 
865
     </row>
 
866
 
 
867
     <row>
 
868
      <entry><structfield>attislocal</structfield></entry>
 
869
      <entry><type>bool</type></entry>
 
870
      <entry></entry>
 
871
      <entry>
 
872
       This column is defined locally in the relation.  Note that a column may
 
873
       be locally defined and inherited simultaneously.
 
874
      </entry>
 
875
     </row>
 
876
 
 
877
     <row>
 
878
      <entry><structfield>attinhcount</structfield></entry>
 
879
      <entry><type>int4</type></entry>
 
880
      <entry></entry>
 
881
      <entry>
 
882
       The number of direct ancestors this column has.  A column with a 
 
883
       nonzero number of ancestors cannot be dropped nor renamed.
 
884
      </entry>
 
885
     </row>
 
886
 
 
887
    </tbody>
 
888
   </tgroup>
 
889
  </table>
 
890
 
 
891
  <para>
 
892
   In a dropped column's <structname>pg_attribute</structname> entry,
 
893
   <structfield>atttypid</structfield> is reset to zero, but 
 
894
   <structfield>attlen</structfield> and the other fields copied from
 
895
   <structname>pg_type</> are still valid.  This arrangement is needed
 
896
   to cope with the situation where the dropped column's data type was
 
897
   later dropped, and so there is no <structname>pg_type</> row anymore.
 
898
   <structfield>attlen</structfield> and the other fields can be used
 
899
   to interpret the contents of a row of the table.
 
900
  </para>
 
901
 </sect1>
 
902
 
 
903
 
 
904
 <sect1 id="catalog-pg-cast">
 
905
  <title><structname>pg_cast</structname></title>
 
906
 
 
907
  <indexterm zone="catalog-pg-cast">
 
908
   <primary>pg_cast</primary>
 
909
  </indexterm>
 
910
 
 
911
  <para>
 
912
   The catalog <structname>pg_cast</structname> stores data type conversion paths,
 
913
   both built-in paths and those defined with <command>CREATE CAST</command>.
 
914
  </para>
 
915
 
 
916
  <table>
 
917
   <title><structfield>pg_cast</> Columns</title>
 
918
 
 
919
   <tgroup cols=4>
 
920
    <thead>
 
921
     <row>
 
922
      <entry>Name</entry>
 
923
      <entry>Type</entry>
 
924
      <entry>References</entry>
 
925
      <entry>Description</entry>
 
926
     </row>
 
927
    </thead>
 
928
 
 
929
    <tbody>
 
930
     <row>
 
931
      <entry><structfield>castsource</structfield></entry>
 
932
      <entry><type>oid</type></entry>
 
933
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
934
      <entry>OID of the source data type</entry>
 
935
     </row>
 
936
 
 
937
     <row>
 
938
      <entry><structfield>casttarget</structfield></entry>
 
939
      <entry><type>oid</type></entry>
 
940
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
941
      <entry>OID of the target data type</entry>
 
942
     </row>
 
943
 
 
944
     <row>
 
945
      <entry><structfield>castfunc</structfield></entry>
 
946
      <entry><type>oid</type></entry>
 
947
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
948
      <entry>
 
949
       The OID of the function to use to perform this cast.  Zero is
 
950
       stored if the data types are binary compatible (that is, no
 
951
       run-time operation is needed to perform the cast).
 
952
      </entry>
 
953
     </row>
 
954
 
 
955
     <row>
 
956
      <entry><structfield>castcontext</structfield></entry>
 
957
      <entry><type>char</type></entry>
 
958
      <entry></entry>
 
959
      <entry>
 
960
       Indicates what contexts the cast may be invoked in.
 
961
       <literal>e</> means only as an explicit cast (using
 
962
       <literal>CAST</> or <literal>::</> syntax).
 
963
       <literal>a</> means implicitly in assignment
 
964
       to a target column, as well as explicitly.
 
965
       <literal>i</> means implicitly in expressions, as well as the
 
966
       other cases.
 
967
      </entry>
 
968
     </row>
 
969
    </tbody>
 
970
   </tgroup>
 
971
  </table>
 
972
 
 
973
  <para>
 
974
   The cast functions listed in <structname>pg_cast</structname> must
 
975
   always take the cast source type as their first argument type, and
 
976
   return the cast destination type as their result type.  A cast
 
977
   function can have up to three arguments.  The second argument,
 
978
   if present, must be type <type>integer</>; it receives the type
 
979
   modifier associated with the destination type, or <literal>-1</>
 
980
   if there is none.  The third argument,
 
981
   if present, must be type <type>boolean</>; it receives <literal>true</>
 
982
   if the cast is an explicit cast, <literal>false</> otherwise.
 
983
  </para>
 
984
 
 
985
  <para>
 
986
   It is legitimate to create a <structname>pg_cast</structname> entry
 
987
   in which the source and target types are the same, if the associated
 
988
   function takes more than one argument.  Such entries represent
 
989
   <quote>length coercion functions</> that coerce values of the type
 
990
   to be legal for a particular type modifier value.  Note however that
 
991
   at present there is no support for associating non-default type
 
992
   modifiers with user-created data types, and so this facility is only
 
993
   of use for the small number of built-in types that have type modifier
 
994
   syntax built into the grammar.
 
995
  </para>
 
996
 
 
997
  <para>
 
998
   When a <structname>pg_cast</structname> entry has different source and
 
999
   target types and a function that takes more than one argument, it
 
1000
   represents converting from one type to another and applying a length
 
1001
   coercion in a single step.  When no such entry is available, coercion
 
1002
   to a type that uses a type modifier involves two steps, one to
 
1003
   convert between data types and a second to apply the modifier.
 
1004
  </para>
 
1005
 </sect1>
 
1006
 
 
1007
 <sect1 id="catalog-pg-class">
 
1008
  <title><structname>pg_class</structname></title>
 
1009
 
 
1010
  <indexterm zone="catalog-pg-class">
 
1011
   <primary>pg_class</primary>
 
1012
  </indexterm>
 
1013
 
 
1014
  <para>
 
1015
   The catalog <structname>pg_class</structname> catalogs tables and most
 
1016
   everything else that has columns or is otherwise similar to a
 
1017
   table.  This includes indexes (but see also
 
1018
   <structname>pg_index</structname>), sequences, views, composite types,
 
1019
   and some kinds of special relation; see <structfield>relkind</>.
 
1020
   Below, when we mean all of these
 
1021
   kinds of objects we speak of <quote>relations</quote>.  Not all
 
1022
   columns are meaningful for all relation types.
 
1023
  </para>
 
1024
 
 
1025
  <table>
 
1026
   <title><structname>pg_class</> Columns</title>
 
1027
 
 
1028
   <tgroup cols=4>
 
1029
    <thead>
 
1030
     <row>
 
1031
      <entry>Name</entry>
 
1032
      <entry>Type</entry>
 
1033
      <entry>References</entry>
 
1034
      <entry>Description</entry>
 
1035
     </row>
 
1036
    </thead>
 
1037
 
 
1038
    <tbody>
 
1039
     <row>
 
1040
      <entry><structfield>relname</structfield></entry>
 
1041
      <entry><type>name</type></entry>
 
1042
      <entry></entry>
 
1043
      <entry>Name of the table, index, view, etc.</entry>
 
1044
     </row>
 
1045
 
 
1046
     <row>
 
1047
      <entry><structfield>relnamespace</structfield></entry>
 
1048
      <entry><type>oid</type></entry>
 
1049
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
 
1050
      <entry>
 
1051
       The OID of the namespace that contains this relation
 
1052
      </entry>
 
1053
     </row>
 
1054
 
 
1055
     <row>
 
1056
      <entry><structfield>reltype</structfield></entry>
 
1057
      <entry><type>oid</type></entry>
 
1058
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
1059
      <entry>
 
1060
       The OID of the data type that corresponds to this table's row type,
 
1061
       if any (zero for indexes, which have no <structname>pg_type</> entry)
 
1062
      </entry>
 
1063
     </row>
 
1064
 
 
1065
     <row>
 
1066
      <entry><structfield>relowner</structfield></entry>
 
1067
      <entry><type>int4</type></entry>
 
1068
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
1069
      <entry>Owner of the relation</entry>
 
1070
     </row>
 
1071
 
 
1072
     <row>
 
1073
      <entry><structfield>relam</structfield></entry>
 
1074
      <entry><type>oid</type></entry>
 
1075
      <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
 
1076
      <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
 
1077
     </row>
 
1078
 
 
1079
     <row>
 
1080
      <entry><structfield>relfilenode</structfield></entry>
 
1081
      <entry><type>oid</type></entry>
 
1082
      <entry></entry>
 
1083
      <entry>Name of the on-disk file of this relation; 0 if none</entry>
 
1084
     </row>
 
1085
 
 
1086
     <row>
 
1087
      <entry><structfield>reltablespace</structfield></entry>
 
1088
      <entry><type>oid</type></entry>
 
1089
      <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
 
1090
      <entry>
 
1091
       The tablespace in which this relation is stored.  If zero,
 
1092
       the database's default tablespace is implied.  (Not meaningful
 
1093
       if the relation has no on-disk file.)
 
1094
      </entry>
 
1095
     </row>
 
1096
 
 
1097
     <row>
 
1098
      <entry><structfield>relpages</structfield></entry>
 
1099
      <entry><type>int4</type></entry>
 
1100
      <entry></entry>
 
1101
      <entry>
 
1102
       Size of the on-disk representation of this table in pages (of size
 
1103
       <symbol>BLCKSZ</symbol>).
 
1104
       This is only an estimate used by the planner.
 
1105
       It is updated by <command>VACUUM</command>,
 
1106
       <command>ANALYZE</command>, and a few DDL commands
 
1107
       such as <command>CREATE INDEX</command>.
 
1108
      </entry>
 
1109
     </row>
 
1110
 
 
1111
     <row>
 
1112
      <entry><structfield>reltuples</structfield></entry>
 
1113
      <entry><type>float4</type></entry>
 
1114
      <entry></entry>
 
1115
      <entry>
 
1116
       Number of rows in the table.
 
1117
       This is only an estimate used by the planner.
 
1118
       It is updated by <command>VACUUM</command>,
 
1119
       <command>ANALYZE</command>, and a few DDL commands
 
1120
       such as <command>CREATE INDEX</command>.
 
1121
      </entry>
 
1122
     </row>
 
1123
 
 
1124
     <row>
 
1125
      <entry><structfield>reltoastrelid</structfield></entry>
 
1126
      <entry><type>oid</type></entry>
 
1127
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
1128
      <entry>
 
1129
       OID of the TOAST table associated with this table, 0 if none.
 
1130
       The TOAST table stores large attributes <quote>out of
 
1131
       line</quote> in a secondary table.
 
1132
      </entry>
 
1133
     </row>
 
1134
 
 
1135
     <row>
 
1136
      <entry><structfield>reltoastidxid</structfield></entry>
 
1137
      <entry><type>oid</type></entry>
 
1138
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
1139
      <entry>
 
1140
       For a TOAST table, the OID of its index.  0 if not a TOAST table.
 
1141
      </entry>
 
1142
     </row>
 
1143
 
 
1144
     <row>
 
1145
      <entry><structfield>relhasindex</structfield></entry>
 
1146
      <entry><type>bool</type></entry>
 
1147
      <entry></entry>
 
1148
      <entry>
 
1149
       True if this is a table and it has (or recently had) any
 
1150
       indexes. This is set by <command>CREATE INDEX</command>, but
 
1151
       not cleared immediately by <command>DROP INDEX</command>.
 
1152
       <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the
 
1153
       table has no indexes.
 
1154
      </entry>
 
1155
     </row>
 
1156
 
 
1157
     <row>
 
1158
      <entry><structfield>relisshared</structfield></entry>
 
1159
      <entry><type>bool</type></entry>
 
1160
      <entry></entry>
 
1161
      <entry>True if this table is shared across all databases in the
 
1162
      cluster.  Only certain system catalogs (such as
 
1163
      <structname>pg_database</structname>) are shared.</entry>
 
1164
     </row>
 
1165
 
 
1166
     <row>
 
1167
      <entry><structfield>relkind</structfield></entry>
 
1168
      <entry><type>char</type></entry>
 
1169
      <entry></entry>
 
1170
      <entry>
 
1171
       <literal>r</> = ordinary table, <literal>i</> = index,
 
1172
       <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
 
1173
       composite type, <literal>s</> = special, <literal>t</> = TOAST
 
1174
       table
 
1175
      </entry>
 
1176
     </row>
 
1177
 
 
1178
     <row>
 
1179
      <entry><structfield>relnatts</structfield></entry>
 
1180
      <entry><type>int2</type></entry>
 
1181
      <entry></entry>
 
1182
      <entry>
 
1183
       Number of user columns in the relation (system columns not
 
1184
       counted).  There must be this many corresponding entries in
 
1185
       <structname>pg_attribute</structname>.  See also
 
1186
       <literal>pg_attribute.attnum</literal>.
 
1187
      </entry>
 
1188
     </row>
 
1189
 
 
1190
     <row>
 
1191
      <entry><structfield>relchecks</structfield></entry>
 
1192
      <entry><type>int2</type></entry>
 
1193
      <entry></entry>
 
1194
      <entry>
 
1195
       Number of check constraints on the table; see
 
1196
       <structname>pg_constraint</structname> catalog
 
1197
      </entry>
 
1198
     </row>
 
1199
 
 
1200
     <row>
 
1201
      <entry><structfield>reltriggers</structfield></entry>
 
1202
      <entry><type>int2</type></entry>
 
1203
      <entry></entry>
 
1204
      <entry>
 
1205
       Number of triggers on the table; see
 
1206
       <structname>pg_trigger</structname> catalog
 
1207
      </entry>
 
1208
     </row>
 
1209
 
 
1210
     <row>
 
1211
      <entry><structfield>relukeys</structfield></entry>
 
1212
      <entry><type>int2</type></entry>
 
1213
      <entry></entry>
 
1214
      <entry>unused  (<emphasis>not</emphasis> the number of unique keys)</entry>
 
1215
     </row>
 
1216
 
 
1217
     <row>
 
1218
      <entry><structfield>relfkeys</structfield></entry>
 
1219
      <entry><type>int2</type></entry>
 
1220
      <entry></entry>
 
1221
      <entry>unused  (<emphasis>not</emphasis> the number of foreign keys on the table)</entry>
 
1222
     </row>
 
1223
 
 
1224
     <row>
 
1225
      <entry><structfield>relrefs</structfield></entry>
 
1226
      <entry><type>int2</type></entry>
 
1227
      <entry></entry>
 
1228
      <entry>unused</entry>
 
1229
     </row>
 
1230
 
 
1231
     <row>
 
1232
      <entry><structfield>relhasoids</structfield></entry>
 
1233
      <entry><type>bool</type></entry>
 
1234
      <entry></entry>
 
1235
      <entry>
 
1236
       True if we generate an OID for each row of the relation.
 
1237
      </entry>
 
1238
     </row>
 
1239
 
 
1240
     <row>
 
1241
      <entry><structfield>relhaspkey</structfield></entry>
 
1242
      <entry><type>bool</type></entry>
 
1243
      <entry></entry>
 
1244
      <entry>
 
1245
       True if the table has (or once had) a primary key.
 
1246
      </entry>
 
1247
     </row>
 
1248
 
 
1249
     <row>
 
1250
      <entry><structfield>relhasrules</structfield></entry>
 
1251
      <entry><type>bool</type></entry>
 
1252
      <entry></entry>
 
1253
      <entry>True if table has rules; see
 
1254
       <structname>pg_rewrite</structname> catalog.
 
1255
      </entry>
 
1256
     </row>
 
1257
 
 
1258
     <row>
 
1259
      <entry><structfield>relhassubclass</structfield></entry>
 
1260
      <entry><type>bool</type></entry>
 
1261
      <entry></entry>
 
1262
      <entry>True if table has (or once had) any inheritance children.</entry>
 
1263
     </row>
 
1264
 
 
1265
     <row>
 
1266
      <entry><structfield>relacl</structfield></entry>
 
1267
      <entry><type>aclitem[]</type></entry>
 
1268
      <entry></entry>
 
1269
      <entry>
 
1270
       Access privileges; see
 
1271
       <xref linkend="sql-grant" endterm="sql-grant-title"> and
 
1272
       <xref linkend="sql-revoke" endterm="sql-revoke-title">
 
1273
       for details.
 
1274
      </entry>
 
1275
     </row>
 
1276
    </tbody>
 
1277
   </tgroup>
 
1278
  </table>
 
1279
 </sect1>
 
1280
 
 
1281
 <sect1 id="catalog-pg-constraint">
 
1282
  <title><structname>pg_constraint</structname></title>
 
1283
 
 
1284
  <indexterm zone="catalog-pg-constraint">
 
1285
   <primary>pg_constraint</primary>
 
1286
  </indexterm>
 
1287
 
 
1288
  <para>
 
1289
   The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
 
1290
   key constraints on tables.  (Column constraints are not treated
 
1291
   specially.  Every column constraint is equivalent to some table
 
1292
   constraint.)  Not-null constraints are represented in the
 
1293
   <structname>pg_attribute</> catalog.
 
1294
  </para>
 
1295
 
 
1296
  <para>
 
1297
   Check constraints on domains are stored here, too.
 
1298
  </para>
 
1299
 
 
1300
  <table>
 
1301
   <title><structname>pg_constraint</> Columns</title>
 
1302
 
 
1303
   <tgroup cols=4>
 
1304
    <thead>
 
1305
     <row>
 
1306
      <entry>Name</entry>
 
1307
      <entry>Type</entry>
 
1308
      <entry>References</entry>
 
1309
      <entry>Description</entry>
 
1310
     </row>
 
1311
    </thead>
 
1312
 
 
1313
    <tbody>
 
1314
     <row>
 
1315
      <entry><structfield>conname</structfield></entry>
 
1316
      <entry><type>name</type></entry>
 
1317
      <entry></entry>
 
1318
      <entry>Constraint name (not necessarily unique!)</entry>
 
1319
     </row>
 
1320
 
 
1321
     <row>
 
1322
      <entry><structfield>connamespace</structfield></entry>
 
1323
      <entry><type>oid</type></entry>
 
1324
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
 
1325
      <entry>
 
1326
       The OID of the namespace that contains this constraint
 
1327
      </entry>
 
1328
     </row>
 
1329
 
 
1330
     <row>
 
1331
      <entry><structfield>contype</structfield></entry>
 
1332
      <entry><type>char</type></entry>
 
1333
      <entry></entry>
 
1334
      <entry>
 
1335
        <literal>c</> = check constraint,
 
1336
        <literal>f</> = foreign key constraint,
 
1337
        <literal>p</> = primary key constraint,
 
1338
        <literal>u</> = unique constraint
 
1339
      </entry>
 
1340
     </row>
 
1341
 
 
1342
     <row>
 
1343
      <entry><structfield>condeferrable</structfield></entry>
 
1344
      <entry><type>bool</type></entry>
 
1345
      <entry></entry>
 
1346
      <entry>Is the constraint deferrable?</entry>
 
1347
     </row>
 
1348
 
 
1349
     <row>
 
1350
      <entry><structfield>condeferred</structfield></entry>
 
1351
      <entry><type>bool</type></entry>
 
1352
      <entry></entry>
 
1353
      <entry>Is the constraint deferred by default?</entry>
 
1354
     </row>
 
1355
 
 
1356
     <row>
 
1357
      <entry><structfield>conrelid</structfield></entry>
 
1358
      <entry><type>oid</type></entry>
 
1359
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
1360
      <entry>The table this constraint is on; 0 if not a table constraint</entry>
 
1361
     </row>
 
1362
 
 
1363
     <row>
 
1364
      <entry><structfield>contypid</structfield></entry>
 
1365
      <entry><type>oid</type></entry>
 
1366
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
1367
      <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
 
1368
     </row>
 
1369
 
 
1370
     <row>
 
1371
      <entry><structfield>confrelid</structfield></entry>
 
1372
      <entry><type>oid</type></entry>
 
1373
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
1374
      <entry>If a foreign key, the referenced table; else 0</entry>
 
1375
     </row>
 
1376
 
 
1377
     <row>
 
1378
      <entry><structfield>confupdtype</structfield></entry>
 
1379
      <entry><type>char</type></entry>
 
1380
      <entry></entry>
 
1381
      <entry>Foreign key update action code</entry>
 
1382
     </row>
 
1383
 
 
1384
     <row>
 
1385
      <entry><structfield>confdeltype</structfield></entry>
 
1386
      <entry><type>char</type></entry>
 
1387
      <entry></entry>
 
1388
      <entry>Foreign key deletion action code</entry>
 
1389
     </row>
 
1390
 
 
1391
     <row>
 
1392
      <entry><structfield>confmatchtype</structfield></entry>
 
1393
      <entry><type>char</type></entry>
 
1394
      <entry></entry>
 
1395
      <entry>Foreign key match type</entry>
 
1396
     </row>
 
1397
 
 
1398
     <row>
 
1399
      <entry><structfield>conkey</structfield></entry>
 
1400
      <entry><type>int2[]</type></entry>
 
1401
      <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
 
1402
      <entry>If a table constraint, list of columns which the constraint constrains</entry>
 
1403
     </row>
 
1404
 
 
1405
     <row>
 
1406
      <entry><structfield>confkey</structfield></entry>
 
1407
      <entry><type>int2[]</type></entry>
 
1408
      <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
 
1409
      <entry>If a foreign key, list of the referenced columns</entry>
 
1410
     </row>
 
1411
 
 
1412
     <row>
 
1413
      <entry><structfield>conbin</structfield></entry>
 
1414
      <entry><type>text</type></entry>
 
1415
      <entry></entry>
 
1416
      <entry>If a check constraint, an internal representation of the expression</entry>
 
1417
     </row>
 
1418
 
 
1419
     <row>
 
1420
      <entry><structfield>consrc</structfield></entry>
 
1421
      <entry><type>text</type></entry>
 
1422
      <entry></entry>
 
1423
      <entry>If a check constraint, a human-readable representation of the expression</entry>
 
1424
     </row>
 
1425
    </tbody>
 
1426
   </tgroup>
 
1427
  </table>
 
1428
 
 
1429
  <note>
 
1430
   <para>
 
1431
    <structfield>consrc</structfield> is not updated when referenced objects
 
1432
    change; for example, it won't track renaming of columns.  Rather than
 
1433
    relying on this field, it's best to use <function>pg_get_constraintdef()</>
 
1434
    to extract the definition of a check constraint.
 
1435
   </para>
 
1436
  </note>
 
1437
 
 
1438
  <note>
 
1439
   <para>
 
1440
    <literal>pg_class.relchecks</literal> needs to agree with the
 
1441
    number of check-constraint entries found in this table for the
 
1442
    given relation.
 
1443
   </para>
 
1444
  </note>
 
1445
 
 
1446
 </sect1>
 
1447
 
 
1448
 <sect1 id="catalog-pg-conversion">
 
1449
  <title><structname>pg_conversion</structname></title>
 
1450
 
 
1451
  <indexterm zone="catalog-pg-conversion">
 
1452
   <primary>pg_conversion</primary>
 
1453
  </indexterm>
 
1454
 
 
1455
  <para>
 
1456
   The catalog <structname>pg_conversion</structname> describes the
 
1457
   available encoding conversion procedures.  See
 
1458
   <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
 
1459
   for more information.
 
1460
  </para>
 
1461
 
 
1462
  <table>
 
1463
   <title><structname>pg_conversion</> Columns</title>
 
1464
 
 
1465
   <tgroup cols=4>
 
1466
    <thead>
 
1467
     <row>
 
1468
      <entry>Name</entry>
 
1469
      <entry>Type</entry>
 
1470
      <entry>References</entry>
 
1471
      <entry>Description</entry>
 
1472
     </row>
 
1473
    </thead>
 
1474
 
 
1475
    <tbody>
 
1476
     <row>
 
1477
      <entry><structfield>conname</structfield></entry>
 
1478
      <entry><type>name</type></entry>
 
1479
      <entry></entry>
 
1480
      <entry>Conversion name (unique within a namespace)</entry>
 
1481
     </row>
 
1482
 
 
1483
     <row>
 
1484
      <entry><structfield>connamespace</structfield></entry>
 
1485
      <entry><type>oid</type></entry>
 
1486
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
 
1487
      <entry>
 
1488
       The OID of the namespace that contains this conversion
 
1489
      </entry>
 
1490
     </row>
 
1491
 
 
1492
     <row>
 
1493
      <entry><structfield>conowner</structfield></entry>
 
1494
      <entry><type>int4</type></entry>
 
1495
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
1496
      <entry>Owner of the conversion</entry>
 
1497
     </row>
 
1498
 
 
1499
     <row>
 
1500
      <entry><structfield>conforencoding</structfield></entry>
 
1501
      <entry><type>int4</type></entry>
 
1502
      <entry></entry>
 
1503
      <entry>Source encoding ID</entry>
 
1504
     </row>
 
1505
 
 
1506
     <row>
 
1507
      <entry><structfield>contoencoding</structfield></entry>
 
1508
      <entry><type>int4</type></entry>
 
1509
      <entry></entry>
 
1510
      <entry>Destination encoding ID</entry>
 
1511
     </row>
 
1512
 
 
1513
     <row>
 
1514
      <entry><structfield>conproc</structfield></entry>
 
1515
      <entry><type>regproc</type></entry>
 
1516
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
1517
      <entry>Conversion procedure</entry>
 
1518
     </row>
 
1519
 
 
1520
     <row>
 
1521
      <entry><structfield>condefault</structfield></entry>
 
1522
      <entry><type>bool</type></entry>
 
1523
      <entry></entry>
 
1524
      <entry>True if this is the default conversion</entry>
 
1525
     </row>
 
1526
 
 
1527
    </tbody>
 
1528
   </tgroup>
 
1529
  </table>
 
1530
 
 
1531
 </sect1>
 
1532
 
 
1533
 <sect1 id="catalog-pg-database">
 
1534
  <title><structname>pg_database</structname></title>
 
1535
 
 
1536
  <indexterm zone="catalog-pg-database">
 
1537
   <primary>pg_database</primary>
 
1538
  </indexterm>
 
1539
 
 
1540
  <para>
 
1541
   The catalog <structname>pg_database</structname> stores information
 
1542
   about the available databases.  Databases are created with the
 
1543
   <command>CREATE DATABASE</command> command.  Consult
 
1544
   <xref linkend="managing-databases"> for details about the meaning of some of the
 
1545
   parameters.
 
1546
  </para>
 
1547
 
 
1548
  <para>
 
1549
   Unlike most system catalogs, <structname>pg_database</structname>
 
1550
   is shared across all databases of a cluster: there is only one
 
1551
   copy of <structname>pg_database</structname> per cluster, not
 
1552
   one per database.
 
1553
  </para>
 
1554
 
 
1555
  <table>
 
1556
   <title><structname>pg_database</> Columns</title>
 
1557
 
 
1558
   <tgroup cols=4>
 
1559
    <thead>
 
1560
     <row>
 
1561
      <entry>Name</entry>
 
1562
      <entry>Type</entry>
 
1563
      <entry>References</entry>
 
1564
      <entry>Description</entry>
 
1565
     </row>
 
1566
    </thead>
 
1567
 
 
1568
    <tbody>
 
1569
     <row>
 
1570
      <entry><structfield>datname</structfield></entry>
 
1571
      <entry><type>name</type></entry>
 
1572
      <entry></entry>
 
1573
      <entry>Database name</entry>
 
1574
     </row>
 
1575
 
 
1576
     <row>
 
1577
      <entry><structfield>datdba</structfield></entry>
 
1578
      <entry><type>int4</type></entry>
 
1579
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
1580
      <entry>Owner of the database, usually the user who created it</entry>
 
1581
     </row>
 
1582
 
 
1583
     <row>
 
1584
      <entry><structfield>encoding</structfield></entry>
 
1585
      <entry><type>int4</type></entry>
 
1586
      <entry></entry>
 
1587
      <entry>Character encoding for this database</entry>
 
1588
     </row>
 
1589
 
 
1590
     <row>
 
1591
      <entry><structfield>datistemplate</structfield></entry>
 
1592
      <entry><type>bool</type></entry>
 
1593
      <entry></entry>
 
1594
      <entry>
 
1595
       If true then this database can be used in the
 
1596
       <literal>TEMPLATE</literal> clause of <command>CREATE
 
1597
       DATABASE</command> to create a new database as a clone of
 
1598
       this one.
 
1599
      </entry>
 
1600
     </row>
 
1601
 
 
1602
     <row>
 
1603
      <entry><structfield>datallowconn</structfield></entry>
 
1604
      <entry><type>bool</type></entry>
 
1605
      <entry></entry>
 
1606
      <entry>
 
1607
       If false then no one can connect to this database.  This is
 
1608
       used to protect the <literal>template0</> database from being altered.
 
1609
      </entry>
 
1610
     </row>
 
1611
 
 
1612
     <row>
 
1613
      <entry><structfield>datlastsysoid</structfield></entry>
 
1614
      <entry><type>oid</type></entry>
 
1615
      <entry></entry>
 
1616
      <entry>
 
1617
       Last system OID in the database; useful
 
1618
       particularly to <application>pg_dump</application>
 
1619
      </entry>
 
1620
     </row>
 
1621
 
 
1622
     <row>
 
1623
      <entry><structfield>datvacuumxid</structfield></entry>
 
1624
      <entry><type>xid</type></entry>
 
1625
      <entry></entry>
 
1626
      <entry>
 
1627
       All rows inserted or deleted by transaction IDs before this one
 
1628
       have been marked as known committed or known aborted in this database.
 
1629
       This is used to determine when commit-log space can be recycled.
 
1630
      </entry>
 
1631
     </row>
 
1632
 
 
1633
     <row>
 
1634
      <entry><structfield>datfrozenxid</structfield></entry>
 
1635
      <entry><type>xid</type></entry>
 
1636
      <entry></entry>
 
1637
      <entry>
 
1638
       All rows inserted by transaction IDs before this one have been
 
1639
       relabeled with a permanent (<quote>frozen</>) transaction ID in this
 
1640
       database.  This is useful to check whether a database must be vacuumed
 
1641
       soon to avoid transaction ID wrap-around problems.
 
1642
      </entry>
 
1643
     </row>
 
1644
 
 
1645
     <row>
 
1646
      <entry><structfield>dattablespace</structfield></entry>
 
1647
      <entry><type>oid</type></entry>
 
1648
      <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
 
1649
      <entry>
 
1650
       The default tablespace for the database.
 
1651
       Within this database, all tables for which
 
1652
       <structname>pg_class</>.<structfield>reltablespace</> is zero
 
1653
       will be stored in this tablespace; in particular, all the non-shared
 
1654
       system catalogs will be there.
 
1655
      </entry>
 
1656
     </row>
 
1657
 
 
1658
     <row>
 
1659
      <entry><structfield>datconfig</structfield></entry>
 
1660
      <entry><type>text[]</type></entry>
 
1661
      <entry></entry>
 
1662
      <entry>Session defaults for run-time configuration variables</entry>
 
1663
     </row>
 
1664
 
 
1665
     <row>
 
1666
      <entry><structfield>datacl</structfield></entry>
 
1667
      <entry><type>aclitem[]</type></entry>
 
1668
      <entry></entry>
 
1669
      <entry>
 
1670
       Access privileges; see
 
1671
       <xref linkend="sql-grant" endterm="sql-grant-title"> and
 
1672
       <xref linkend="sql-revoke" endterm="sql-revoke-title">
 
1673
       for details.
 
1674
      </entry>
 
1675
     </row>
 
1676
    </tbody>
 
1677
   </tgroup>
 
1678
  </table>
 
1679
 </sect1>
 
1680
 
 
1681
 
 
1682
 <sect1 id="catalog-pg-depend">
 
1683
  <title><structname>pg_depend</structname></title>
 
1684
 
 
1685
  <indexterm zone="catalog-pg-depend">
 
1686
   <primary>pg_depend</primary>
 
1687
  </indexterm>
 
1688
 
 
1689
  <para>
 
1690
   The catalog <structname>pg_depend</structname> records the dependency
 
1691
   relationships between database objects.  This information allows
 
1692
   <command>DROP</> commands to find which other objects must be dropped
 
1693
   by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
 
1694
   RESTRICT</> case.
 
1695
  </para>
 
1696
 
 
1697
  <table>
 
1698
   <title><structname>pg_depend</> Columns</title>
 
1699
 
 
1700
   <tgroup cols=4>
 
1701
    <thead>
 
1702
     <row>
 
1703
      <entry>Name</entry>
 
1704
      <entry>Type</entry>
 
1705
      <entry>References</entry>
 
1706
      <entry>Description</entry>
 
1707
     </row>
 
1708
    </thead>
 
1709
 
 
1710
    <tbody>
 
1711
     <row>
 
1712
      <entry><structfield>classid</structfield></entry>
 
1713
      <entry><type>oid</type></entry>
 
1714
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
1715
      <entry>The OID of the system catalog the dependent object is in</entry>
 
1716
     </row>
 
1717
 
 
1718
     <row>
 
1719
      <entry><structfield>objid</structfield></entry>
 
1720
      <entry><type>oid</type></entry>
 
1721
      <entry>any OID column</entry>
 
1722
      <entry>The OID of the specific dependent object</entry>
 
1723
     </row>
 
1724
 
 
1725
     <row>
 
1726
      <entry><structfield>objsubid</structfield></entry>
 
1727
      <entry><type>int4</type></entry>
 
1728
      <entry></entry>
 
1729
      <entry>
 
1730
       For a table column, this is the column number (the
 
1731
       <structfield>objid</> and <structfield>classid</> refer to the
 
1732
       table itself).  For all other object types, this column is
 
1733
       zero.
 
1734
      </entry>
 
1735
     </row>
 
1736
 
 
1737
     <row>
 
1738
      <entry><structfield>refclassid</structfield></entry>
 
1739
      <entry><type>oid</type></entry>
 
1740
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
1741
      <entry>The OID of the system catalog the referenced object is in</entry>
 
1742
     </row>
 
1743
 
 
1744
     <row>
 
1745
      <entry><structfield>refobjid</structfield></entry>
 
1746
      <entry><type>oid</type></entry>
 
1747
      <entry>any OID column</entry>
 
1748
      <entry>The OID of the specific referenced object</entry>
 
1749
     </row>
 
1750
 
 
1751
     <row>
 
1752
      <entry><structfield>refobjsubid</structfield></entry>
 
1753
      <entry><type>int4</type></entry>
 
1754
      <entry></entry>
 
1755
      <entry>
 
1756
       For a table column, this is the column number (the
 
1757
       <structfield>refobjid</> and <structfield>refclassid</> refer
 
1758
       to the table itself).  For all other object types, this column
 
1759
       is zero.
 
1760
      </entry>
 
1761
     </row>
 
1762
 
 
1763
     <row>
 
1764
      <entry><structfield>deptype</structfield></entry>
 
1765
      <entry><type>char</type></entry>
 
1766
      <entry></entry>
 
1767
      <entry>
 
1768
       A code defining the specific semantics of this dependency relationship; see text.
 
1769
      </entry>
 
1770
     </row>
 
1771
 
 
1772
    </tbody>
 
1773
   </tgroup>
 
1774
  </table>
 
1775
 
 
1776
  <para>
 
1777
   In all cases, a <structname>pg_depend</structname> entry indicates that the
 
1778
   referenced object may not be dropped without also dropping the dependent
 
1779
   object.  However, there are several subflavors identified by
 
1780
   <structfield>deptype</>:
 
1781
 
 
1782
   <variablelist>
 
1783
    <varlistentry>
 
1784
     <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
 
1785
     <listitem>
 
1786
      <para>
 
1787
       A normal relationship between separately-created objects.  The
 
1788
       dependent object may be dropped without affecting the
 
1789
       referenced object.  The referenced object may only be dropped
 
1790
       by specifying <literal>CASCADE</>, in which case the dependent
 
1791
       object is dropped, too.  Example: a table column has a normal
 
1792
       dependency on its data type.
 
1793
      </para>
 
1794
     </listitem>
 
1795
    </varlistentry>
 
1796
 
 
1797
    <varlistentry>
 
1798
     <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
 
1799
     <listitem>
 
1800
      <para>
 
1801
       The dependent object can be dropped separately from the
 
1802
       referenced object, and should be automatically dropped
 
1803
       (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
 
1804
       mode) if the referenced object is dropped.  Example: a named
 
1805
       constraint on a table is made autodependent on the table, so
 
1806
       that it will go away if the table is dropped.
 
1807
      </para>
 
1808
     </listitem>
 
1809
    </varlistentry>
 
1810
 
 
1811
    <varlistentry>
 
1812
     <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
 
1813
     <listitem>
 
1814
      <para>
 
1815
       The dependent object was created as part of creation of the
 
1816
       referenced object, and is really just a part of its internal
 
1817
       implementation.  A <command>DROP</> of the dependent object
 
1818
       will be disallowed outright (we'll tell the user to issue a
 
1819
       <command>DROP</> against the referenced object, instead).  A
 
1820
       <command>DROP</> of the referenced object will be propagated
 
1821
       through to drop the dependent object whether
 
1822
       <command>CASCADE</> is specified or not.  Example: a trigger
 
1823
       that's created to enforce a foreign-key constraint is made
 
1824
       internally dependent on the constraint's
 
1825
       <structname>pg_constraint</> entry.
 
1826
      </para>
 
1827
     </listitem>
 
1828
    </varlistentry>
 
1829
 
 
1830
    <varlistentry>
 
1831
     <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
 
1832
     <listitem>
 
1833
      <para>
 
1834
       There is no dependent object; this type of entry is a signal
 
1835
       that the system itself depends on the referenced object, and so
 
1836
       that object must never be deleted.  Entries of this type are
 
1837
       created only by <command>initdb</command>.  The columns for the
 
1838
       dependent object contain zeroes.
 
1839
      </para>
 
1840
     </listitem>
 
1841
    </varlistentry>
 
1842
   </variablelist>
 
1843
 
 
1844
   Other dependency flavors may be needed in future.
 
1845
  </para>
 
1846
 
 
1847
 </sect1>
 
1848
 
 
1849
 
 
1850
 <sect1 id="catalog-pg-description">
 
1851
  <title><structname>pg_description</structname></title>
 
1852
 
 
1853
  <indexterm zone="catalog-pg-description">
 
1854
   <primary>pg_description</primary>
 
1855
  </indexterm>
 
1856
 
 
1857
  <para>
 
1858
   The catalog <structname>pg_description</> stores optional descriptions
 
1859
   (comments) for each database object.  Descriptions can be manipulated
 
1860
   with the <command>COMMENT</command> command and viewed with
 
1861
   <application>psql</application>'s <literal>\d</literal> commands.
 
1862
   Descriptions of many built-in system objects are provided in the initial
 
1863
   contents of <structname>pg_description</structname>.
 
1864
  </para>
 
1865
 
 
1866
  <table>
 
1867
   <title><structname>pg_description</> Columns</title>
 
1868
 
 
1869
   <tgroup cols=4>
 
1870
    <thead>
 
1871
     <row>
 
1872
      <entry>Name</entry>
 
1873
      <entry>Type</entry>
 
1874
      <entry>References</entry>
 
1875
      <entry>Description</entry>
 
1876
     </row>
 
1877
    </thead>
 
1878
 
 
1879
    <tbody>
 
1880
     <row>
 
1881
      <entry><structfield>objoid</structfield></entry>
 
1882
      <entry><type>oid</type></entry>
 
1883
      <entry>any OID column</entry>
 
1884
      <entry>The OID of the object this description pertains to</entry>
 
1885
     </row>
 
1886
 
 
1887
     <row>
 
1888
      <entry><structfield>classoid</structfield></entry>
 
1889
      <entry><type>oid</type></entry>
 
1890
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
1891
      <entry>The OID of the system catalog this object appears in</entry>
 
1892
     </row>
 
1893
 
 
1894
     <row>
 
1895
      <entry><structfield>objsubid</structfield></entry>
 
1896
      <entry><type>int4</type></entry>
 
1897
      <entry></entry>
 
1898
      <entry>
 
1899
       For a comment on a table column, this is the column number (the
 
1900
       <structfield>objoid</> and <structfield>classoid</> refer to
 
1901
       the table itself).  For all other object types, this column is
 
1902
       zero.
 
1903
      </entry>
 
1904
     </row>
 
1905
 
 
1906
     <row>
 
1907
      <entry><structfield>description</structfield></entry>
 
1908
      <entry><type>text</type></entry>
 
1909
      <entry></entry>
 
1910
      <entry>Arbitrary text that serves as the description of this object.</entry>
 
1911
     </row>
 
1912
    </tbody>
 
1913
   </tgroup>
 
1914
  </table>
 
1915
 
 
1916
 </sect1>
 
1917
 
 
1918
 
 
1919
 <sect1 id="catalog-pg-group">
 
1920
  <title><structname>pg_group</structname></title>
 
1921
 
 
1922
  <indexterm zone="catalog-pg-group">
 
1923
   <primary>pg_group</primary>
 
1924
  </indexterm>
 
1925
 
 
1926
  <para>
 
1927
   The catalog <structname>pg_group</structname> defines groups and stores what users belong to what
 
1928
   groups.  Groups are created with the <command>CREATE
 
1929
   GROUP</command> command.  Consult <xref linkend="user-manag"> for information
 
1930
   about user privilege management.
 
1931
  </para>
 
1932
 
 
1933
  <para>
 
1934
   Because user and group identities are cluster-wide,
 
1935
   <structname>pg_group</structname>
 
1936
   is shared across all databases of a cluster: there is only one
 
1937
   copy of <structname>pg_group</structname> per cluster, not
 
1938
   one per database.
 
1939
  </para>
 
1940
 
 
1941
  <table>
 
1942
   <title><structname>pg_group</> Columns</title>
 
1943
 
 
1944
   <tgroup cols=4>
 
1945
    <thead>
 
1946
     <row>
 
1947
      <entry>Name</entry>
 
1948
      <entry>Type</entry>
 
1949
      <entry>References</entry>
 
1950
      <entry>Description</entry>
 
1951
     </row>
 
1952
    </thead>
 
1953
 
 
1954
    <tbody>
 
1955
     <row>
 
1956
      <entry><structfield>groname</structfield></entry>
 
1957
      <entry><type>name</type></entry>
 
1958
      <entry></entry>
 
1959
      <entry>Name of the group</entry>
 
1960
     </row>
 
1961
 
 
1962
     <row>
 
1963
      <entry><structfield>grosysid</structfield></entry>
 
1964
      <entry><type>int4</type></entry>
 
1965
      <entry></entry>
 
1966
      <entry>An arbitrary number to identify this group</entry>
 
1967
     </row>
 
1968
 
 
1969
     <row>
 
1970
      <entry><structfield>grolist</structfield></entry>
 
1971
      <entry><type>int4[]</type></entry>
 
1972
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
1973
      <entry>An array containing the IDs of the users in this group</entry>
 
1974
     </row>
 
1975
    </tbody>
 
1976
   </tgroup>
 
1977
  </table>
 
1978
 
 
1979
 </sect1>
 
1980
 
 
1981
 
 
1982
 <sect1 id="catalog-pg-index">
 
1983
  <title><structname>pg_index</structname></title>
 
1984
 
 
1985
  <indexterm zone="catalog-pg-index">
 
1986
   <primary>pg_index</primary>
 
1987
  </indexterm>
 
1988
 
 
1989
  <para>
 
1990
   The catalog <structname>pg_index</structname> contains part of the information
 
1991
   about indexes.  The rest is mostly in
 
1992
   <structname>pg_class</structname>.
 
1993
  </para>
 
1994
 
 
1995
  <table>
 
1996
   <title><structname>pg_index</> Columns</title>
 
1997
 
 
1998
   <tgroup cols=4>
 
1999
    <thead>
 
2000
     <row>
 
2001
      <entry>Name</entry>
 
2002
      <entry>Type</entry>
 
2003
      <entry>References</entry>
 
2004
      <entry>Description</entry>
 
2005
     </row>
 
2006
    </thead>
 
2007
 
 
2008
    <tbody>
 
2009
     <row>
 
2010
      <entry><structfield>indexrelid</structfield></entry>
 
2011
      <entry><type>oid</type></entry>
 
2012
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
2013
      <entry>The OID of the <structname>pg_class</> entry for this index</entry>
 
2014
     </row>
 
2015
 
 
2016
     <row>
 
2017
      <entry><structfield>indrelid</structfield></entry>
 
2018
      <entry><type>oid</type></entry>
 
2019
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
2020
      <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
 
2021
     </row>
 
2022
 
 
2023
     <row>
 
2024
      <entry><structfield>indkey</structfield></entry>
 
2025
      <entry><type>int2vector</type></entry>
 
2026
      <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
 
2027
      <entry>
 
2028
       This is an array of <structfield>indnatts</structfield> (up to
 
2029
       <symbol>INDEX_MAX_KEYS</symbol>) values that indicate which
 
2030
       table columns this index indexes.  For example a value of
 
2031
       <literal>1 3</literal> would mean that the first and the third table
 
2032
       columns make up the index key.  A zero in this array indicates that the
 
2033
       corresponding index attribute is an expression over the table columns,
 
2034
       rather than a simple column reference.
 
2035
      </entry>
 
2036
     </row>
 
2037
 
 
2038
     <row>
 
2039
      <entry><structfield>indclass</structfield></entry>
 
2040
      <entry><type>oidvector</type></entry>
 
2041
      <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
 
2042
      <entry>
 
2043
       For each column in the index key this contains the OID of
 
2044
       the operator class to use.  See
 
2045
       <structname>pg_opclass</structname> for details.
 
2046
      </entry>
 
2047
     </row>
 
2048
 
 
2049
     <row>
 
2050
      <entry><structfield>indnatts</structfield></entry>
 
2051
      <entry><type>int2</type></entry>
 
2052
      <entry></entry>
 
2053
      <entry>The number of columns in the index (duplicates
 
2054
      <literal>pg_class.relnatts</literal>)</entry>
 
2055
     </row>
 
2056
 
 
2057
     <row>
 
2058
      <entry><structfield>indisunique</structfield></entry>
 
2059
      <entry><type>bool</type></entry>
 
2060
      <entry></entry>
 
2061
      <entry>If true, this is a unique index.</entry>
 
2062
     </row>
 
2063
 
 
2064
     <row>
 
2065
      <entry><structfield>indisprimary</structfield></entry>
 
2066
      <entry><type>bool</type></entry>
 
2067
      <entry></entry>
 
2068
      <entry>If true, this index represents the primary key of the table.
 
2069
      (<structfield>indisunique</> should always be true when this is true.)</entry>
 
2070
     </row>
 
2071
 
 
2072
     <row>
 
2073
      <entry><structfield>indisclustered</structfield></entry>
 
2074
      <entry><type>bool</type></entry>
 
2075
      <entry></entry>
 
2076
      <entry>If true, the table was last clustered on this index.</entry>
 
2077
     </row>
 
2078
 
 
2079
     <row>
 
2080
      <entry><structfield>indexprs</structfield></entry>
 
2081
      <entry><type>text</type></entry>
 
2082
      <entry></entry>
 
2083
      <entry>Expression trees (in <function>nodeToString()</function> representation)
 
2084
      for index attributes that are not simple column references.  This is a
 
2085
      list with one element for each zero entry in <structfield>indkey</>.
 
2086
      Null if all index attributes are simple references.</entry>
 
2087
     </row>
 
2088
 
 
2089
     <row>
 
2090
      <entry><structfield>indpred</structfield></entry>
 
2091
      <entry><type>text</type></entry>
 
2092
      <entry></entry>
 
2093
      <entry>Expression tree (in <function>nodeToString()</function> representation)
 
2094
      for partial index predicate.  Null if not a partial index.</entry>
 
2095
     </row>
 
2096
    </tbody>
 
2097
   </tgroup>
 
2098
  </table>
 
2099
 
 
2100
 </sect1>
 
2101
 
 
2102
 
 
2103
 <sect1 id="catalog-pg-inherits">
 
2104
  <title><structname>pg_inherits</structname></title>
 
2105
 
 
2106
  <indexterm zone="catalog-pg-inherits">
 
2107
   <primary>pg_inherits</primary>
 
2108
  </indexterm>
 
2109
 
 
2110
  <para>
 
2111
   The catalog <structname>pg_inherits</> records information about
 
2112
   table inheritance hierarchies.  There is one entry for each direct
 
2113
   child table in the database.  (Indirect inheritance can be determined
 
2114
   by following chains of entries.)
 
2115
  </para>
 
2116
 
 
2117
  <table>
 
2118
   <title><structname>pg_inherits</> Columns</title>
 
2119
 
 
2120
   <tgroup cols=4>
 
2121
    <thead>
 
2122
     <row>
 
2123
      <entry>Name</entry>
 
2124
      <entry>Type</entry>
 
2125
      <entry>References</entry>
 
2126
      <entry>Description</entry>
 
2127
     </row>
 
2128
    </thead>
 
2129
 
 
2130
    <tbody>
 
2131
     <row>
 
2132
      <entry><structfield>inhrelid</structfield></entry>
 
2133
      <entry><type>oid</type></entry>
 
2134
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
2135
      <entry>
 
2136
       The OID of the child table.
 
2137
      </entry>
 
2138
     </row>
 
2139
 
 
2140
     <row>
 
2141
      <entry><structfield>inhparent</structfield></entry>
 
2142
      <entry><type>oid</type></entry>
 
2143
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
2144
      <entry>
 
2145
       The OID of the parent table.
 
2146
      </entry>
 
2147
     </row>
 
2148
 
 
2149
     <row>
 
2150
      <entry><structfield>inhseqno</structfield></entry>
 
2151
      <entry><type>int4</type></entry>
 
2152
      <entry></entry>
 
2153
      <entry>
 
2154
       If there is more than one direct parent for a child table (multiple
 
2155
       inheritance), this number tells the order in which the
 
2156
       inherited columns are to be arranged.  The count starts at 1.
 
2157
      </entry>
 
2158
     </row>
 
2159
    </tbody>
 
2160
   </tgroup>
 
2161
  </table>
 
2162
 
 
2163
 </sect1>
 
2164
 
 
2165
 
 
2166
 <sect1 id="catalog-pg-language">
 
2167
  <title><structname>pg_language</structname></title>
 
2168
 
 
2169
  <indexterm zone="catalog-pg-language">
 
2170
   <primary>pg_language</primary>
 
2171
  </indexterm>
 
2172
 
 
2173
  <para>
 
2174
   The catalog <structname>pg_language</structname> registers
 
2175
   languages in which you can write functions or stored procedures.
 
2176
   See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
 
2177
   and <xref linkend="xplang"> for more information about language handlers.
 
2178
  </para>
 
2179
 
 
2180
  <table>
 
2181
   <title><structname>pg_language</> Columns</title>
 
2182
 
 
2183
   <tgroup cols=4>
 
2184
    <thead>
 
2185
     <row>
 
2186
      <entry>Name</entry>
 
2187
      <entry>Type</entry>
 
2188
      <entry>References</entry>
 
2189
      <entry>Description</entry>
 
2190
     </row>
 
2191
    </thead>
 
2192
 
 
2193
    <tbody>
 
2194
     <row>
 
2195
      <entry><structfield>lanname</structfield></entry>
 
2196
      <entry><type>name</type></entry>
 
2197
      <entry></entry>
 
2198
      <entry>Name of the language</entry>
 
2199
     </row>
 
2200
 
 
2201
     <row>
 
2202
      <entry><structfield>lanispl</structfield></entry>
 
2203
      <entry><type>bool</type></entry>
 
2204
      <entry></entry>
 
2205
      <entry>
 
2206
       This is false for internal languages (such as
 
2207
       <acronym>SQL</acronym>) and true for user-defined languages.
 
2208
       Currently, <application>pg_dump</application> still uses this
 
2209
       to determine which languages need to be dumped, but this may be
 
2210
       replaced by a different mechanism sometime.
 
2211
      </entry>
 
2212
     </row>
 
2213
 
 
2214
     <row>
 
2215
      <entry><structfield>lanpltrusted</structfield></entry>
 
2216
      <entry><type>bool</type></entry>
 
2217
      <entry></entry>
 
2218
      <entry>
 
2219
       This is a trusted language.  If this is an internal
 
2220
       language (<structfield>lanispl</structfield> is false) then
 
2221
       this column is meaningless.
 
2222
      </entry>
 
2223
     </row>
 
2224
 
 
2225
     <row>
 
2226
      <entry><structfield>lanplcallfoid</structfield></entry>
 
2227
      <entry><type>oid</type></entry>
 
2228
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
2229
      <entry>
 
2230
       For noninternal languages this references the language
 
2231
       handler, which is a special function that is responsible for
 
2232
       executing all functions that are written in the particular
 
2233
       language.
 
2234
      </entry>
 
2235
     </row>
 
2236
 
 
2237
     <row>
 
2238
      <entry><structfield>lanvalidator</structfield></entry>
 
2239
      <entry><type>oid</type></entry>
 
2240
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
2241
      <entry>
 
2242
       This references a language validator function that is responsible
 
2243
       for checking the syntax and validity of new functions when they
 
2244
       are created.  Zero if no validator is provided.
 
2245
      </entry>
 
2246
     </row>
 
2247
 
 
2248
     <row>
 
2249
      <entry><structfield>lanacl</structfield></entry>
 
2250
      <entry><type>aclitem[]</type></entry>
 
2251
      <entry></entry>
 
2252
      <entry>
 
2253
       Access privileges; see
 
2254
       <xref linkend="sql-grant" endterm="sql-grant-title"> and
 
2255
       <xref linkend="sql-revoke" endterm="sql-revoke-title">
 
2256
       for details.
 
2257
      </entry>
 
2258
     </row>
 
2259
    </tbody>
 
2260
   </tgroup>
 
2261
  </table>
 
2262
 
 
2263
 </sect1>
 
2264
 
 
2265
 
 
2266
 <sect1 id="catalog-pg-largeobject">
 
2267
  <title><structname>pg_largeobject</structname></title>
 
2268
 
 
2269
  <indexterm zone="catalog-pg-largeobject">
 
2270
   <primary>pg_largeobject</primary>
 
2271
  </indexterm>
 
2272
 
 
2273
  <para>
 
2274
   The catalog <structname>pg_largeobject</structname> holds the data making up
 
2275
   <quote>large objects</quote>.  A large object is identified by an
 
2276
   OID assigned when it is created.  Each large object is broken into
 
2277
   segments or <quote>pages</> small enough to be conveniently stored as rows
 
2278
   in <structname>pg_largeobject</structname>.
 
2279
   The amount of data per page is defined to be <literal>LOBLKSIZE</> (which is currently
 
2280
   <literal>BLCKSZ/4</>, or typically 2 kB).
 
2281
  </para>
 
2282
 
 
2283
  <table>
 
2284
   <title><structname>pg_largeobject</> Columns</title>
 
2285
 
 
2286
   <tgroup cols=4>
 
2287
    <thead>
 
2288
     <row>
 
2289
      <entry>Name</entry>
 
2290
      <entry>Type</entry>
 
2291
      <entry>References</entry>
 
2292
      <entry>Description</entry>
 
2293
     </row>
 
2294
    </thead>
 
2295
 
 
2296
    <tbody>
 
2297
     <row>
 
2298
      <entry><structfield>loid</structfield></entry>
 
2299
      <entry><type>oid</type></entry>
 
2300
      <entry></entry>
 
2301
      <entry>Identifier of the large object that includes this page</entry>
 
2302
     </row>
 
2303
 
 
2304
     <row>
 
2305
      <entry><structfield>pageno</structfield></entry>
 
2306
      <entry><type>int4</type></entry>
 
2307
      <entry></entry>
 
2308
      <entry>Page number of this page within its large object
 
2309
      (counting from zero)</entry>
 
2310
     </row>
 
2311
 
 
2312
     <row>
 
2313
      <entry><structfield>data</structfield></entry>
 
2314
      <entry><type>bytea</type></entry>
 
2315
      <entry></entry>
 
2316
      <entry>
 
2317
       Actual data stored in the large object.
 
2318
       This will never be more than <symbol>LOBLKSIZE</> bytes and may be less.
 
2319
      </entry>
 
2320
     </row>
 
2321
    </tbody>
 
2322
   </tgroup>
 
2323
  </table>
 
2324
 
 
2325
  <para>
 
2326
   Each row of <structname>pg_largeobject</structname> holds data
 
2327
   for one page of a large object, beginning at
 
2328
   byte offset (<literal>pageno * LOBLKSIZE</>) within the object.  The implementation
 
2329
   allows sparse storage: pages may be missing, and may be shorter than
 
2330
   <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
 
2331
   Missing regions within a large object read as zeroes.
 
2332
  </para>
 
2333
 
 
2334
 </sect1>
 
2335
 
 
2336
 
 
2337
 <sect1 id="catalog-pg-listener">
 
2338
  <title><structname>pg_listener</structname></title>
 
2339
 
 
2340
  <indexterm zone="catalog-pg-listener">
 
2341
   <primary>pg_listener</primary>
 
2342
  </indexterm>
 
2343
 
 
2344
  <para>
 
2345
   The catalog <structname>pg_listener</structname> supports the
 
2346
   <xref linkend="sql-listen" endterm="sql-listen-title"> and
 
2347
   <xref linkend="sql-notify" endterm="sql-notify-title">
 
2348
   commands.  A listener creates an entry in
 
2349
   <structname>pg_listener</structname> for each notification name
 
2350
   it is listening for.  A notifier scans <structname>pg_listener</structname>
 
2351
   and updates each matching entry to show that a notification has occurred.
 
2352
   The notifier also sends a signal (using the PID recorded in the table)
 
2353
   to awaken the listener from sleep.
 
2354
  </para>
 
2355
 
 
2356
  <table>
 
2357
   <title><structname>pg_listener</> Columns</title>
 
2358
 
 
2359
   <tgroup cols=4>
 
2360
    <thead>
 
2361
     <row>
 
2362
      <entry>Name</entry>
 
2363
      <entry>Type</entry>
 
2364
      <entry>References</entry>
 
2365
      <entry>Description</entry>
 
2366
     </row>
 
2367
    </thead>
 
2368
 
 
2369
    <tbody>
 
2370
     <row>
 
2371
      <entry><structfield>relname</structfield></entry>
 
2372
      <entry><type>name</type></entry>
 
2373
      <entry></entry>
 
2374
      <entry>Notify condition name.  (The name need not match any actual
 
2375
      relation in the database; the name <structfield>relname</> is historical.)
 
2376
      </entry>
 
2377
     </row>
 
2378
 
 
2379
     <row>
 
2380
      <entry><structfield>listenerpid</structfield></entry>
 
2381
      <entry><type>int4</type></entry>
 
2382
      <entry></entry>
 
2383
      <entry>PID of the server process that created this entry.</entry>
 
2384
     </row>
 
2385
 
 
2386
     <row>
 
2387
      <entry><structfield>notification</structfield></entry>
 
2388
      <entry><type>int4</type></entry>
 
2389
      <entry></entry>
 
2390
      <entry>
 
2391
       Zero if no event is pending for this listener.  If an event is
 
2392
       pending, the PID of the server process that sent the notification.
 
2393
      </entry>
 
2394
     </row>
 
2395
    </tbody>
 
2396
   </tgroup>
 
2397
  </table>
 
2398
 
 
2399
 </sect1>
 
2400
 
 
2401
 
 
2402
 <sect1 id="catalog-pg-namespace">
 
2403
  <title><structname>pg_namespace</structname></title>
 
2404
 
 
2405
  <indexterm zone="catalog-pg-namespace">
 
2406
   <primary>pg_namespace</primary>
 
2407
  </indexterm>
 
2408
 
 
2409
  <para>
 
2410
   The catalog <structname>pg_namespace</> stores namespaces.
 
2411
   A namespace is the structure underlying SQL schemas: each namespace
 
2412
   can have a separate collection of relations, types, etc. without name
 
2413
   conflicts.
 
2414
  </para>
 
2415
 
 
2416
  <table>
 
2417
   <title><structname>pg_namespace</> Columns</title>
 
2418
 
 
2419
   <tgroup cols=4>
 
2420
    <thead>
 
2421
     <row>
 
2422
      <entry>Name</entry>
 
2423
      <entry>Type</entry>
 
2424
      <entry>References</entry>
 
2425
      <entry>Description</entry>
 
2426
     </row>
 
2427
    </thead>
 
2428
 
 
2429
    <tbody>
 
2430
     <row>
 
2431
      <entry><structfield>nspname</structfield></entry>
 
2432
      <entry><type>name</type></entry>
 
2433
      <entry></entry>
 
2434
      <entry>Name of the namespace</entry>
 
2435
     </row>
 
2436
 
 
2437
     <row>
 
2438
      <entry><structfield>nspowner</structfield></entry>
 
2439
      <entry><type>int4</type></entry>
 
2440
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
2441
      <entry>Owner of the namespace</entry>
 
2442
     </row>
 
2443
 
 
2444
     <row>
 
2445
      <entry><structfield>nspacl</structfield></entry>
 
2446
      <entry><type>aclitem[]</type></entry>
 
2447
      <entry></entry>
 
2448
      <entry>
 
2449
       Access privileges; see
 
2450
       <xref linkend="sql-grant" endterm="sql-grant-title"> and
 
2451
       <xref linkend="sql-revoke" endterm="sql-revoke-title">
 
2452
       for details.
 
2453
      </entry>
 
2454
     </row>
 
2455
    </tbody>
 
2456
   </tgroup>
 
2457
  </table>
 
2458
 
 
2459
 </sect1>
 
2460
 
 
2461
 
 
2462
 <sect1 id="catalog-pg-opclass">
 
2463
  <title><structname>pg_opclass</structname></title>
 
2464
 
 
2465
  <indexterm zone="catalog-pg-opclass">
 
2466
   <primary>pg_opclass</primary>
 
2467
  </indexterm>
 
2468
 
 
2469
  <para>
 
2470
   The catalog <structname>pg_opclass</structname> defines
 
2471
   index access method operator classes.  Each operator class defines
 
2472
   semantics for index columns of a particular data type and a particular
 
2473
   index access method.  Note that there can be multiple operator classes
 
2474
   for a given data type/access method combination, thus supporting multiple
 
2475
   behaviors.
 
2476
  </para>
 
2477
 
 
2478
  <para>
 
2479
   Operator classes are described at length in <xref linkend="xindex">.
 
2480
  </para>
 
2481
 
 
2482
  <table>
 
2483
   <title><structname>pg_opclass</> Columns</title>
 
2484
 
 
2485
   <tgroup cols=4>
 
2486
    <thead>
 
2487
     <row>
 
2488
      <entry>Name</entry>
 
2489
      <entry>Type</entry>
 
2490
      <entry>References</entry>
 
2491
      <entry>Description</entry>
 
2492
     </row>
 
2493
    </thead>
 
2494
    <tbody>
 
2495
 
 
2496
     <row>
 
2497
      <entry><structfield>opcamid</structfield></entry>
 
2498
      <entry><type>oid</type></entry>
 
2499
      <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
 
2500
      <entry>Index access method operator class is for</entry>
 
2501
     </row>
 
2502
 
 
2503
     <row>
 
2504
      <entry><structfield>opcname</structfield></entry>
 
2505
      <entry><type>name</type></entry>
 
2506
      <entry></entry>
 
2507
      <entry>Name of this operator class</entry>
 
2508
     </row>
 
2509
 
 
2510
     <row>
 
2511
      <entry><structfield>opcnamespace</structfield></entry>
 
2512
      <entry><type>oid</type></entry>
 
2513
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
 
2514
      <entry>Namespace of this operator class</entry>
 
2515
     </row>
 
2516
 
 
2517
     <row>
 
2518
      <entry><structfield>opcowner</structfield></entry>
 
2519
      <entry><type>int4</type></entry>
 
2520
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
2521
      <entry>Operator class owner</entry>
 
2522
     </row>
 
2523
 
 
2524
     <row>
 
2525
      <entry><structfield>opcintype</structfield></entry>
 
2526
      <entry><type>oid</type></entry>
 
2527
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
2528
      <entry>Data type that the operator class indexes</entry>
 
2529
     </row>
 
2530
 
 
2531
     <row>
 
2532
      <entry><structfield>opcdefault</structfield></entry>
 
2533
      <entry><type>bool</type></entry>
 
2534
      <entry></entry>
 
2535
      <entry>True if this operator class is the default for <structfield>opcintype</></entry>
 
2536
     </row>
 
2537
 
 
2538
     <row>
 
2539
      <entry><structfield>opckeytype</structfield></entry>
 
2540
      <entry><type>oid</type></entry>
 
2541
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
2542
      <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
 
2543
     </row>
 
2544
 
 
2545
    </tbody>
 
2546
   </tgroup>
 
2547
  </table>
 
2548
 
 
2549
  <para>
 
2550
   The majority of the information defining an operator class is actually
 
2551
   not in its <structname>pg_opclass</structname> row, but in the associated
 
2552
   rows in <structname>pg_amop</structname> and
 
2553
   <structname>pg_amproc</structname>.  Those rows are considered to be
 
2554
   part of the operator class definition &mdash; this is not unlike the way
 
2555
   that a relation is defined by a single <structname>pg_class</structname>
 
2556
   row plus associated rows in <structname>pg_attribute</structname> and
 
2557
   other tables.
 
2558
  </para>
 
2559
 
 
2560
 </sect1>
 
2561
 
 
2562
 
 
2563
 <sect1 id="catalog-pg-operator">
 
2564
  <title><structname>pg_operator</structname></title>
 
2565
 
 
2566
  <indexterm zone="catalog-pg-operator">
 
2567
   <primary>pg_operator</primary>
 
2568
  </indexterm>
 
2569
 
 
2570
  <para>
 
2571
   The catalog <structname>pg_operator</> stores information about operators.
 
2572
   See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
 
2573
   and <xref linkend="xoper"> for more information.
 
2574
  </para>
 
2575
 
 
2576
  <table>
 
2577
   <title><structname>pg_operator</> Columns</title>
 
2578
 
 
2579
   <tgroup cols=4>
 
2580
    <thead>
 
2581
     <row>
 
2582
      <entry>Name</entry>
 
2583
      <entry>Type</entry>
 
2584
      <entry>References</entry>
 
2585
      <entry>Description</entry>
 
2586
     </row>
 
2587
    </thead>
 
2588
 
 
2589
    <tbody>
 
2590
     <row>
 
2591
      <entry><structfield>oprname</structfield></entry>
 
2592
      <entry><type>name</type></entry>
 
2593
      <entry></entry>
 
2594
      <entry>Name of the operator</entry>
 
2595
     </row>
 
2596
 
 
2597
     <row>
 
2598
      <entry><structfield>oprnamespace</structfield></entry>
 
2599
      <entry><type>oid</type></entry>
 
2600
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
 
2601
      <entry>
 
2602
       The OID of the namespace that contains this operator
 
2603
      </entry>
 
2604
     </row>
 
2605
 
 
2606
     <row>
 
2607
      <entry><structfield>oprowner</structfield></entry>
 
2608
      <entry><type>int4</type></entry>
 
2609
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
2610
      <entry>Owner of the operator</entry>
 
2611
     </row>
 
2612
 
 
2613
     <row>
 
2614
      <entry><structfield>oprkind</structfield></entry>
 
2615
      <entry><type>char</type></entry>
 
2616
      <entry></entry>
 
2617
      <entry>
 
2618
       <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
 
2619
       (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
 
2620
      </entry>
 
2621
     </row>
 
2622
 
 
2623
     <row>
 
2624
      <entry><structfield>oprcanhash</structfield></entry>
 
2625
      <entry><type>bool</type></entry>
 
2626
      <entry></entry>
 
2627
      <entry>This operator supports hash joins</entry>
 
2628
     </row>
 
2629
 
 
2630
     <row>
 
2631
      <entry><structfield>oprleft</structfield></entry>
 
2632
      <entry><type>oid</type></entry>
 
2633
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
2634
      <entry>Type of the left operand</entry>
 
2635
     </row>
 
2636
 
 
2637
     <row>
 
2638
      <entry><structfield>oprright</structfield></entry>
 
2639
      <entry><type>oid</type></entry>
 
2640
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
2641
      <entry>Type of the right operand</entry>
 
2642
     </row>
 
2643
 
 
2644
     <row>
 
2645
      <entry><structfield>oprresult</structfield></entry>
 
2646
      <entry><type>oid</type></entry>
 
2647
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
2648
      <entry>Type of the result</entry>
 
2649
     </row>
 
2650
 
 
2651
     <row>
 
2652
      <entry><structfield>oprcom</structfield></entry>
 
2653
      <entry><type>oid</type></entry>
 
2654
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
2655
      <entry>Commutator of this operator, if any</entry>
 
2656
     </row>
 
2657
 
 
2658
     <row>
 
2659
      <entry><structfield>oprnegate</structfield></entry>
 
2660
      <entry><type>oid</type></entry>
 
2661
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
2662
      <entry>Negator of this operator, if any</entry>
 
2663
     </row>
 
2664
 
 
2665
     <row>
 
2666
      <entry><structfield>oprlsortop</structfield></entry>
 
2667
      <entry><type>oid</type></entry>
 
2668
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
2669
      <entry>
 
2670
       If this operator supports merge joins, the operator that sorts
 
2671
       the type of the left-hand operand (<literal>L&lt;L</>)
 
2672
      </entry>
 
2673
     </row>
 
2674
 
 
2675
     <row>
 
2676
      <entry><structfield>oprrsortop</structfield></entry>
 
2677
      <entry><type>oid</type></entry>
 
2678
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
2679
      <entry>
 
2680
       If this operator supports merge joins, the operator that sorts
 
2681
       the type of the right-hand operand (<literal>R&lt;R</>)
 
2682
      </entry>
 
2683
     </row>
 
2684
 
 
2685
     <row>
 
2686
      <entry><structfield>oprltcmpop</structfield></entry>
 
2687
      <entry><type>oid</type></entry>
 
2688
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
2689
      <entry>
 
2690
       If this operator supports merge joins, the less-than operator that
 
2691
       compares the left and right operand types (<literal>L&lt;R</>)
 
2692
      </entry>
 
2693
     </row>
 
2694
 
 
2695
     <row>
 
2696
      <entry><structfield>oprgtcmpop</structfield></entry>
 
2697
      <entry><type>oid</type></entry>
 
2698
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
2699
      <entry>
 
2700
       If this operator supports merge joins, the greater-than operator that
 
2701
       compares the left and right operand types (<literal>L&gt;R</>)
 
2702
      </entry>
 
2703
     </row>
 
2704
 
 
2705
     <row>
 
2706
      <entry><structfield>oprcode</structfield></entry>
 
2707
      <entry><type>regproc</type></entry>
 
2708
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
2709
      <entry>Function that implements this operator</entry>
 
2710
     </row>
 
2711
 
 
2712
     <row>
 
2713
      <entry><structfield>oprrest</structfield></entry>
 
2714
      <entry><type>regproc</type></entry>
 
2715
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
2716
      <entry>Restriction selectivity estimation function for this operator</entry>
 
2717
     </row>
 
2718
 
 
2719
     <row>
 
2720
      <entry><structfield>oprjoin</structfield></entry>
 
2721
      <entry><type>regproc</type></entry>
 
2722
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
2723
      <entry>Join selectivity estimation function for this operator</entry>
 
2724
     </row>
 
2725
    </tbody>
 
2726
   </tgroup>
 
2727
  </table>
 
2728
 
 
2729
  <para>
 
2730
   Unused column contain zeroes, for example <structfield>oprleft</structfield> is zero for a
 
2731
   prefix operator.
 
2732
  </para>
 
2733
 
 
2734
 </sect1>
 
2735
 
 
2736
 
 
2737
 <sect1 id="catalog-pg-proc">
 
2738
  <title><structname>pg_proc</structname></title>
 
2739
 
 
2740
  <indexterm zone="catalog-pg-proc">
 
2741
   <primary>pg_proc</primary>
 
2742
  </indexterm>
 
2743
 
 
2744
  <para>
 
2745
   The catalog <structname>pg_proc</> stores information about functions (or procedures).
 
2746
   See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
 
2747
   and <xref linkend="xfunc"> for more information.
 
2748
  </para>
 
2749
 
 
2750
  <para>
 
2751
   The table contains data for aggregate functions as well as plain functions.
 
2752
   If <structfield>proisagg</structfield> is true, there should be a matching
 
2753
   row in <structfield>pg_aggregate</structfield>.
 
2754
  </para>
 
2755
 
 
2756
  <table>
 
2757
   <title><structname>pg_proc</> Columns</title>
 
2758
 
 
2759
   <tgroup cols=4>
 
2760
    <thead>
 
2761
     <row>
 
2762
      <entry>Name</entry>
 
2763
      <entry>Type</entry>
 
2764
      <entry>References</entry>
 
2765
      <entry>Description</entry>
 
2766
     </row>
 
2767
    </thead>
 
2768
 
 
2769
    <tbody>
 
2770
     <row>
 
2771
      <entry><structfield>proname</structfield></entry>
 
2772
      <entry><type>name</type></entry>
 
2773
      <entry></entry>
 
2774
      <entry>Name of the function</entry>
 
2775
     </row>
 
2776
 
 
2777
     <row>
 
2778
      <entry><structfield>pronamespace</structfield></entry>
 
2779
      <entry><type>oid</type></entry>
 
2780
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
 
2781
      <entry>
 
2782
       The OID of the namespace that contains this function
 
2783
      </entry>
 
2784
     </row>
 
2785
 
 
2786
     <row>
 
2787
      <entry><structfield>proowner</structfield></entry>
 
2788
      <entry><type>int4</type></entry>
 
2789
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
2790
      <entry>Owner of the function</entry>
 
2791
     </row>
 
2792
 
 
2793
     <row>
 
2794
      <entry><structfield>prolang</structfield></entry>
 
2795
      <entry><type>oid</type></entry>
 
2796
      <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
 
2797
      <entry>Implementation language or call interface of this function</entry>
 
2798
     </row>
 
2799
 
 
2800
     <row>
 
2801
      <entry><structfield>proisagg</structfield></entry>
 
2802
      <entry><type>bool</type></entry>
 
2803
      <entry></entry>
 
2804
      <entry>Function is an aggregate function</entry>
 
2805
     </row>
 
2806
 
 
2807
     <row>
 
2808
      <entry><structfield>prosecdef</structfield></entry>
 
2809
      <entry><type>bool</type></entry>
 
2810
      <entry></entry>
 
2811
      <entry>Function is a security definer (i.e., a <quote>setuid</>
 
2812
      function)</entry>
 
2813
     </row>
 
2814
 
 
2815
     <row>
 
2816
      <entry><structfield>proisstrict</structfield></entry>
 
2817
      <entry><type>bool</type></entry>
 
2818
      <entry></entry>
 
2819
      <entry>
 
2820
       Function returns null if any call argument is null.  In that
 
2821
       case the function won't actually be called at all.  Functions
 
2822
       that are not <quote>strict</quote> must be prepared to handle
 
2823
       null inputs.
 
2824
      </entry>
 
2825
     </row>
 
2826
 
 
2827
     <row>
 
2828
      <entry><structfield>proretset</structfield></entry>
 
2829
      <entry><type>bool</type></entry>
 
2830
      <entry></entry>
 
2831
      <entry>Function returns a set (i.e., multiple values of the specified
 
2832
      data type)</entry>
 
2833
     </row>
 
2834
 
 
2835
     <row>
 
2836
      <entry><structfield>provolatile</structfield></entry>
 
2837
      <entry><type>char</type></entry>
 
2838
      <entry></entry>
 
2839
      <entry>
 
2840
       <structfield>provolatile</structfield> tells whether the function's
 
2841
       result depends only on its input arguments, or is affected by outside
 
2842
       factors.
 
2843
       It is <literal>i</literal> for <quote>immutable</> functions,
 
2844
       which always deliver the same result for the same inputs.
 
2845
       It is <literal>s</literal> for <quote>stable</> functions,
 
2846
       whose results (for fixed inputs) do not change within a scan.
 
2847
       It is <literal>v</literal> for <quote>volatile</> functions,
 
2848
       whose results may change at any time.  (Use <literal>v</literal> also
 
2849
       for functions with side-effects, so that calls to them cannot get
 
2850
       optimized away.)
 
2851
      </entry>
 
2852
     </row>
 
2853
 
 
2854
     <row>
 
2855
      <entry><structfield>pronargs</structfield></entry>
 
2856
      <entry><type>int2</type></entry>
 
2857
      <entry></entry>
 
2858
      <entry>Number of arguments</entry>
 
2859
     </row>
 
2860
 
 
2861
     <row>
 
2862
      <entry><structfield>prorettype</structfield></entry>
 
2863
      <entry><type>oid</type></entry>
 
2864
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
2865
      <entry>Data type of the return value</entry>
 
2866
     </row>
 
2867
 
 
2868
     <row>
 
2869
      <entry><structfield>proargtypes</structfield></entry>
 
2870
      <entry><type>oidvector</type></entry>
 
2871
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
2872
      <entry>An array with the data types of the function arguments</entry>
 
2873
     </row>
 
2874
 
 
2875
     <row>
 
2876
      <entry><structfield>proargnames</structfield></entry>
 
2877
      <entry><type>text[]</type></entry>
 
2878
      <entry></entry>
 
2879
      <entry>
 
2880
        An array with the names of the function arguments.
 
2881
        Arguments without a name are set to empty strings in the array.
 
2882
        If none of the arguments have a name, this field may be null.
 
2883
      </entry>
 
2884
     </row>
 
2885
 
 
2886
     <row>
 
2887
      <entry><structfield>prosrc</structfield></entry>
 
2888
      <entry><type>text</type></entry>
 
2889
      <entry></entry>
 
2890
      <entry>
 
2891
       This tells the function handler how to invoke the function.  It
 
2892
       might be the actual source code of the function for interpreted
 
2893
       languages, a link symbol, a file name, or just about anything
 
2894
       else, depending on the implementation language/call convention.
 
2895
      </entry>
 
2896
     </row>
 
2897
 
 
2898
     <row>
 
2899
      <entry><structfield>probin</structfield></entry>
 
2900
      <entry><type>bytea</type></entry>
 
2901
      <entry></entry>
 
2902
      <entry>Additional information about how to invoke the function.
 
2903
      Again, the interpretation is language-specific.
 
2904
      </entry>
 
2905
     </row>
 
2906
 
 
2907
     <row>
 
2908
      <entry><structfield>proacl</structfield></entry>
 
2909
      <entry><type>aclitem[]</type></entry>
 
2910
      <entry></entry>
 
2911
      <entry>
 
2912
       Access privileges; see
 
2913
       <xref linkend="sql-grant" endterm="sql-grant-title"> and
 
2914
       <xref linkend="sql-revoke" endterm="sql-revoke-title">
 
2915
       for details.
 
2916
      </entry>
 
2917
     </row>
 
2918
    </tbody>
 
2919
   </tgroup>
 
2920
  </table>
 
2921
 
 
2922
  <para>
 
2923
   For compiled functions, both built-in and dynamically loaded,
 
2924
   <structfield>prosrc</structfield> contains the function's C-language
 
2925
   name (link symbol).  For all other currently-known language types,
 
2926
   <structfield>prosrc</structfield> contains the function's source
 
2927
   text.  <structfield>probin</structfield> is unused except for
 
2928
   dynamically-loaded C functions, for which it gives the name of the
 
2929
   shared library file containing the function.
 
2930
  </para>
 
2931
 
 
2932
 </sect1>
 
2933
 
 
2934
 <sect1 id="catalog-pg-rewrite">
 
2935
  <title><structname>pg_rewrite</structname></title>
 
2936
 
 
2937
  <indexterm zone="catalog-pg-rewrite">
 
2938
   <primary>pg_rewrite</primary>
 
2939
  </indexterm>
 
2940
 
 
2941
  <para>
 
2942
   The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
 
2943
  </para>
 
2944
 
 
2945
  <table>
 
2946
   <title><structname>pg_rewrite</> Columns</title>
 
2947
 
 
2948
   <tgroup cols=4>
 
2949
    <thead>
 
2950
     <row>
 
2951
      <entry>Name</entry>
 
2952
      <entry>Type</entry>
 
2953
      <entry>References</entry>
 
2954
      <entry>Description</entry>
 
2955
     </row>
 
2956
    </thead>
 
2957
 
 
2958
    <tbody>
 
2959
     <row>
 
2960
      <entry><structfield>rulename</structfield></entry>
 
2961
      <entry><type>name</type></entry>
 
2962
      <entry></entry>
 
2963
      <entry>Rule name</entry>
 
2964
     </row>
 
2965
 
 
2966
     <row>
 
2967
      <entry><structfield>ev_class</structfield></entry>
 
2968
      <entry><type>oid</type></entry>
 
2969
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
2970
      <entry>The table this rule is for</entry>
 
2971
     </row>
 
2972
 
 
2973
     <row>
 
2974
      <entry><structfield>ev_attr</structfield></entry>
 
2975
      <entry><type>int2</type></entry>
 
2976
      <entry></entry>
 
2977
      <entry>The column this rule is for (currently, always zero to
 
2978
      indicate the whole table)</entry>
 
2979
     </row>
 
2980
 
 
2981
     <row>
 
2982
      <entry><structfield>ev_type</structfield></entry>
 
2983
      <entry><type>char</type></entry>
 
2984
      <entry></entry>
 
2985
      <entry>
 
2986
       Event type that the rule is for: 1 = <command>SELECT</>, 2 =
 
2987
       <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
 
2988
       <command>DELETE</>
 
2989
      </entry>
 
2990
     </row>
 
2991
 
 
2992
     <row>
 
2993
      <entry><structfield>is_instead</structfield></entry>
 
2994
      <entry><type>bool</type></entry>
 
2995
      <entry></entry>
 
2996
      <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
 
2997
     </row>
 
2998
 
 
2999
     <row>
 
3000
      <entry><structfield>ev_qual</structfield></entry>
 
3001
      <entry><type>text</type></entry>
 
3002
      <entry></entry>
 
3003
      <entry>
 
3004
       Expression tree (in the form of a
 
3005
       <function>nodeToString()</function> representation) for the
 
3006
       rule's qualifying condition
 
3007
      </entry>
 
3008
     </row>
 
3009
 
 
3010
     <row>
 
3011
      <entry><structfield>ev_action</structfield></entry>
 
3012
      <entry><type>text</type></entry>
 
3013
      <entry></entry>
 
3014
      <entry>
 
3015
       Query tree (in the form of a
 
3016
       <function>nodeToString()</function> representation) for the
 
3017
       rule's action
 
3018
      </entry>
 
3019
     </row>
 
3020
    </tbody>
 
3021
   </tgroup>
 
3022
  </table>
 
3023
 
 
3024
  <note>
 
3025
   <para>
 
3026
    <literal>pg_class.relhasrules</literal>
 
3027
    must be true if a table has any rules in this catalog.
 
3028
   </para>
 
3029
  </note>
 
3030
 
 
3031
 </sect1>
 
3032
 
 
3033
 
 
3034
 <sect1 id="catalog-pg-shadow">
 
3035
  <title><structname>pg_shadow</structname></title>
 
3036
 
 
3037
  <indexterm zone="catalog-pg-shadow">
 
3038
   <primary>pg_shadow</primary>
 
3039
  </indexterm>
 
3040
 
 
3041
  <para>
 
3042
   The catalog <structname>pg_shadow</structname> contains information about
 
3043
   database users.  The name stems from the fact that this table
 
3044
   should not be readable by the public since it contains passwords.
 
3045
   <link linkend="view-pg-user"><structname>pg_user</structname></link>
 
3046
   is a publicly readable view on
 
3047
   <structname>pg_shadow</structname> that blanks out the password field.
 
3048
  </para>
 
3049
 
 
3050
  <para>
 
3051
   <xref linkend="user-manag"> contains detailed information about user and
 
3052
   privilege management.
 
3053
  </para>
 
3054
 
 
3055
  <para>
 
3056
   Because user identities are cluster-wide,
 
3057
   <structname>pg_shadow</structname>
 
3058
   is shared across all databases of a cluster: there is only one
 
3059
   copy of <structname>pg_shadow</structname> per cluster, not
 
3060
   one per database.
 
3061
  </para>
 
3062
 
 
3063
  <table>
 
3064
   <title><structname>pg_shadow</> Columns</title>
 
3065
 
 
3066
   <tgroup cols=4>
 
3067
    <thead>
 
3068
     <row>
 
3069
      <entry>Name</entry>
 
3070
      <entry>Type</entry>
 
3071
      <entry>References</entry>
 
3072
      <entry>Description</entry>
 
3073
     </row>
 
3074
    </thead>
 
3075
 
 
3076
    <tbody>
 
3077
     <row>
 
3078
      <entry><structfield>usename</structfield></entry>
 
3079
      <entry><type>name</type></entry>
 
3080
      <entry></entry>
 
3081
      <entry>User name</entry>
 
3082
     </row>
 
3083
 
 
3084
     <row>
 
3085
      <entry><structfield>usesysid</structfield></entry>
 
3086
      <entry><type>int4</type></entry>
 
3087
      <entry></entry>
 
3088
      <entry>User ID (arbitrary number used to reference this user)</entry>
 
3089
     </row>
 
3090
 
 
3091
     <row>
 
3092
      <entry><structfield>usecreatedb</structfield></entry>
 
3093
      <entry><type>bool</type></entry>
 
3094
      <entry></entry>
 
3095
      <entry>User may create databases</entry>
 
3096
     </row>
 
3097
 
 
3098
     <row>
 
3099
      <entry><structfield>usesuper</structfield></entry>
 
3100
      <entry><type>bool</type></entry>
 
3101
      <entry></entry>
 
3102
      <entry>User is a superuser</entry>
 
3103
     </row>
 
3104
 
 
3105
     <row>
 
3106
      <entry><structfield>usecatupd</structfield></entry>
 
3107
      <entry><type>bool</type></entry>
 
3108
      <entry></entry>
 
3109
      <entry>
 
3110
       User may update system catalogs.  (Even a superuser may not do
 
3111
       this unless this column is true.)
 
3112
      </entry>
 
3113
     </row>
 
3114
 
 
3115
     <row>
 
3116
      <entry><structfield>passwd</structfield></entry>
 
3117
      <entry><type>text</type></entry>
 
3118
      <entry></entry>
 
3119
      <entry>Password (possibly encrypted)</entry>
 
3120
     </row>
 
3121
 
 
3122
     <row>
 
3123
      <entry><structfield>valuntil</structfield></entry>
 
3124
      <entry><type>abstime</type></entry>
 
3125
      <entry></entry>
 
3126
      <entry>Password expiry time (only used for password authentication)</entry>
 
3127
     </row>
 
3128
 
 
3129
     <row>
 
3130
      <entry><structfield>useconfig</structfield></entry>
 
3131
      <entry><type>text[]</type></entry>
 
3132
      <entry></entry>
 
3133
      <entry>Session defaults for run-time configuration variables</entry>
 
3134
     </row>
 
3135
    </tbody>
 
3136
   </tgroup>
 
3137
  </table>
 
3138
 
 
3139
 </sect1>
 
3140
 
 
3141
 
 
3142
 <sect1 id="catalog-pg-statistic">
 
3143
  <title><structname>pg_statistic</structname></title>
 
3144
 
 
3145
  <indexterm zone="catalog-pg-statistic">
 
3146
   <primary>pg_statistic</primary>
 
3147
  </indexterm>
 
3148
 
 
3149
  <para>
 
3150
   The catalog <structname>pg_statistic</structname> stores statistical data
 
3151
   about the contents of the database.  Entries are created by
 
3152
   <command>ANALYZE</command> and subsequently used by the query planner.
 
3153
   There is one entry for each table column that has been analyzed.
 
3154
   Note that all the statistical data is inherently approximate,
 
3155
   even assuming that it is up-to-date.
 
3156
  </para>
 
3157
 
 
3158
  <para>
 
3159
   <structname>pg_statistic</structname> also stores statistical data about
 
3160
   the values of index expressions.  These are described as if they were
 
3161
   actual data columns; in particular, <structfield>starelid</structfield>
 
3162
   references the index.  No entry is made for an ordinary non-expression
 
3163
   index column, however, since it would be redundant with the entry
 
3164
   for the underlying table column.
 
3165
  </para>
 
3166
 
 
3167
  <para>
 
3168
   Since different kinds of statistics may be appropriate for different
 
3169
   kinds of data, <structname>pg_statistic</structname> is designed not
 
3170
   to assume very much about what sort of statistics it stores.  Only
 
3171
   extremely general statistics (such as nullness) are given dedicated
 
3172
   columns in <structname>pg_statistic</structname>.  Everything else
 
3173
   is stored in <quote>slots</quote>, which are groups of associated columns
 
3174
   whose content is identified by a code number in one of the slot's columns.
 
3175
   For more information see
 
3176
   <filename>src/include/catalog/pg_statistic.h</filename>.
 
3177
  </para>
 
3178
 
 
3179
  <para>
 
3180
   <structname>pg_statistic</structname> should not be readable by the
 
3181
   public, since even statistical information about a table's contents
 
3182
   may be considered sensitive.  (Example: minimum and maximum values
 
3183
   of a salary column might be quite interesting.)
 
3184
   <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
 
3185
   is a publicly readable view on
 
3186
   <structname>pg_statistic</structname> that only exposes information
 
3187
   about those tables that are readable by the current user.
 
3188
  </para>
 
3189
 
 
3190
  <table>
 
3191
   <title><structname>pg_statistic</> Columns</title>
 
3192
 
 
3193
   <tgroup cols=4>
 
3194
    <thead>
 
3195
     <row>
 
3196
      <entry>Name</entry>
 
3197
      <entry>Type</entry>
 
3198
      <entry>References</entry>
 
3199
      <entry>Description</entry>
 
3200
     </row>
 
3201
    </thead>
 
3202
 
 
3203
    <tbody>
 
3204
     <row>
 
3205
      <entry><structfield>starelid</structfield></entry>
 
3206
      <entry><type>oid</type></entry>
 
3207
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
3208
      <entry>The table or index that the described column belongs to</entry>
 
3209
     </row>
 
3210
 
 
3211
     <row>
 
3212
      <entry><structfield>staattnum</structfield></entry>
 
3213
      <entry><type>int2</type></entry>
 
3214
      <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
 
3215
      <entry>The number of the described column</entry>
 
3216
     </row>
 
3217
 
 
3218
     <row>
 
3219
      <entry><structfield>stanullfrac</structfield></entry>
 
3220
      <entry><type>float4</type></entry>
 
3221
      <entry></entry>
 
3222
      <entry>The fraction of the column's entries that are null</entry>
 
3223
     </row>
 
3224
 
 
3225
     <row>
 
3226
      <entry><structfield>stawidth</structfield></entry>
 
3227
      <entry><type>int4</type></entry>
 
3228
      <entry></entry>
 
3229
      <entry>The average stored width, in bytes, of nonnull entries</entry>
 
3230
     </row>
 
3231
 
 
3232
     <row>
 
3233
      <entry><structfield>stadistinct</structfield></entry>
 
3234
      <entry><type>float4</type></entry>
 
3235
      <entry></entry>
 
3236
      <entry>The number of distinct nonnull data values in the column.
 
3237
      A value greater than zero is the actual number of distinct values.
 
3238
      A value less than zero is the negative of a fraction of the number
 
3239
      of rows in the table (for example, a column in which values appear about
 
3240
      twice on the average could be represented by <structfield>stadistinct</> = -0.5).
 
3241
      A zero value means the number of distinct values is unknown.
 
3242
      </entry>
 
3243
     </row>
 
3244
 
 
3245
     <row>
 
3246
      <entry><structfield>stakind<replaceable>N</></structfield></entry>
 
3247
      <entry><type>int2</type></entry>
 
3248
      <entry></entry>
 
3249
      <entry>
 
3250
       A code number indicating the kind of statistics stored in the
 
3251
       <replaceable>N</>th <quote>slot</quote> of the
 
3252
       <structname>pg_statistic</structname> row.
 
3253
      </entry>
 
3254
     </row>
 
3255
 
 
3256
     <row>
 
3257
      <entry><structfield>staop<replaceable>N</></structfield></entry>
 
3258
      <entry><type>oid</type></entry>
 
3259
      <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
 
3260
      <entry>
 
3261
       An operator used to derive the statistics stored in the
 
3262
       <replaceable>N</>th <quote>slot</quote>.  For example, a
 
3263
       histogram slot would show the <literal>&lt;</literal> operator
 
3264
       that defines the sort order of the data.
 
3265
      </entry>
 
3266
     </row>
 
3267
 
 
3268
     <row>
 
3269
      <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
 
3270
      <entry><type>float4[]</type></entry>
 
3271
      <entry></entry>
 
3272
      <entry>
 
3273
       Numerical statistics of the appropriate kind for the
 
3274
       <replaceable>N</>th <quote>slot</quote>, or null if the slot
 
3275
       kind does not involve numerical values.
 
3276
      </entry>
 
3277
     </row>
 
3278
 
 
3279
     <row>
 
3280
      <entry><structfield>stavalues<replaceable>N</></structfield></entry>
 
3281
      <entry><type>anyarray</type></entry>
 
3282
      <entry></entry>
 
3283
      <entry>
 
3284
       Column data values of the appropriate kind for the
 
3285
       <replaceable>N</>th <quote>slot</quote>, or null if the slot
 
3286
       kind does not store any data values.  Each array's element
 
3287
       values are actually of the specific column's data type, so there
 
3288
       is no way to define these columns' type more specifically than
 
3289
       <type>anyarray</>.
 
3290
      </entry>
 
3291
     </row>
 
3292
    </tbody>
 
3293
   </tgroup>
 
3294
  </table>
 
3295
 
 
3296
 </sect1>
 
3297
 
 
3298
 
 
3299
 <sect1 id="catalog-pg-tablespace">
 
3300
  <title><structname>pg_tablespace</structname></title>
 
3301
 
 
3302
  <indexterm zone="catalog-pg-tablespace">
 
3303
   <primary>pg_tablespace</primary>
 
3304
  </indexterm>
 
3305
 
 
3306
  <para>
 
3307
   The catalog <structname>pg_tablespace</structname> stores information
 
3308
   about the available tablespaces.  Tables can be placed in particular
 
3309
   tablespaces to aid administration of disk layout.
 
3310
  </para>
 
3311
 
 
3312
  <para>
 
3313
   Unlike most system catalogs, <structname>pg_tablespace</structname>
 
3314
   is shared across all databases of a cluster: there is only one
 
3315
   copy of <structname>pg_tablespace</structname> per cluster, not
 
3316
   one per database.
 
3317
  </para>
 
3318
 
 
3319
  <table>
 
3320
   <title><structname>pg_tablespace</> Columns</title>
 
3321
 
 
3322
   <tgroup cols=4>
 
3323
    <thead>
 
3324
     <row>
 
3325
      <entry>Name</entry>
 
3326
      <entry>Type</entry>
 
3327
      <entry>References</entry>
 
3328
      <entry>Description</entry>
 
3329
     </row>
 
3330
    </thead>
 
3331
 
 
3332
    <tbody>
 
3333
     <row>
 
3334
      <entry><structfield>spcname</structfield></entry>
 
3335
      <entry><type>name</type></entry>
 
3336
      <entry></entry>
 
3337
      <entry>Tablespace name</entry>
 
3338
     </row>
 
3339
 
 
3340
     <row>
 
3341
      <entry><structfield>spcowner</structfield></entry>
 
3342
      <entry><type>int4</type></entry>
 
3343
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
3344
      <entry>Owner of the tablespace, usually the user who created it</entry>
 
3345
     </row>
 
3346
 
 
3347
     <row>
 
3348
      <entry><structfield>spclocation</structfield></entry>
 
3349
      <entry><type>text</type></entry>
 
3350
      <entry></entry>
 
3351
      <entry>Location (directory path) of the tablespace</entry>
 
3352
     </row>
 
3353
 
 
3354
     <row>
 
3355
      <entry><structfield>spcacl</structfield></entry>
 
3356
      <entry><type>aclitem[]</type></entry>
 
3357
      <entry></entry>
 
3358
      <entry>
 
3359
       Access privileges; see
 
3360
       <xref linkend="sql-grant" endterm="sql-grant-title"> and
 
3361
       <xref linkend="sql-revoke" endterm="sql-revoke-title">
 
3362
       for details.
 
3363
      </entry>
 
3364
     </row>
 
3365
    </tbody>
 
3366
   </tgroup>
 
3367
  </table>
 
3368
 </sect1>
 
3369
 
 
3370
 
 
3371
 <sect1 id="catalog-pg-trigger">
 
3372
  <title><structname>pg_trigger</structname></title>
 
3373
 
 
3374
  <indexterm zone="catalog-pg-trigger">
 
3375
   <primary>pg_trigger</primary>
 
3376
  </indexterm>
 
3377
 
 
3378
  <para>
 
3379
   The catalog <structname>pg_trigger</structname> stores triggers on tables.
 
3380
   See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
 
3381
   for more information.
 
3382
  </para>
 
3383
 
 
3384
  <table>
 
3385
   <title><structname>pg_trigger</> Columns</title>
 
3386
 
 
3387
   <tgroup cols=4>
 
3388
    <thead>
 
3389
     <row>
 
3390
      <entry>Name</entry>
 
3391
      <entry>Type</entry>
 
3392
      <entry>References</entry>
 
3393
      <entry>Description</entry>
 
3394
     </row>
 
3395
    </thead>
 
3396
 
 
3397
    <tbody>
 
3398
     <row>
 
3399
      <entry><structfield>tgrelid</structfield></entry>
 
3400
      <entry><type>oid</type></entry>
 
3401
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
3402
      <entry>The table this trigger is on</entry>
 
3403
     </row>
 
3404
 
 
3405
     <row>
 
3406
      <entry><structfield>tgname</structfield></entry>
 
3407
      <entry><type>name</type></entry>
 
3408
      <entry></entry>
 
3409
      <entry>Trigger name (must be unique among triggers of same table)</entry>
 
3410
     </row>
 
3411
 
 
3412
     <row>
 
3413
      <entry><structfield>tgfoid</structfield></entry>
 
3414
      <entry><type>oid</type></entry>
 
3415
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
3416
      <entry>The function to be called</entry>
 
3417
     </row>
 
3418
 
 
3419
     <row>
 
3420
      <entry><structfield>tgtype</structfield></entry>
 
3421
      <entry><type>int2</type></entry>
 
3422
      <entry></entry>
 
3423
      <entry>Bit mask identifying trigger conditions</entry>
 
3424
     </row>
 
3425
 
 
3426
     <row>
 
3427
      <entry><structfield>tgenabled</structfield></entry>
 
3428
      <entry><type>bool</type></entry>
 
3429
      <entry></entry>
 
3430
      <entry>True if trigger is enabled (not presently checked everywhere
 
3431
      it should be, so disabling a trigger by setting this false does not
 
3432
      work reliably)</entry>
 
3433
     </row>
 
3434
 
 
3435
     <row>
 
3436
      <entry><structfield>tgisconstraint</structfield></entry>
 
3437
      <entry><type>bool</type></entry>
 
3438
      <entry></entry>
 
3439
      <entry>True if trigger implements a referential integrity constraint</entry>
 
3440
     </row>
 
3441
 
 
3442
     <row>
 
3443
      <entry><structfield>tgconstrname</structfield></entry>
 
3444
      <entry><type>name</type></entry>
 
3445
      <entry></entry>
 
3446
      <entry>Referential integrity constraint name</entry>
 
3447
     </row>
 
3448
 
 
3449
     <row>
 
3450
      <entry><structfield>tgconstrrelid</structfield></entry>
 
3451
      <entry><type>oid</type></entry>
 
3452
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
3453
      <entry>The table referenced by an referential integrity constraint</entry>
 
3454
     </row>
 
3455
 
 
3456
     <row>
 
3457
      <entry><structfield>tgdeferrable</structfield></entry>
 
3458
      <entry><type>bool</type></entry>
 
3459
      <entry></entry>
 
3460
      <entry>True if deferrable</entry>
 
3461
     </row>
 
3462
 
 
3463
     <row>
 
3464
      <entry><structfield>tginitdeferred</structfield></entry>
 
3465
      <entry><type>bool</type></entry>
 
3466
      <entry></entry>
 
3467
      <entry>True if initially deferred</entry>
 
3468
     </row>
 
3469
 
 
3470
     <row>
 
3471
      <entry><structfield>tgnargs</structfield></entry>
 
3472
      <entry><type>int2</type></entry>
 
3473
      <entry></entry>
 
3474
      <entry>Number of argument strings passed to trigger function</entry>
 
3475
     </row>
 
3476
 
 
3477
     <row>
 
3478
      <entry><structfield>tgattr</structfield></entry>
 
3479
      <entry><type>int2vector</type></entry>
 
3480
      <entry></entry>
 
3481
      <entry>Currently unused</entry>
 
3482
     </row>
 
3483
 
 
3484
     <row>
 
3485
      <entry><structfield>tgargs</structfield></entry>
 
3486
      <entry><type>bytea</type></entry>
 
3487
      <entry></entry>
 
3488
      <entry>Argument strings to pass to trigger, each null-terminated</entry>
 
3489
     </row>
 
3490
    </tbody>
 
3491
   </tgroup>
 
3492
  </table>
 
3493
 
 
3494
  <note>
 
3495
   <para>
 
3496
    <literal>pg_class.reltriggers</literal> needs to agree with the
 
3497
    number of triggers found in this table for the given relation.
 
3498
   </para>
 
3499
  </note>
 
3500
 
 
3501
 </sect1>
 
3502
 
 
3503
 
 
3504
 <sect1 id="catalog-pg-type">
 
3505
  <title><structname>pg_type</structname></title>
 
3506
 
 
3507
  <indexterm zone="catalog-pg-type">
 
3508
   <primary>pg_type</primary>
 
3509
  </indexterm>
 
3510
 
 
3511
  <para>
 
3512
   The catalog <structname>pg_type</structname> stores information about data
 
3513
   types.  Base types (scalar types) are created with
 
3514
   <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
 
3515
   domains with
 
3516
   <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
 
3517
   A composite type is automatically created for each table in the database, to
 
3518
   represent the row structure of the table.  It is also possible to create
 
3519
   composite types with <command>CREATE TYPE AS</command>.
 
3520
  </para>
 
3521
 
 
3522
  <table>
 
3523
   <title><structname>pg_type</> Columns</title>
 
3524
 
 
3525
   <tgroup cols=4>
 
3526
    <thead>
 
3527
     <row>
 
3528
      <entry>Name</entry>
 
3529
      <entry>Type</entry>
 
3530
      <entry>References</entry>
 
3531
      <entry>Description</entry>
 
3532
     </row>
 
3533
    </thead>
 
3534
 
 
3535
    <tbody>
 
3536
     <row>
 
3537
      <entry><structfield>typname</structfield></entry>
 
3538
      <entry><type>name</type></entry>
 
3539
      <entry></entry>
 
3540
      <entry>Data type name</entry>
 
3541
     </row>
 
3542
 
 
3543
     <row>
 
3544
      <entry><structfield>typnamespace</structfield></entry>
 
3545
      <entry><type>oid</type></entry>
 
3546
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
 
3547
      <entry>
 
3548
       The OID of the namespace that contains this type
 
3549
      </entry>
 
3550
     </row>
 
3551
 
 
3552
     <row>
 
3553
      <entry><structfield>typowner</structfield></entry>
 
3554
      <entry><type>int4</type></entry>
 
3555
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry>
 
3556
      <entry>Owner of the type</entry>
 
3557
     </row>
 
3558
 
 
3559
     <row>
 
3560
      <entry><structfield>typlen</structfield></entry>
 
3561
      <entry><type>int2</type></entry>
 
3562
      <entry></entry>
 
3563
      <entry>
 
3564
       For a fixed-size type, <structfield>typlen</structfield> is the number
 
3565
       of bytes in the internal representation of the type.  But for a
 
3566
       variable-length type, <structfield>typlen</structfield> is negative.
 
3567
       -1 indicates a <quote>varlena</> type (one that has a length word),
 
3568
       -2 indicates a null-terminated C string.
 
3569
      </entry>
 
3570
     </row>
 
3571
 
 
3572
     <row>
 
3573
      <entry><structfield>typbyval</structfield></entry>
 
3574
      <entry><type>bool</type></entry>
 
3575
      <entry></entry>
 
3576
      <entry>
 
3577
       <structfield>typbyval</structfield> determines whether internal
 
3578
       routines pass a value of this type by value or by reference.
 
3579
       <structfield>typbyval</structfield> had better be false if
 
3580
       <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
 
3581
       where Datum is 8 bytes).
 
3582
       Variable-length types are always passed by reference. Note that
 
3583
       <structfield>typbyval</structfield> can be false even if the
 
3584
       length would allow pass-by-value; this is currently true for
 
3585
       type <type>float4</type>, for example.
 
3586
      </entry>
 
3587
     </row>
 
3588
 
 
3589
     <row>
 
3590
      <entry><structfield>typtype</structfield></entry>
 
3591
      <entry><type>char</type></entry>
 
3592
      <entry></entry>
 
3593
      <entry>
 
3594
       <structfield>typtype</structfield> is <literal>b</literal> for
 
3595
       a base type, <literal>c</literal> for a composite type (e.g., a
 
3596
       table's row type), <literal>d</literal> for a domain, or
 
3597
       <literal>p</literal> for a pseudo-type.  See also
 
3598
       <structfield>typrelid</structfield> and
 
3599
       <structfield>typbasetype</structfield>.
 
3600
      </entry>
 
3601
     </row>
 
3602
 
 
3603
     <row>
 
3604
      <entry><structfield>typisdefined</structfield></entry>
 
3605
      <entry><type>bool</type></entry>
 
3606
      <entry></entry>
 
3607
      <entry>
 
3608
       True if the type is defined, false if this is a placeholder
 
3609
       entry for a not-yet-defined type.  When
 
3610
       <structfield>typisdefined</structfield> is false, nothing
 
3611
       except the type name, namespace, and OID can be relied on.
 
3612
      </entry>
 
3613
     </row>
 
3614
 
 
3615
     <row>
 
3616
      <entry><structfield>typdelim</structfield></entry>
 
3617
      <entry><type>char</type></entry>
 
3618
      <entry></entry>
 
3619
      <entry>Character that separates two values of this type when parsing
 
3620
      array input.  Note that the delimiter is associated with the array
 
3621
      element data type, not the array data type.</entry>
 
3622
     </row>
 
3623
 
 
3624
     <row>
 
3625
      <entry><structfield>typrelid</structfield></entry>
 
3626
      <entry><type>oid</type></entry>
 
3627
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
3628
      <entry>
 
3629
       If this is a composite type (see
 
3630
       <structfield>typtype</structfield>), then this column points to
 
3631
       the <structname>pg_class</structname> entry that defines the
 
3632
       corresponding table.  (For a free-standing composite type, the
 
3633
       <structname>pg_class</structname> entry doesn't really represent
 
3634
       a table, but it is needed anyway for the type's
 
3635
       <structname>pg_attribute</structname> entries to link to.)
 
3636
       Zero for non-composite types.
 
3637
      </entry>
 
3638
     </row>
 
3639
 
 
3640
     <row>
 
3641
      <entry><structfield>typelem</structfield></entry>
 
3642
      <entry><type>oid</type></entry>
 
3643
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
3644
      <entry>
 
3645
       If <structfield>typelem</structfield> is not 0 then it
 
3646
       identifies another row in <structname>pg_type</structname>.
 
3647
       The current type can then be subscripted like an array yielding
 
3648
       values of type <structfield>typelem</structfield>.  A
 
3649
       <quote>true</quote> array type is variable length
 
3650
       (<structfield>typlen</structfield> = -1),
 
3651
       but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
 
3652
       also have nonzero <structfield>typelem</structfield>, for example
 
3653
       <type>name</type> and <type>oidvector</type>.
 
3654
       If a fixed-length type has a <structfield>typelem</structfield> then
 
3655
       its internal representation must be some number of values of the
 
3656
       <structfield>typelem</structfield> data type with no other data.
 
3657
       Variable-length array types have a header defined by the array
 
3658
       subroutines.
 
3659
      </entry>
 
3660
     </row>
 
3661
 
 
3662
     <row>
 
3663
      <entry><structfield>typinput</structfield></entry>
 
3664
      <entry><type>regproc</type></entry>
 
3665
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
3666
      <entry>Input conversion function (text format)</entry>
 
3667
     </row>
 
3668
 
 
3669
     <row>
 
3670
      <entry><structfield>typoutput</structfield></entry>
 
3671
      <entry><type>regproc</type></entry>
 
3672
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
3673
      <entry>Output conversion function (text format)</entry>
 
3674
     </row>
 
3675
 
 
3676
     <row>
 
3677
      <entry><structfield>typreceive</structfield></entry>
 
3678
      <entry><type>regproc</type></entry>
 
3679
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
3680
      <entry>Input conversion function (binary format), or 0 if none</entry>
 
3681
     </row>
 
3682
 
 
3683
     <row>
 
3684
      <entry><structfield>typsend</structfield></entry>
 
3685
      <entry><type>regproc</type></entry>
 
3686
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
3687
      <entry>Output conversion function (binary format), or 0 if none</entry>
 
3688
     </row>
 
3689
 
 
3690
     <row>
 
3691
      <entry><structfield>typanalyze</structfield></entry>
 
3692
      <entry><type>regproc</type></entry>
 
3693
      <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
 
3694
      <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
 
3695
     </row>
 
3696
 
 
3697
     <row>
 
3698
      <entry><structfield>typalign</structfield></entry>
 
3699
      <entry><type>char</type></entry>
 
3700
      <entry></entry>
 
3701
      <entry><para>
 
3702
 
 
3703
       <structfield>typalign</structfield> is the alignment required
 
3704
       when storing a value of this type.  It applies to storage on
 
3705
       disk as well as most representations of the value inside
 
3706
       <productname>PostgreSQL</>.
 
3707
       When multiple values are stored consecutively, such
 
3708
       as in the representation of a complete row on disk, padding is
 
3709
       inserted before a datum of this type so that it begins on the
 
3710
       specified boundary.  The alignment reference is the beginning
 
3711
       of the first datum in the sequence.
 
3712
      </para><para>
 
3713
       Possible values are:
 
3714
       <itemizedlist>
 
3715
        <listitem>
 
3716
         <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
 
3717
        </listitem>
 
3718
        <listitem>
 
3719
         <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
 
3720
        </listitem>
 
3721
        <listitem>
 
3722
         <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
 
3723
        </listitem>
 
3724
        <listitem>
 
3725
         <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
 
3726
        </listitem>
 
3727
       </itemizedlist>
 
3728
      </para><note>
 
3729
       <para>
 
3730
        For types used in system tables, it is critical that the size
 
3731
        and alignment defined in <structname>pg_type</structname>
 
3732
        agree with the way that the compiler will lay out the column in
 
3733
        a structure representing a table row.
 
3734
       </para>
 
3735
      </note></entry>
 
3736
     </row>
 
3737
 
 
3738
     <row>
 
3739
      <entry><structfield>typstorage</structfield></entry>
 
3740
      <entry><type>char</type></entry>
 
3741
      <entry></entry>
 
3742
      <entry><para>
 
3743
       <structfield>typstorage</structfield> tells for varlena
 
3744
       types (those with <structfield>typlen</structfield> = -1) if
 
3745
       the type is prepared for toasting and what the default strategy
 
3746
       for attributes of this type should be.
 
3747
       Possible values are
 
3748
       <itemizedlist>
 
3749
        <listitem>
 
3750
         <para><literal>p</>: Value must always be stored plain.</para>
 
3751
        </listitem>
 
3752
        <listitem>
 
3753
         <para>
 
3754
          <literal>e</>: Value can be stored in a <quote>secondary</quote>
 
3755
          relation (if relation has one, see
 
3756
          <literal>pg_class.reltoastrelid</literal>).
 
3757
         </para>
 
3758
        </listitem>
 
3759
        <listitem>
 
3760
         <para><literal>m</>: Value can be stored compressed inline.</para>
 
3761
        </listitem>
 
3762
        <listitem>
 
3763
         <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
 
3764
        </listitem>
 
3765
       </itemizedlist>
 
3766
       Note that <literal>m</> columns can also be moved out to secondary
 
3767
       storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
 
3768
       moved first).
 
3769
      </para></entry>
 
3770
     </row>
 
3771
 
 
3772
     <row>
 
3773
      <entry><structfield>typnotnull</structfield></entry>
 
3774
      <entry><type>bool</type></entry>
 
3775
      <entry></entry>
 
3776
      <entry><para>
 
3777
       <structfield>typnotnull</structfield> represents a not-null
 
3778
       constraint on a type.  Used for domains only.
 
3779
      </para></entry>
 
3780
     </row>
 
3781
 
 
3782
     <row>
 
3783
      <entry><structfield>typbasetype</structfield></entry>
 
3784
      <entry><type>oid</type></entry>
 
3785
      <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
 
3786
      <entry><para>
 
3787
       If this is a domain (see <structfield>typtype</structfield>),
 
3788
       then <structfield>typbasetype</structfield> identifies
 
3789
       the type that this one is based on.  Zero if not a domain.
 
3790
      </para></entry>
 
3791
     </row>
 
3792
 
 
3793
     <row>
 
3794
      <entry><structfield>typtypmod</structfield></entry>
 
3795
      <entry><type>int4</type></entry>
 
3796
      <entry></entry>
 
3797
      <entry><para>
 
3798
       Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
 
3799
       to be applied to their base type (-1 if base type does not use a
 
3800
       <literal>typmod</>).  -1 if this type is not a domain.
 
3801
      </para></entry>
 
3802
     </row>
 
3803
 
 
3804
     <row>
 
3805
      <entry><structfield>typndims</structfield></entry>
 
3806
      <entry><type>int4</type></entry>
 
3807
      <entry></entry>
 
3808
      <entry><para>
 
3809
       <structfield>typndims</structfield> is the number of array dimensions
 
3810
       for a domain that is an array (that is, <structfield>typbasetype</> is an array type;
 
3811
       the domain's <structfield>typelem</> will match the base type's <structfield>typelem</structfield>).
 
3812
       Zero for types other than array domains.
 
3813
       </para></entry>
 
3814
     </row>
 
3815
 
 
3816
     <row>
 
3817
      <entry><structfield>typdefaultbin</structfield></entry>
 
3818
      <entry><type>text</type></entry>
 
3819
      <entry></entry>
 
3820
      <entry><para>
 
3821
       If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
 
3822
       representation of a default expression for the type.  This is
 
3823
       only used for domains.
 
3824
      </para></entry>
 
3825
     </row>
 
3826
 
 
3827
     <row>
 
3828
      <entry><structfield>typdefault</structfield></entry>
 
3829
      <entry><type>text</type></entry>
 
3830
      <entry></entry>
 
3831
      <entry><para>
 
3832
       <structfield>typdefault</> is null if the type has no associated
 
3833
       default value. If <structfield>typdefaultbin</> is not null,
 
3834
       <structfield>typdefault</> must contain a human-readable version of the
 
3835
       default expression represented by <structfield>typdefaultbin</>.  If
 
3836
       <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
 
3837
       not, then <structfield>typdefault</> is the external representation of
 
3838
       the type's default value, which may be fed to the type's input
 
3839
       converter to produce a constant.
 
3840
      </para></entry>
 
3841
     </row>
 
3842
    </tbody>
 
3843
   </tgroup>
 
3844
  </table>
 
3845
 </sect1>
 
3846
 
 
3847
 <sect1 id="views-overview">
 
3848
  <title>System Views</title>
 
3849
 
 
3850
  <para>
 
3851
   In addition to the system catalogs, <productname>PostgreSQL</productname>
 
3852
   provides a number of built-in views.  Some system views provide convenient
 
3853
   access to some commonly used queries on the system catalogs.  Other views
 
3854
   provide access to internal server state.
 
3855
  </para>
 
3856
 
 
3857
  <para>
 
3858
   The information schema (<xref linkend="information-schema">) provides
 
3859
   an alternative set of views which overlap the functionality of the system
 
3860
   views.  Since the information schema is SQL-standard whereas the views
 
3861
   described here are <productname>PostgreSQL</productname>-specific,
 
3862
   it's usually better to use the information schema if it provides all
 
3863
   the information you need.
 
3864
  </para>
 
3865
 
 
3866
  <para>
 
3867
   <xref linkend="view-table"> lists the system views described here.
 
3868
   More detailed documentation of each view follows below.
 
3869
   There are some additional views that provide access to the results of
 
3870
   the statistics collector; they are described in <xref
 
3871
   linkend="monitoring-stats-views-table">.
 
3872
  </para>
 
3873
 
 
3874
  <para>
 
3875
   Except where noted, all the views described here are read-only.
 
3876
  </para>
 
3877
 
 
3878
  <table id="view-table">
 
3879
   <title>System Views</title>
 
3880
 
 
3881
   <tgroup cols="2">
 
3882
    <thead>
 
3883
     <row>
 
3884
      <entry>View Name</entry>
 
3885
      <entry>Purpose</entry>
 
3886
     </row>
 
3887
    </thead>
 
3888
 
 
3889
    <tbody>
 
3890
     <row>
 
3891
      <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
 
3892
      <entry>indexes</entry>
 
3893
     </row>
 
3894
 
 
3895
     <row>
 
3896
      <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
 
3897
      <entry>currently held locks</entry>
 
3898
     </row>
 
3899
 
 
3900
     <row>
 
3901
      <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
 
3902
      <entry>rules</entry>
 
3903
     </row>
 
3904
 
 
3905
     <row>
 
3906
      <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
 
3907
      <entry>parameter settings</entry>
 
3908
     </row>
 
3909
 
 
3910
     <row>
 
3911
      <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
 
3912
      <entry>planner statistics</entry>
 
3913
     </row>
 
3914
 
 
3915
     <row>
 
3916
      <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
 
3917
      <entry>tables</entry>
 
3918
     </row>
 
3919
 
 
3920
     <row>
 
3921
      <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
 
3922
      <entry>database users</entry>
 
3923
     </row>
 
3924
 
 
3925
     <row>
 
3926
      <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
 
3927
      <entry>views</entry>
 
3928
     </row>
 
3929
 
 
3930
    </tbody>
 
3931
   </tgroup>
 
3932
  </table>
 
3933
 </sect1>
 
3934
 
 
3935
 <sect1 id="view-pg-indexes">
 
3936
  <title><structname>pg_indexes</structname></title>
 
3937
 
 
3938
  <indexterm zone="view-pg-indexes">
 
3939
   <primary>pg_indexes</primary>
 
3940
  </indexterm>
 
3941
 
 
3942
  <para>
 
3943
   The view <structname>pg_indexes</structname> provides access to
 
3944
   useful information about each index in the database.
 
3945
  </para>
 
3946
 
 
3947
  <table>
 
3948
   <title><structname>pg_indexes</> Columns</title>
 
3949
 
 
3950
   <tgroup cols=4>
 
3951
    <thead>
 
3952
     <row>
 
3953
      <entry>Name</entry>
 
3954
      <entry>Type</entry>
 
3955
      <entry>References</entry>
 
3956
      <entry>Description</entry>
 
3957
     </row>
 
3958
    </thead>
 
3959
    <tbody>
 
3960
     <row>
 
3961
      <entry><structfield>schemaname</structfield></entry>
 
3962
      <entry><type>name</type></entry>
 
3963
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
 
3964
      <entry>name of schema containing table and index</entry>
 
3965
     </row>
 
3966
     <row>
 
3967
      <entry><structfield>tablename</structfield></entry>
 
3968
      <entry><type>name</type></entry>
 
3969
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
 
3970
      <entry>name of table the index is for</entry>
 
3971
     </row>
 
3972
     <row>
 
3973
      <entry><structfield>indexname</structfield></entry>
 
3974
      <entry><type>name</type></entry>
 
3975
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
 
3976
      <entry>name of index</entry>
 
3977
     </row>
 
3978
     <row>
 
3979
      <entry><structfield>tablespace</structfield></entry>
 
3980
      <entry><type>name</type></entry>
 
3981
      <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
 
3982
      <entry>name of tablespace containing index (NULL if default for database)</entry>
 
3983
     </row>
 
3984
     <row>
 
3985
      <entry><structfield>indexdef</structfield></entry>
 
3986
      <entry><type>text</type></entry>
 
3987
      <entry></entry>
 
3988
      <entry>index definition (a reconstructed creation command)</entry>
 
3989
     </row>
 
3990
    </tbody>
 
3991
   </tgroup>
 
3992
  </table>
 
3993
 
 
3994
 </sect1>
 
3995
 
 
3996
 <sect1 id="view-pg-locks">
 
3997
  <title><structname>pg_locks</structname></title>
 
3998
 
 
3999
  <indexterm zone="view-pg-locks">
 
4000
   <primary>pg_locks</primary>
 
4001
  </indexterm>
 
4002
 
 
4003
  <para>
 
4004
   The view <structname>pg_locks</structname> provides access to
 
4005
   information about the locks held by open transactions within the
 
4006
   database server.  See <xref linkend="mvcc"> for more discussion
 
4007
   of locking.
 
4008
  </para>
 
4009
 
 
4010
  <para>
 
4011
   <structname>pg_locks</structname> contains one row per active lockable
 
4012
   object, requested lock mode, and relevant transaction.  Thus, the same
 
4013
   lockable object may
 
4014
   appear many times, if multiple transactions are holding or waiting
 
4015
   for locks on it.  However, an object that currently has no locks on it
 
4016
   will not appear at all.  A lockable object is either a relation (e.g., a
 
4017
   table) or a transaction ID.
 
4018
  </para>
 
4019
 
 
4020
  <para>
 
4021
   Note that this view includes only table-level
 
4022
   locks, not row-level ones.  If a transaction is waiting for a
 
4023
   row-level lock, it will appear in the view as waiting for the
 
4024
   transaction ID of the current holder of that row lock.
 
4025
  </para>
 
4026
 
 
4027
  <table>
 
4028
   <title><structname>pg_locks</> Columns</title>
 
4029
 
 
4030
   <tgroup cols=4>
 
4031
    <thead>
 
4032
     <row>
 
4033
      <entry>Name</entry>
 
4034
      <entry>Type</entry>
 
4035
      <entry>References</entry>
 
4036
      <entry>Description</entry>
 
4037
     </row>
 
4038
    </thead>
 
4039
    <tbody>
 
4040
     <row>
 
4041
      <entry><structfield>relation</structfield></entry>
 
4042
      <entry><type>oid</type></entry>
 
4043
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
 
4044
      <entry>
 
4045
       OID of the locked relation, or NULL if the lockable object
 
4046
       is a transaction ID
 
4047
      </entry>
 
4048
     </row>
 
4049
     <row>
 
4050
      <entry><structfield>database</structfield></entry>
 
4051
      <entry><type>oid</type></entry>
 
4052
      <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
 
4053
      <entry>
 
4054
       OID of the database in which the locked relation exists, or
 
4055
       zero if the locked relation is a globally-shared table, or
 
4056
       NULL if the lockable object is a transaction ID
 
4057
      </entry>
 
4058
     </row>
 
4059
     <row>
 
4060
      <entry><structfield>transaction</structfield></entry>
 
4061
      <entry><type>xid</type></entry>
 
4062
      <entry></entry>
 
4063
      <entry>
 
4064
       ID of a transaction, or NULL if the lockable object is a relation
 
4065
      </entry>
 
4066
     </row>
 
4067
     <row>
 
4068
      <entry><structfield>pid</structfield></entry>
 
4069
      <entry><type>integer</type></entry>
 
4070
      <entry></entry>
 
4071
      <entry>process ID of a server process holding or awaiting this
 
4072
      lock</entry>
 
4073
     </row>
 
4074
     <row>
 
4075
      <entry><structfield>mode</structfield></entry>
 
4076
      <entry><type>text</type></entry>
 
4077
      <entry></entry>
 
4078
      <entry>name of the lock mode held or desired by this process (see <xref
 
4079
      linkend="locking-tables">)</entry>
 
4080
     </row>
 
4081
     <row>
 
4082
      <entry><structfield>granted</structfield></entry>
 
4083
      <entry><type>boolean</type></entry>
 
4084
      <entry></entry>
 
4085
      <entry>true if lock is held, false if lock is awaited</entry>
 
4086
     </row>
 
4087
    </tbody>
 
4088
   </tgroup>
 
4089
  </table>
 
4090
 
 
4091
  <para>
 
4092
   <structfield>granted</structfield> is true in a row representing a lock
 
4093
   held by the indicated session.  False indicates that this session is
 
4094
   currently waiting to acquire this lock, which implies that some other
 
4095
   session is holding a conflicting lock mode on the same lockable object.
 
4096
   The waiting session will sleep until the other lock is released (or a
 
4097
   deadlock situation is detected). A single session can be waiting to acquire
 
4098
   at most one lock at a time.
 
4099
  </para>
 
4100
 
 
4101
  <para>
 
4102
   Every transaction holds an exclusive lock on its transaction ID for its
 
4103
   entire duration. If one transaction finds it necessary to wait specifically
 
4104
   for another transaction, it does so by attempting to acquire share lock on
 
4105
   the other transaction ID. That will succeed only when the other transaction
 
4106
   terminates and releases its locks. 
 
4107
  </para>
 
4108
 
 
4109
  <para>
 
4110
   When the <structname>pg_locks</structname> view is accessed, the
 
4111
   internal lock manager data structures are momentarily locked, and
 
4112
   a copy is made for the view to display.  This ensures that the
 
4113
   view produces a consistent set of results, while not blocking
 
4114
   normal lock manager operations longer than necessary.  Nonetheless
 
4115
   there could be some impact on database performance if this view is
 
4116
   read often.
 
4117
  </para>
 
4118
 
 
4119
  <para>
 
4120
   <structname>pg_locks</structname> provides a global view of all locks
 
4121
   in the database cluster, not only those relevant to the current database.
 
4122
   Although its <structfield>relation</structfield> column can be joined
 
4123
   against <structname>pg_class</>.<structfield>oid</> to identify locked
 
4124
   relations, this will only work correctly for relations in the current
 
4125
   database (those for which the <structfield>database</structfield> column
 
4126
   is either the current database's OID or zero).
 
4127
  </para>
 
4128
 
 
4129
  <para>
 
4130
   If you have enabled the statistics collector, the
 
4131
   <structfield>pid</structfield> column can be joined to the
 
4132
   <structfield>procpid</structfield> column of the
 
4133
   <structname>pg_stat_activity</structname> view to get more
 
4134
   information on the session holding or waiting to hold the lock.
 
4135
  </para>
 
4136
 
 
4137
 </sect1>
 
4138
 
 
4139
 <sect1 id="view-pg-rules">
 
4140
  <title><structname>pg_rules</structname></title>
 
4141
 
 
4142
  <indexterm zone="view-pg-rules">
 
4143
   <primary>pg_rules</primary>
 
4144
  </indexterm>
 
4145
 
 
4146
  <para>
 
4147
   The view <structname>pg_rules</structname> provides access to
 
4148
   useful information about query rewrite rules.
 
4149
  </para>
 
4150
 
 
4151
  <table>
 
4152
   <title><structname>pg_rules</> Columns</title>
 
4153
 
 
4154
   <tgroup cols=4>
 
4155
    <thead>
 
4156
     <row>
 
4157
      <entry>Name</entry>
 
4158
      <entry>Type</entry>
 
4159
      <entry>References</entry>
 
4160
      <entry>Description</entry>
 
4161
     </row>
 
4162
    </thead>
 
4163
    <tbody>
 
4164
     <row>
 
4165
      <entry><structfield>schemaname</structfield></entry>
 
4166
      <entry><type>name</type></entry>
 
4167
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
 
4168
      <entry>name of schema containing table</entry>
 
4169
     </row>
 
4170
     <row>
 
4171
      <entry><structfield>tablename</structfield></entry>
 
4172
      <entry><type>name</type></entry>
 
4173
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
 
4174
      <entry>name of table the rule is for</entry>
 
4175
     </row>
 
4176
     <row>
 
4177
      <entry><structfield>rulename</structfield></entry>
 
4178
      <entry><type>name</type></entry>
 
4179
      <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
 
4180
      <entry>name of rule</entry>
 
4181
     </row>
 
4182
     <row>
 
4183
      <entry><structfield>definition</structfield></entry>
 
4184
      <entry><type>text</type></entry>
 
4185
      <entry></entry>
 
4186
      <entry>rule definition (a reconstructed creation command)</entry>
 
4187
     </row>
 
4188
    </tbody>
 
4189
   </tgroup>
 
4190
  </table>
 
4191
 
 
4192
  <para>
 
4193
   The <structname>pg_rules</structname> view excludes the ON SELECT rules of
 
4194
   views; those can be seen in <structname>pg_views</structname>.
 
4195
  </para>
 
4196
 
 
4197
 </sect1>
 
4198
 
 
4199
 <sect1 id="view-pg-settings">
 
4200
  <title><structname>pg_settings</structname></title>
 
4201
 
 
4202
  <indexterm zone="view-pg-settings">
 
4203
   <primary>pg_settings</primary>
 
4204
  </indexterm>
 
4205
 
 
4206
  <para>
 
4207
   The view <structname>pg_settings</structname> provides access to
 
4208
   run-time parameters of the server.  It is essentially an alternative
 
4209
   interface to the <command>SHOW</> and <command>SET</> commands.
 
4210
   It also provides access to some facts about each parameter that are
 
4211
   not directly available from <command>SHOW</>, such as minimum and
 
4212
   maximum values.
 
4213
  </para>
 
4214
 
 
4215
  <table>
 
4216
   <title><structname>pg_settings</> Columns</title>
 
4217
 
 
4218
   <tgroup cols=4>
 
4219
    <thead>
 
4220
     <row>
 
4221
      <entry>Name</entry>
 
4222
      <entry>Type</entry>
 
4223
      <entry>References</entry>
 
4224
      <entry>Description</entry>
 
4225
     </row>
 
4226
    </thead>
 
4227
    <tbody>
 
4228
     <row>
 
4229
      <entry><structfield>name</structfield></entry>
 
4230
      <entry><type>text</type></entry>
 
4231
      <entry></entry>
 
4232
      <entry>run-time configuration parameter name</entry>
 
4233
     </row>
 
4234
     <row>
 
4235
      <entry><structfield>setting</structfield></entry>
 
4236
      <entry><type>text</type></entry>
 
4237
      <entry></entry>
 
4238
      <entry>current value of the parameter</entry>
 
4239
     </row>
 
4240
     <row>
 
4241
      <entry><structfield>category</structfield></entry>
 
4242
      <entry><type>text</type></entry>
 
4243
      <entry></entry>
 
4244
      <entry>logical group of the parameter</entry>
 
4245
     </row>
 
4246
     <row>
 
4247
      <entry><structfield>short_desc</structfield></entry>
 
4248
      <entry><type>text</type></entry>
 
4249
      <entry></entry>
 
4250
      <entry>a brief description of the parameter</entry>
 
4251
     </row>
 
4252
     <row>
 
4253
      <entry><structfield>extra_desc</structfield></entry>
 
4254
      <entry><type>text</type></entry>
 
4255
      <entry></entry>
 
4256
      <entry>additional, more detailed, information about the parameter</entry>
 
4257
     </row>
 
4258
     <row>
 
4259
      <entry><structfield>context</structfield></entry>
 
4260
      <entry><type>text</type></entry>
 
4261
      <entry></entry>
 
4262
      <entry>context required to set the parameter's value</entry>
 
4263
     </row>
 
4264
     <row>
 
4265
      <entry><structfield>vartype</structfield></entry>
 
4266
      <entry><type>text</type></entry>
 
4267
      <entry></entry>
 
4268
      <entry>parameter type (<literal>bool</>, <literal>integer</>,
 
4269
       <literal>real</>, or <literal>string</>)
 
4270
      </entry>
 
4271
     </row>
 
4272
     <row>
 
4273
      <entry><structfield>source</structfield></entry>
 
4274
      <entry><type>text</type></entry>
 
4275
      <entry></entry>
 
4276
      <entry>source of the current parameter value</entry>
 
4277
     </row>
 
4278
     <row>
 
4279
      <entry><structfield>min_val</structfield></entry>
 
4280
      <entry><type>text</type></entry>
 
4281
      <entry></entry>
 
4282
      <entry>minimum allowed value of the parameter (NULL for nonnumeric
 
4283
      values)</entry>
 
4284
     </row>
 
4285
     <row>
 
4286
      <entry><structfield>max_val</structfield></entry>
 
4287
      <entry><type>text</type></entry>
 
4288
      <entry></entry>
 
4289
      <entry>maximum allowed value of the parameter (NULL for nonnumeric
 
4290
      values)</entry>
 
4291
     </row>
 
4292
    </tbody>
 
4293
   </tgroup>
 
4294
  </table>
 
4295
  
 
4296
  <para>
 
4297
   The <structname>pg_settings</structname> view cannot be inserted into or
 
4298
   deleted from, but it can be updated.  An <command>UPDATE</command> applied
 
4299
   to a row of <structname>pg_settings</structname> is equivalent to executing
 
4300
   the <xref linkend="SQL-SET" endterm="SQL-SET-title"> command on that named
 
4301
   parameter. The change only affects the value used by the current
 
4302
   session. If an <command>UPDATE</command> is issued within a transaction
 
4303
   that is later aborted, the effects of the <command>UPDATE</command> command
 
4304
   disappear when the transaction is rolled back. Once the surrounding
 
4305
   transaction is committed, the effects will persist until the end of the
 
4306
   session, unless overridden by another <command>UPDATE</command> or
 
4307
   <command>SET</command>.
 
4308
  </para>
 
4309
 
 
4310
 </sect1>
 
4311
 
 
4312
 <sect1 id="view-pg-stats">
 
4313
  <title><structname>pg_stats</structname></title>
 
4314
 
 
4315
  <indexterm zone="view-pg-stats">
 
4316
   <primary>pg_stats</primary>
 
4317
  </indexterm>
 
4318
 
 
4319
  <para>
 
4320
   The view <structname>pg_stats</structname> provides access to
 
4321
   the information stored in the <link
 
4322
   linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
 
4323
   catalog.  This view allows access only to rows of
 
4324
   <structname>pg_statistic</structname> that correspond to tables the
 
4325
   user has permission to read, and therefore it is safe to allow public
 
4326
   read access to this view.
 
4327
  </para>
 
4328
 
 
4329
  <para>
 
4330
   <structname>pg_stats</structname> is also designed to present the
 
4331
   information in a more readable format than the underlying catalog
 
4332
   &mdash; at the cost that its schema must be extended whenever new slot types
 
4333
   are defined for <structname>pg_statistic</structname>.
 
4334
  </para>
 
4335
 
 
4336
  <table>
 
4337
   <title><structname>pg_stats</> Columns</title>
 
4338
 
 
4339
   <tgroup cols=4>
 
4340
    <thead>
 
4341
     <row>
 
4342
      <entry>Name</entry>
 
4343
      <entry>Type</entry>
 
4344
      <entry>References</entry>
 
4345
      <entry>Description</entry>
 
4346
     </row>
 
4347
    </thead>
 
4348
    <tbody>
 
4349
     <row>
 
4350
      <entry><structfield>schemaname</structfield></entry>
 
4351
      <entry><type>name</type></entry>
 
4352
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
 
4353
      <entry>name of schema containing table</entry>
 
4354
     </row>
 
4355
 
 
4356
     <row>
 
4357
      <entry><structfield>tablename</structfield></entry>
 
4358
      <entry><type>name</type></entry>
 
4359
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
 
4360
      <entry>name of table</entry>
 
4361
     </row>
 
4362
 
 
4363
     <row>
 
4364
      <entry><structfield>attname</structfield></entry>
 
4365
      <entry><type>name</type></entry>
 
4366
      <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
 
4367
      <entry>name of the column described by this row</entry>
 
4368
     </row>
 
4369
 
 
4370
     <row>
 
4371
      <entry><structfield>null_frac</structfield></entry>
 
4372
      <entry><type>real</type></entry>
 
4373
      <entry></entry>
 
4374
      <entry>fraction of column entries that are null</entry>
 
4375
     </row>
 
4376
 
 
4377
     <row>
 
4378
      <entry><structfield>avg_width</structfield></entry>
 
4379
      <entry><type>integer</type></entry>
 
4380
      <entry></entry>
 
4381
      <entry>average width in bytes of column's entries</entry>
 
4382
     </row>
 
4383
 
 
4384
     <row>
 
4385
      <entry><structfield>n_distinct</structfield></entry>
 
4386
      <entry><type>real</type></entry>
 
4387
      <entry></entry>
 
4388
      <entry>If greater than zero, the estimated number of distinct values
 
4389
      in the column.  If less than zero, the negative of the number of
 
4390
      distinct values divided by the number of rows.  (The negated form
 
4391
      is used when <command>ANALYZE</> believes that the number of distinct
 
4392
      values
 
4393
      is likely to increase as the table grows; the positive form is used
 
4394
      when the column seems to have a fixed number of possible values.)
 
4395
      For example, -1 indicates a unique column in which the number of
 
4396
      distinct values is the same as the number of rows.
 
4397
      </entry>
 
4398
     </row>
 
4399
 
 
4400
     <row>
 
4401
      <entry><structfield>most_common_vals</structfield></entry>
 
4402
      <entry><type>anyarray</type></entry>
 
4403
      <entry></entry>
 
4404
      <entry>A list of the most common values in the column. (NULL if
 
4405
      no values seem to be more common than any others.)</entry>
 
4406
     </row>
 
4407
 
 
4408
     <row>
 
4409
      <entry><structfield>most_common_freqs</structfield></entry>
 
4410
      <entry><type>real[]</type></entry>
 
4411
      <entry></entry>
 
4412
      <entry>A list of the frequencies of the most common values,
 
4413
      i.e., number of occurrences of each divided by total number of rows.
 
4414
      (NULL when <structfield>most_common_vals</structfield> is.)
 
4415
     </entry>
 
4416
     </row>
 
4417
 
 
4418
     <row>
 
4419
      <entry><structfield>histogram_bounds</structfield></entry>
 
4420
      <entry><type>anyarray</type></entry>
 
4421
      <entry></entry>
 
4422
      <entry>A list of values that divide the column's values into
 
4423
      groups of approximately equal population.  The values in
 
4424
      <structfield>most_common_vals</>, if present, are omitted from this
 
4425
      histogram calculation.  (This column is NULL if the column data type
 
4426
      does not have a <literal>&lt;</> operator or if the
 
4427
      <structfield>most_common_vals</> list accounts for the entire
 
4428
      population.)
 
4429
      </entry>
 
4430
     </row>
 
4431
 
 
4432
     <row>
 
4433
      <entry><structfield>correlation</structfield></entry>
 
4434
      <entry><type>real</type></entry>
 
4435
      <entry></entry>
 
4436
      <entry>Statistical correlation between physical row ordering and
 
4437
      logical ordering of the column values.  This ranges from -1 to +1.
 
4438
      When the value is near -1 or +1, an index scan on the column will
 
4439
      be estimated to be cheaper than when it is near zero, due to reduction
 
4440
      of random access to the disk.  (This column is NULL if the column data
 
4441
      type does not have a <literal>&lt;</> operator.)
 
4442
      </entry>
 
4443
     </row>
 
4444
    </tbody>
 
4445
   </tgroup>
 
4446
  </table>
 
4447
 
 
4448
  <para>
 
4449
   The maximum number of entries in the <structfield>most_common_vals</>
 
4450
   and <structfield>histogram_bounds</> arrays can be set on a
 
4451
   column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
 
4452
   command, or globally by setting the
 
4453
   <xref linkend="guc-default-statistics-target"> runtime parameter.
 
4454
  </para>
 
4455
 
 
4456
 </sect1>
 
4457
 
 
4458
 <sect1 id="view-pg-tables">
 
4459
  <title><structname>pg_tables</structname></title>
 
4460
 
 
4461
  <indexterm zone="view-pg-tables">
 
4462
   <primary>pg_tables</primary>
 
4463
  </indexterm>
 
4464
 
 
4465
  <para>
 
4466
   The view <structname>pg_tables</structname> provides access to
 
4467
   useful information about each table in the database.
 
4468
  </para>
 
4469
 
 
4470
  <table>
 
4471
   <title><structname>pg_tables</> Columns</title>
 
4472
 
 
4473
   <tgroup cols=4>
 
4474
    <thead>
 
4475
     <row>
 
4476
      <entry>Name</entry>
 
4477
      <entry>Type</entry>
 
4478
      <entry>References</entry>
 
4479
      <entry>Description</entry>
 
4480
     </row>
 
4481
    </thead>
 
4482
    <tbody>
 
4483
     <row>
 
4484
      <entry><structfield>schemaname</structfield></entry>
 
4485
      <entry><type>name</type></entry>
 
4486
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
 
4487
      <entry>name of schema containing table</entry>
 
4488
     </row>
 
4489
     <row>
 
4490
      <entry><structfield>tablename</structfield></entry>
 
4491
      <entry><type>name</type></entry>
 
4492
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
 
4493
      <entry>name of table</entry>
 
4494
     </row>
 
4495
     <row>
 
4496
      <entry><structfield>tableowner</structfield></entry>
 
4497
      <entry><type>name</type></entry>
 
4498
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usename</literal></entry>
 
4499
      <entry>name of table's owner</entry>
 
4500
     </row>
 
4501
     <row>
 
4502
      <entry><structfield>tablespace</structfield></entry>
 
4503
      <entry><type>name</type></entry>
 
4504
      <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
 
4505
      <entry>name of tablespace containing table (NULL if default for database)</entry>
 
4506
     </row>
 
4507
     <row>
 
4508
      <entry><structfield>hasindexes</structfield></entry>
 
4509
      <entry><type>boolean</type></entry>
 
4510
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
 
4511
      <entry>true if table has (or recently had) any indexes</entry>
 
4512
     </row>
 
4513
     <row>
 
4514
      <entry><structfield>hasrules</structfield></entry>
 
4515
      <entry><type>boolean</type></entry>
 
4516
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
 
4517
      <entry>true if table has rules</entry>
 
4518
     </row>
 
4519
     <row>
 
4520
      <entry><structfield>hastriggers</structfield></entry>
 
4521
      <entry><type>boolean</type></entry>
 
4522
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.reltriggers</literal></entry>
 
4523
      <entry>true if table has triggers</entry>
 
4524
     </row>
 
4525
    </tbody>
 
4526
   </tgroup>
 
4527
  </table>
 
4528
 
 
4529
 </sect1>
 
4530
 
 
4531
 <sect1 id="view-pg-user">
 
4532
  <title><structname>pg_user</structname></title>
 
4533
 
 
4534
  <indexterm zone="view-pg-user">
 
4535
   <primary>pg_user</primary>
 
4536
  </indexterm>
 
4537
 
 
4538
  <para>
 
4539
   The view <structname>pg_user</structname> provides access to
 
4540
   information about database users.  This is simply a publicly
 
4541
   readable view of 
 
4542
   <link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>
 
4543
   that blanks out the password field.
 
4544
  </para>
 
4545
 
 
4546
  <table>
 
4547
   <title><structname>pg_user</> Columns</title>
 
4548
 
 
4549
   <tgroup cols=4>
 
4550
    <thead>
 
4551
     <row>
 
4552
      <entry>Name</entry>
 
4553
      <entry>Type</entry>
 
4554
      <entry>References</entry>
 
4555
      <entry>Description</entry>
 
4556
     </row>
 
4557
    </thead>
 
4558
    <tbody>
 
4559
     <row>
 
4560
      <entry><structfield>usename</structfield></entry>
 
4561
      <entry><type>name</type></entry>
 
4562
      <entry></entry>
 
4563
      <entry>User name</entry>
 
4564
     </row>
 
4565
 
 
4566
     <row>
 
4567
      <entry><structfield>usesysid</structfield></entry>
 
4568
      <entry><type>int4</type></entry>
 
4569
      <entry></entry>
 
4570
      <entry>User ID (arbitrary number used to reference this user)</entry>
 
4571
     </row>
 
4572
 
 
4573
     <row>
 
4574
      <entry><structfield>usecreatedb</structfield></entry>
 
4575
      <entry><type>bool</type></entry>
 
4576
      <entry></entry>
 
4577
      <entry>User may create databases</entry>
 
4578
     </row>
 
4579
 
 
4580
     <row>
 
4581
      <entry><structfield>usesuper</structfield></entry>
 
4582
      <entry><type>bool</type></entry>
 
4583
      <entry></entry>
 
4584
      <entry>User is a superuser</entry>
 
4585
     </row>
 
4586
 
 
4587
     <row>
 
4588
      <entry><structfield>usecatupd</structfield></entry>
 
4589
      <entry><type>bool</type></entry>
 
4590
      <entry></entry>
 
4591
      <entry>
 
4592
       User may update system catalogs.  (Even a superuser may not do
 
4593
       this unless this column is true.)
 
4594
      </entry>
 
4595
     </row>
 
4596
 
 
4597
     <row>
 
4598
      <entry><structfield>passwd</structfield></entry>
 
4599
      <entry><type>text</type></entry>
 
4600
      <entry></entry>
 
4601
      <entry>Not the password (always reads as <literal>********</>)</entry>
 
4602
     </row>
 
4603
 
 
4604
     <row>
 
4605
      <entry><structfield>valuntil</structfield></entry>
 
4606
      <entry><type>abstime</type></entry>
 
4607
      <entry></entry>
 
4608
      <entry>Password expiry time (only used for password authentication)</entry>
 
4609
     </row>
 
4610
 
 
4611
     <row>
 
4612
      <entry><structfield>useconfig</structfield></entry>
 
4613
      <entry><type>text[]</type></entry>
 
4614
      <entry></entry>
 
4615
      <entry>Session defaults for run-time configuration variables</entry>
 
4616
     </row>
 
4617
    </tbody>
 
4618
   </tgroup>
 
4619
  </table>
 
4620
 
 
4621
 </sect1>
 
4622
 
 
4623
 <sect1 id="view-pg-views">
 
4624
  <title><structname>pg_views</structname></title>
 
4625
 
 
4626
  <indexterm zone="view-pg-views">
 
4627
   <primary>pg_views</primary>
 
4628
  </indexterm>
 
4629
 
 
4630
  <para>
 
4631
   The view <structname>pg_views</structname> provides access to
 
4632
   useful information about each view in the database.
 
4633
  </para>
 
4634
 
 
4635
  <table>
 
4636
   <title><structname>pg_views</> Columns</title>
 
4637
 
 
4638
   <tgroup cols=4>
 
4639
    <thead>
 
4640
     <row>
 
4641
      <entry>Name</entry>
 
4642
      <entry>Type</entry>
 
4643
      <entry>References</entry>
 
4644
      <entry>Description</entry>
 
4645
     </row>
 
4646
    </thead>
 
4647
    <tbody>
 
4648
     <row>
 
4649
      <entry><structfield>schemaname</structfield></entry>
 
4650
      <entry><type>name</type></entry>
 
4651
      <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
 
4652
      <entry>name of schema containing view</entry>
 
4653
     </row>
 
4654
     <row>
 
4655
      <entry><structfield>viewname</structfield></entry>
 
4656
      <entry><type>name</type></entry>
 
4657
      <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
 
4658
      <entry>name of view</entry>
 
4659
     </row>
 
4660
     <row>
 
4661
      <entry><structfield>viewowner</structfield></entry>
 
4662
      <entry><type>name</type></entry>
 
4663
      <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usename</literal></entry>
 
4664
      <entry>name of view's owner</entry>
 
4665
     </row>
 
4666
     <row>
 
4667
      <entry><structfield>definition</structfield></entry>
 
4668
      <entry><type>text</type></entry>
 
4669
      <entry></entry>
 
4670
      <entry>view definition (a reconstructed SELECT query)</entry>
 
4671
     </row>
 
4672
    </tbody>
 
4673
   </tgroup>
 
4674
  </table>
 
4675
 
 
4676
 </sect1>
 
4677
 
 
4678
</chapter>
 
4679
 
 
4680
<!-- Keep this comment at the end of the file
 
4681
Local variables:
 
4682
mode:sgml
 
4683
sgml-omittag:nil
 
4684
sgml-shorttag:t
 
4685
sgml-minimize-attributes:nil
 
4686
sgml-always-quote-attributes:t
 
4687
sgml-indent-step:1
 
4688
sgml-indent-tabs-mode:nil
 
4689
sgml-indent-data:t
 
4690
sgml-parent-document:nil
 
4691
sgml-default-dtd-file:"./reference.ced"
 
4692
sgml-exposed-tags:nil
 
4693
sgml-local-catalogs:("/usr/share/sgml/catalog")
 
4694
sgml-local-ecat-files:nil
 
4695
End:
 
4696
-->