Make LC_COLLATE and LC_CTYPE database-level settings. Collation and
[PostgreSQL.git] / doc / src / sgml / catalogs.sgml
blob5e1347f1661eeb1043e2c1a983431f585b3264e4
1 <!-- $PostgreSQL$ -->
2 <!--
3 Documentation of the system catalogs, directed toward PostgreSQL developers
4 -->
6 <chapter id="catalogs">
7 <title>System Catalogs</title>
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>
24 <sect1 id="catalogs-overview">
25 <title>Overview</title>
27 <para>
28 <xref linkend="catalog-table"> lists the system catalogs.
29 More detailed documentation of each catalog follows below.
30 </para>
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>
39 <table id="catalog-table">
40 <title>System Catalogs</title>
42 <tgroup cols="2">
43 <thead>
44 <row>
45 <entry>Catalog Name</entry>
46 <entry>Purpose</entry>
47 </row>
48 </thead>
50 <tbody>
51 <row>
52 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
53 <entry>aggregate functions</entry>
54 </row>
56 <row>
57 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
58 <entry>index access methods</entry>
59 </row>
61 <row>
62 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
63 <entry>access method operators</entry>
64 </row>
66 <row>
67 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
68 <entry>access method support procedures</entry>
69 </row>
71 <row>
72 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
73 <entry>column default values</entry>
74 </row>
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>
81 <row>
82 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
83 <entry>authorization identifiers (roles)</entry>
84 </row>
86 <row>
87 <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
88 <entry>authorization identifier membership relationships</entry>
89 </row>
91 <row>
92 <entry><link linkend="catalog-pg-autovacuum"><structname>pg_autovacuum</structname></link></entry>
93 <entry>per-relation autovacuum configuration parameters</entry>
94 </row>
96 <row>
97 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
98 <entry>casts (data type conversions)</entry>
99 </row>
101 <row>
102 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
103 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
104 </row>
106 <row>
107 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
108 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
109 </row>
111 <row>
112 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
113 <entry>encoding conversion information</entry>
114 </row>
116 <row>
117 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
118 <entry>databases within this database cluster</entry>
119 </row>
121 <row>
122 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
123 <entry>dependencies between database objects</entry>
124 </row>
126 <row>
127 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
128 <entry>descriptions or comments on database objects</entry>
129 </row>
131 <row>
132 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
133 <entry>enum label and value definitions</entry>
134 </row>
136 <row>
137 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
138 <entry>additional index information</entry>
139 </row>
141 <row>
142 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
143 <entry>table inheritance hierarchy</entry>
144 </row>
146 <row>
147 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
148 <entry>languages for writing functions</entry>
149 </row>
151 <row>
152 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
153 <entry>large objects</entry>
154 </row>
156 <row>
157 <entry><link linkend="catalog-pg-listener"><structname>pg_listener</structname></link></entry>
158 <entry>asynchronous notification support</entry>
159 </row>
161 <row>
162 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
163 <entry>schemas</entry>
164 </row>
166 <row>
167 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
168 <entry>access method operator classes</entry>
169 </row>
171 <row>
172 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
173 <entry>operators</entry>
174 </row>
176 <row>
177 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
178 <entry>access method operator families</entry>
179 </row>
181 <row>
182 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
183 <entry>template data for procedural languages</entry>
184 </row>
186 <row>
187 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
188 <entry>functions and procedures</entry>
189 </row>
191 <row>
192 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
193 <entry>query rewrite rules</entry>
194 </row>
196 <row>
197 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
198 <entry>dependencies on shared objects</entry>
199 </row>
201 <row>
202 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
203 <entry>comments on shared objects</entry>
204 </row>
206 <row>
207 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
208 <entry>planner statistics</entry>
209 </row>
211 <row>
212 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
213 <entry>tablespaces within this database cluster</entry>
214 </row>
216 <row>
217 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
218 <entry>triggers</entry>
219 </row>
221 <row>
222 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
223 <entry>text search configurations</entry>
224 </row>
226 <row>
227 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
228 <entry>text search configurations' token mappings</entry>
229 </row>
231 <row>
232 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
233 <entry>text search dictionaries</entry>
234 </row>
236 <row>
237 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
238 <entry>text search parsers</entry>
239 </row>
241 <row>
242 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
243 <entry>text search templates</entry>
244 </row>
246 <row>
247 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
248 <entry>data types</entry>
249 </row>
250 </tbody>
251 </tgroup>
252 </table>
253 </sect1>
256 <sect1 id="catalog-pg-aggregate">
257 <title><structname>pg_aggregate</structname></title>
259 <indexterm zone="catalog-pg-aggregate">
260 <primary>pg_aggregate</primary>
261 </indexterm>
263 <para>
264 The catalog <structname>pg_aggregate</structname> stores information about
265 aggregate functions. An aggregate function is a function that
266 operates on a set of values (typically one column from each row
267 that matches a query condition) and returns a single value computed
268 from all these values. Typical aggregate functions are
269 <function>sum</function>, <function>count</function>, and
270 <function>max</function>. Each entry in
271 <structname>pg_aggregate</structname> is an extension of an entry
272 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
273 entry carries the aggregate's name, input and output data types, and
274 other information that is similar to ordinary functions.
275 </para>
277 <table>
278 <title><structname>pg_aggregate</> Columns</title>
280 <tgroup cols=4>
281 <thead>
282 <row>
283 <entry>Name</entry>
284 <entry>Type</entry>
285 <entry>References</entry>
286 <entry>Description</entry>
287 </row>
288 </thead>
289 <tbody>
290 <row>
291 <entry><structfield>aggfnoid</structfield></entry>
292 <entry><type>regproc</type></entry>
293 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
294 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
295 </row>
296 <row>
297 <entry><structfield>aggtransfn</structfield></entry>
298 <entry><type>regproc</type></entry>
299 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
300 <entry>Transition function</entry>
301 </row>
302 <row>
303 <entry><structfield>aggfinalfn</structfield></entry>
304 <entry><type>regproc</type></entry>
305 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
306 <entry>Final function (zero if none)</entry>
307 </row>
308 <row>
309 <entry><structfield>aggsortop</structfield></entry>
310 <entry><type>oid</type></entry>
311 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
312 <entry>Associated sort operator (zero if none)</entry>
313 </row>
314 <row>
315 <entry><structfield>aggtranstype</structfield></entry>
316 <entry><type>oid</type></entry>
317 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
318 <entry>Data type of the aggregate function's internal transition (state) data</entry>
319 </row>
320 <row>
321 <entry><structfield>agginitval</structfield></entry>
322 <entry><type>text</type></entry>
323 <entry></entry>
324 <entry>
325 The initial value of the transition state. This is a text
326 field containing the initial value in its external string
327 representation. If this field is NULL, the transition state
328 value starts out NULL
329 </entry>
330 </row>
331 </tbody>
332 </tgroup>
333 </table>
335 <para>
336 New aggregate functions are registered with the <xref
337 linkend="sql-createaggregate" endterm="sql-createaggregate-title">
338 command. See <xref linkend="xaggr"> for more information about
339 writing aggregate functions and the meaning of the transition
340 functions, etc.
341 </para>
343 </sect1>
346 <sect1 id="catalog-pg-am">
347 <title><structname>pg_am</structname></title>
349 <indexterm zone="catalog-pg-am">
350 <primary>pg_am</primary>
351 </indexterm>
353 <para>
354 The catalog <structname>pg_am</structname> stores information about index
355 access methods. There is one row for each index access method supported by
356 the system. The contents of this catalog are discussed in detail in
357 <xref linkend="indexam">.
358 </para>
360 <table>
361 <title><structname>pg_am</> Columns</title>
363 <tgroup cols=4>
364 <thead>
365 <row>
366 <entry>Name</entry>
367 <entry>Type</entry>
368 <entry>References</entry>
369 <entry>Description</entry>
370 </row>
371 </thead>
372 <tbody>
374 <row>
375 <entry><structfield>amname</structfield></entry>
376 <entry><type>name</type></entry>
377 <entry></entry>
378 <entry>Name of the access method</entry>
379 </row>
381 <row>
382 <entry><structfield>amstrategies</structfield></entry>
383 <entry><type>int2</type></entry>
384 <entry></entry>
385 <entry>Number of operator strategies for this access method,
386 or zero if access method does not have a fixed set of operator
387 strategies</entry>
388 </row>
390 <row>
391 <entry><structfield>amsupport</structfield></entry>
392 <entry><type>int2</type></entry>
393 <entry></entry>
394 <entry>Number of support routines for this access method</entry>
395 </row>
397 <row>
398 <entry><structfield>amcanorder</structfield></entry>
399 <entry><type>bool</type></entry>
400 <entry></entry>
401 <entry>Does the access method support ordered scans?</entry>
402 </row>
404 <row>
405 <entry><structfield>amcanunique</structfield></entry>
406 <entry><type>bool</type></entry>
407 <entry></entry>
408 <entry>Does the access method support unique indexes?</entry>
409 </row>
411 <row>
412 <entry><structfield>amcanmulticol</structfield></entry>
413 <entry><type>bool</type></entry>
414 <entry></entry>
415 <entry>Does the access method support multicolumn indexes?</entry>
416 </row>
418 <row>
419 <entry><structfield>amoptionalkey</structfield></entry>
420 <entry><type>bool</type></entry>
421 <entry></entry>
422 <entry>Does the access method support a scan without any constraint
423 for the first index column?</entry>
424 </row>
426 <row>
427 <entry><structfield>amindexnulls</structfield></entry>
428 <entry><type>bool</type></entry>
429 <entry></entry>
430 <entry>Does the access method support null index entries?</entry>
431 </row>
433 <row>
434 <entry><structfield>amsearchnulls</structfield></entry>
435 <entry><type>bool</type></entry>
436 <entry></entry>
437 <entry>Does the access method support IS NULL searches?</entry>
438 </row>
440 <row>
441 <entry><structfield>amstorage</structfield></entry>
442 <entry><type>bool</type></entry>
443 <entry></entry>
444 <entry>Can index storage data type differ from column data type?</entry>
445 </row>
447 <row>
448 <entry><structfield>amclusterable</structfield></entry>
449 <entry><type>bool</type></entry>
450 <entry></entry>
451 <entry>Can an index of this type be clustered on?</entry>
452 </row>
454 <row>
455 <entry><structfield>amkeytype</structfield></entry>
456 <entry><type>oid</type></entry>
457 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
458 <entry>Type of data stored in index, or zero if not a fixed type</entry>
459 </row>
461 <row>
462 <entry><structfield>aminsert</structfield></entry>
463 <entry><type>regproc</type></entry>
464 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
465 <entry><quote>Insert this tuple</quote> function</entry>
466 </row>
468 <row>
469 <entry><structfield>ambeginscan</structfield></entry>
470 <entry><type>regproc</type></entry>
471 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
472 <entry><quote>Start new scan</quote> function</entry>
473 </row>
475 <row>
476 <entry><structfield>amgettuple</structfield></entry>
477 <entry><type>regproc</type></entry>
478 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
479 <entry><quote>Next valid tuple</quote> function</entry>
480 </row>
482 <row>
483 <entry><structfield>amgetbitmap</structfield></entry>
484 <entry><type>regproc</type></entry>
485 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
486 <entry><quote>Fetch all valid tuples</quote> function</entry>
487 </row>
489 <row>
490 <entry><structfield>amrescan</structfield></entry>
491 <entry><type>regproc</type></entry>
492 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
493 <entry><quote>Restart this scan</quote> function</entry>
494 </row>
496 <row>
497 <entry><structfield>amendscan</structfield></entry>
498 <entry><type>regproc</type></entry>
499 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
500 <entry><quote>End this scan</quote> function</entry>
501 </row>
503 <row>
504 <entry><structfield>ammarkpos</structfield></entry>
505 <entry><type>regproc</type></entry>
506 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
507 <entry><quote>Mark current scan position</quote> function</entry>
508 </row>
510 <row>
511 <entry><structfield>amrestrpos</structfield></entry>
512 <entry><type>regproc</type></entry>
513 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
514 <entry><quote>Restore marked scan position</quote> function</entry>
515 </row>
517 <row>
518 <entry><structfield>ambuild</structfield></entry>
519 <entry><type>regproc</type></entry>
520 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
521 <entry><quote>Build new index</quote> function</entry>
522 </row>
524 <row>
525 <entry><structfield>ambulkdelete</structfield></entry>
526 <entry><type>regproc</type></entry>
527 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
528 <entry>Bulk-delete function</entry>
529 </row>
531 <row>
532 <entry><structfield>amvacuumcleanup</structfield></entry>
533 <entry><type>regproc</type></entry>
534 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
535 <entry>Post-<command>VACUUM</command> cleanup function</entry>
536 </row>
538 <row>
539 <entry><structfield>amcostestimate</structfield></entry>
540 <entry><type>regproc</type></entry>
541 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
542 <entry>Function to estimate cost of an index scan</entry>
543 </row>
545 <row>
546 <entry><structfield>amoptions</structfield></entry>
547 <entry><type>regproc</type></entry>
548 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
549 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
550 </row>
552 </tbody>
553 </tgroup>
554 </table>
556 </sect1>
559 <sect1 id="catalog-pg-amop">
560 <title><structname>pg_amop</structname></title>
562 <indexterm zone="catalog-pg-amop">
563 <primary>pg_amop</primary>
564 </indexterm>
566 <para>
567 The catalog <structname>pg_amop</structname> stores information about
568 operators associated with access method operator families. There is one
569 row for each operator that is a member of an operator family. An operator
570 can appear in more than one family, but cannot appear in more than one
571 position within a family.
572 </para>
574 <table>
575 <title><structname>pg_amop</> Columns</title>
577 <tgroup cols=4>
578 <thead>
579 <row>
580 <entry>Name</entry>
581 <entry>Type</entry>
582 <entry>References</entry>
583 <entry>Description</entry>
584 </row>
585 </thead>
586 <tbody>
588 <row>
589 <entry><structfield>amopfamily</structfield></entry>
590 <entry><type>oid</type></entry>
591 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
592 <entry>The operator family this entry is for</entry>
593 </row>
595 <row>
596 <entry><structfield>amoplefttype</structfield></entry>
597 <entry><type>oid</type></entry>
598 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
599 <entry>Left-hand input data type of operator</entry>
600 </row>
602 <row>
603 <entry><structfield>amoprighttype</structfield></entry>
604 <entry><type>oid</type></entry>
605 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
606 <entry>Right-hand input data type of operator</entry>
607 </row>
609 <row>
610 <entry><structfield>amopstrategy</structfield></entry>
611 <entry><type>int2</type></entry>
612 <entry></entry>
613 <entry>Operator strategy number</entry>
614 </row>
616 <row>
617 <entry><structfield>amopopr</structfield></entry>
618 <entry><type>oid</type></entry>
619 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
620 <entry>OID of the operator</entry>
621 </row>
623 <row>
624 <entry><structfield>amopmethod</structfield></entry>
625 <entry><type>oid</type></entry>
626 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
627 <entry>Index access method operator family is for</entry>
628 </row>
630 </tbody>
631 </tgroup>
632 </table>
634 <para>
635 An entry's <structfield>amopmethod</> must match the
636 <structname>opfmethod</> of its containing operator family (including
637 <structfield>amopmethod</> here is an intentional denormalization of the
638 catalog structure for performance reasons). Also,
639 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
640 the <structfield>oprleft</> and <structfield>oprright</> fields of the
641 referenced <structname>pg_operator</> entry.
642 </para>
644 </sect1>
647 <sect1 id="catalog-pg-amproc">
648 <title><structname>pg_amproc</structname></title>
650 <indexterm zone="catalog-pg-amproc">
651 <primary>pg_amproc</primary>
652 </indexterm>
654 <para>
655 The catalog <structname>pg_amproc</structname> stores information about
656 support procedures associated with access method operator families. There
657 is one row for each support procedure belonging to an operator family.
658 </para>
660 <table>
661 <title><structname>pg_amproc</structname> Columns</title>
663 <tgroup cols=4>
664 <thead>
665 <row>
666 <entry>Name</entry>
667 <entry>Type</entry>
668 <entry>References</entry>
669 <entry>Description</entry>
670 </row>
671 </thead>
672 <tbody>
674 <row>
675 <entry><structfield>amprocfamily</structfield></entry>
676 <entry><type>oid</type></entry>
677 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
678 <entry>The operator family this entry is for</entry>
679 </row>
681 <row>
682 <entry><structfield>amproclefttype</structfield></entry>
683 <entry><type>oid</type></entry>
684 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
685 <entry>Left-hand input data type of associated operator</entry>
686 </row>
688 <row>
689 <entry><structfield>amprocrighttype</structfield></entry>
690 <entry><type>oid</type></entry>
691 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
692 <entry>Right-hand input data type of associated operator</entry>
693 </row>
695 <row>
696 <entry><structfield>amprocnum</structfield></entry>
697 <entry><type>int2</type></entry>
698 <entry></entry>
699 <entry>Support procedure number</entry>
700 </row>
702 <row>
703 <entry><structfield>amproc</structfield></entry>
704 <entry><type>regproc</type></entry>
705 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
706 <entry>OID of the procedure</entry>
707 </row>
709 </tbody>
710 </tgroup>
711 </table>
713 <para>
714 The usual interpretation of the
715 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
716 is that they identify the left and right input types of the operator(s)
717 that a particular support procedure supports. For some access methods
718 these match the input data type(s) of the support procedure itself, for
719 others not. There is a notion of <quote>default</> support procedures for
720 an index, which are those with <structfield>amproclefttype</> and
721 <structfield>amprocrighttype</> both equal to the index opclass's
722 <structfield>opcintype</>.
723 </para>
725 </sect1>
728 <sect1 id="catalog-pg-attrdef">
729 <title><structname>pg_attrdef</structname></title>
731 <indexterm zone="catalog-pg-attrdef">
732 <primary>pg_attrdef</primary>
733 </indexterm>
735 <para>
736 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
737 about columns is stored in <structname>pg_attribute</structname>
738 (see below). Only columns that explicitly specify a default value
739 (when the table is created or the column is added) will have an
740 entry here.
741 </para>
743 <table>
744 <title><structname>pg_attrdef</> Columns</title>
746 <tgroup cols=4>
747 <thead>
748 <row>
749 <entry>Name</entry>
750 <entry>Type</entry>
751 <entry>References</entry>
752 <entry>Description</entry>
753 </row>
754 </thead>
756 <tbody>
757 <row>
758 <entry><structfield>adrelid</structfield></entry>
759 <entry><type>oid</type></entry>
760 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
761 <entry>The table this column belongs to</entry>
762 </row>
764 <row>
765 <entry><structfield>adnum</structfield></entry>
766 <entry><type>int2</type></entry>
767 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
768 <entry>The number of the column</entry>
769 </row>
771 <row>
772 <entry><structfield>adbin</structfield></entry>
773 <entry><type>text</type></entry>
774 <entry></entry>
775 <entry>The internal representation of the column default value</entry>
776 </row>
778 <row>
779 <entry><structfield>adsrc</structfield></entry>
780 <entry><type>text</type></entry>
781 <entry></entry>
782 <entry>A human-readable representation of the default value</entry>
783 </row>
784 </tbody>
785 </tgroup>
786 </table>
788 <para>
789 The <structfield>adsrc</structfield> field is historical, and is best
790 not used, because it does not track outside changes that might affect
791 the representation of the default value. Reverse-compiling the
792 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
793 example) is a better way to display the default value.
794 </para>
796 </sect1>
799 <sect1 id="catalog-pg-attribute">
800 <title><structname>pg_attribute</structname></title>
802 <indexterm zone="catalog-pg-attribute">
803 <primary>pg_attribute</primary>
804 </indexterm>
806 <para>
807 The catalog <structname>pg_attribute</structname> stores information about
808 table columns. There will be exactly one
809 <structname>pg_attribute</structname> row for every column in every
810 table in the database. (There will also be attribute entries for
811 indexes, and indeed all objects that have <structname>pg_class</structname>
812 entries.)
813 </para>
815 <para>
816 The term attribute is equivalent to column and is used for
817 historical reasons.
818 </para>
820 <table>
821 <title><structname>pg_attribute</> Columns</title>
823 <tgroup cols=4>
824 <thead>
825 <row>
826 <entry>Name</entry>
827 <entry>Type</entry>
828 <entry>References</entry>
829 <entry>Description</entry>
830 </row>
831 </thead>
833 <tbody>
834 <row>
835 <entry><structfield>attrelid</structfield></entry>
836 <entry><type>oid</type></entry>
837 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
838 <entry>The table this column belongs to</entry>
839 </row>
841 <row>
842 <entry><structfield>attname</structfield></entry>
843 <entry><type>name</type></entry>
844 <entry></entry>
845 <entry>The column name</entry>
846 </row>
848 <row>
849 <entry><structfield>atttypid</structfield></entry>
850 <entry><type>oid</type></entry>
851 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
852 <entry>The data type of this column</entry>
853 </row>
855 <row>
856 <entry><structfield>attstattarget</structfield></entry>
857 <entry><type>int4</type></entry>
858 <entry></entry>
859 <entry>
860 <structfield>attstattarget</structfield> controls the level of detail
861 of statistics accumulated for this column by
862 <xref linkend="sql-analyze" endterm="sql-analyze-title">.
863 A zero value indicates that no statistics should be collected.
864 A negative value says to use the system default statistics target.
865 The exact meaning of positive values is data type-dependent.
866 For scalar data types, <structfield>attstattarget</structfield>
867 is both the target number of <quote>most common values</quote>
868 to collect, and the target number of histogram bins to create
869 </entry>
870 </row>
872 <row>
873 <entry><structfield>attlen</structfield></entry>
874 <entry><type>int2</type></entry>
875 <entry></entry>
876 <entry>
877 A copy of <literal>pg_type.typlen</literal> of this column's
878 type
879 </entry>
880 </row>
882 <row>
883 <entry><structfield>attnum</structfield></entry>
884 <entry><type>int2</type></entry>
885 <entry></entry>
886 <entry>
887 The number of the column. Ordinary columns are numbered from 1
888 up. System columns, such as <structfield>oid</structfield>,
889 have (arbitrary) negative numbers
890 </entry>
891 </row>
893 <row>
894 <entry><structfield>attndims</structfield></entry>
895 <entry><type>int4</type></entry>
896 <entry></entry>
897 <entry>
898 Number of dimensions, if the column is an array type; otherwise 0.
899 (Presently, the number of dimensions of an array is not enforced,
900 so any nonzero value effectively means <quote>it's an array</>)
901 </entry>
902 </row>
904 <row>
905 <entry><structfield>attcacheoff</structfield></entry>
906 <entry><type>int4</type></entry>
907 <entry></entry>
908 <entry>
909 Always -1 in storage, but when loaded into a row descriptor
910 in memory this might be updated to cache the offset of the attribute
911 within the row
912 </entry>
913 </row>
915 <row>
916 <entry><structfield>atttypmod</structfield></entry>
917 <entry><type>int4</type></entry>
918 <entry></entry>
919 <entry>
920 <structfield>atttypmod</structfield> records type-specific data
921 supplied at table creation time (for example, the maximum
922 length of a <type>varchar</type> column). It is passed to
923 type-specific input functions and length coercion functions.
924 The value will generally be -1 for types that do not need <structfield>atttypmod</>
925 </entry>
926 </row>
928 <row>
929 <entry><structfield>attbyval</structfield></entry>
930 <entry><type>bool</type></entry>
931 <entry></entry>
932 <entry>
933 A copy of <literal>pg_type.typbyval</> of this column's type
934 </entry>
935 </row>
937 <row>
938 <entry><structfield>attstorage</structfield></entry>
939 <entry><type>char</type></entry>
940 <entry></entry>
941 <entry>
942 Normally a copy of <literal>pg_type.typstorage</> of this
943 column's type. For TOAST-able data types, this can be altered
944 after column creation to control storage policy
945 </entry>
946 </row>
948 <row>
949 <entry><structfield>attalign</structfield></entry>
950 <entry><type>char</type></entry>
951 <entry></entry>
952 <entry>
953 A copy of <literal>pg_type.typalign</> of this column's type
954 </entry>
955 </row>
957 <row>
958 <entry><structfield>attnotnull</structfield></entry>
959 <entry><type>bool</type></entry>
960 <entry></entry>
961 <entry>
962 This represents a not-null constraint. It is possible to
963 change this column to enable or disable the constraint
964 </entry>
965 </row>
967 <row>
968 <entry><structfield>atthasdef</structfield></entry>
969 <entry><type>bool</type></entry>
970 <entry></entry>
971 <entry>
972 This column has a default value, in which case there will be a
973 corresponding entry in the <structname>pg_attrdef</structname>
974 catalog that actually defines the value
975 </entry>
976 </row>
978 <row>
979 <entry><structfield>attisdropped</structfield></entry>
980 <entry><type>bool</type></entry>
981 <entry></entry>
982 <entry>
983 This column has been dropped and is no longer valid. A dropped
984 column is still physically present in the table, but is
985 ignored by the parser and so cannot be accessed via SQL
986 </entry>
987 </row>
989 <row>
990 <entry><structfield>attislocal</structfield></entry>
991 <entry><type>bool</type></entry>
992 <entry></entry>
993 <entry>
994 This column is defined locally in the relation. Note that a column can
995 be locally defined and inherited simultaneously
996 </entry>
997 </row>
999 <row>
1000 <entry><structfield>attinhcount</structfield></entry>
1001 <entry><type>int4</type></entry>
1002 <entry></entry>
1003 <entry>
1004 The number of direct ancestors this column has. A column with a
1005 nonzero number of ancestors cannot be dropped nor renamed
1006 </entry>
1007 </row>
1009 </tbody>
1010 </tgroup>
1011 </table>
1013 <para>
1014 In a dropped column's <structname>pg_attribute</structname> entry,
1015 <structfield>atttypid</structfield> is reset to zero, but
1016 <structfield>attlen</structfield> and the other fields copied from
1017 <structname>pg_type</> are still valid. This arrangement is needed
1018 to cope with the situation where the dropped column's data type was
1019 later dropped, and so there is no <structname>pg_type</> row anymore.
1020 <structfield>attlen</structfield> and the other fields can be used
1021 to interpret the contents of a row of the table.
1022 </para>
1023 </sect1>
1026 <sect1 id="catalog-pg-authid">
1027 <title><structname>pg_authid</structname></title>
1029 <indexterm zone="catalog-pg-authid">
1030 <primary>pg_authid</primary>
1031 </indexterm>
1033 <para>
1034 The catalog <structname>pg_authid</structname> contains information about
1035 database authorization identifiers (roles). A role subsumes the concepts
1036 of <quote>users</> and <quote>groups</>. A user is essentially just a
1037 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1038 without <structfield>rolcanlogin</>) can have other roles as members; see
1039 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1040 </para>
1042 <para>
1043 Since this catalog contains passwords, it must not be publicly readable.
1044 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1045 is a publicly readable view on
1046 <structname>pg_authid</structname> that blanks out the password field.
1047 </para>
1049 <para>
1050 <xref linkend="user-manag"> contains detailed information about user and
1051 privilege management.
1052 </para>
1054 <para>
1055 Because user identities are cluster-wide,
1056 <structname>pg_authid</structname>
1057 is shared across all databases of a cluster: there is only one
1058 copy of <structname>pg_authid</structname> per cluster, not
1059 one per database.
1060 </para>
1062 <table>
1063 <title><structname>pg_authid</> Columns</title>
1065 <tgroup cols=3>
1066 <thead>
1067 <row>
1068 <entry>Name</entry>
1069 <entry>Type</entry>
1070 <entry>Description</entry>
1071 </row>
1072 </thead>
1074 <tbody>
1075 <row>
1076 <entry><structfield>rolname</structfield></entry>
1077 <entry><type>name</type></entry>
1078 <entry>Role name</entry>
1079 </row>
1081 <row>
1082 <entry><structfield>rolsuper</structfield></entry>
1083 <entry><type>bool</type></entry>
1084 <entry>Role has superuser privileges</entry>
1085 </row>
1087 <row>
1088 <entry><structfield>rolinherit</structfield></entry>
1089 <entry><type>bool</type></entry>
1090 <entry>Role automatically inherits privileges of roles it is a
1091 member of</entry>
1092 </row>
1094 <row>
1095 <entry><structfield>rolcreaterole</structfield></entry>
1096 <entry><type>bool</type></entry>
1097 <entry>Role can create more roles</entry>
1098 </row>
1100 <row>
1101 <entry><structfield>rolcreatedb</structfield></entry>
1102 <entry><type>bool</type></entry>
1103 <entry>Role can create databases</entry>
1104 </row>
1106 <row>
1107 <entry><structfield>rolcatupdate</structfield></entry>
1108 <entry><type>bool</type></entry>
1109 <entry>
1110 Role can update system catalogs directly. (Even a superuser cannot do
1111 this unless this column is true)
1112 </entry>
1113 </row>
1115 <row>
1116 <entry><structfield>rolcanlogin</structfield></entry>
1117 <entry><type>bool</type></entry>
1118 <entry>
1119 Role can log in. That is, this role can be given as the initial
1120 session authorization identifier
1121 </entry>
1122 </row>
1124 <row>
1125 <entry><structfield>rolconnlimit</structfield></entry>
1126 <entry><type>int4</type></entry>
1127 <entry>
1128 For roles that can log in, this sets maximum number of concurrent
1129 connections this role can make. -1 means no limit
1130 </entry>
1131 </row>
1133 <row>
1134 <entry><structfield>rolpassword</structfield></entry>
1135 <entry><type>text</type></entry>
1136 <entry>Password (possibly encrypted); NULL if none</entry>
1137 </row>
1139 <row>
1140 <entry><structfield>rolvaliduntil</structfield></entry>
1141 <entry><type>timestamptz</type></entry>
1142 <entry>Password expiry time (only used for password authentication);
1143 NULL if no expiration</entry>
1144 </row>
1146 <row>
1147 <entry><structfield>rolconfig</structfield></entry>
1148 <entry><type>text[]</type></entry>
1149 <entry>Session defaults for run-time configuration variables</entry>
1150 </row>
1151 </tbody>
1152 </tgroup>
1153 </table>
1155 </sect1>
1158 <sect1 id="catalog-pg-auth-members">
1159 <title><structname>pg_auth_members</structname></title>
1161 <indexterm zone="catalog-pg-auth-members">
1162 <primary>pg_auth_members</primary>
1163 </indexterm>
1165 <para>
1166 The catalog <structname>pg_auth_members</structname> shows the membership
1167 relations between roles. Any non-circular set of relationships is allowed.
1168 </para>
1170 <para>
1171 Because user identities are cluster-wide,
1172 <structname>pg_auth_members</structname>
1173 is shared across all databases of a cluster: there is only one
1174 copy of <structname>pg_auth_members</structname> per cluster, not
1175 one per database.
1176 </para>
1178 <table>
1179 <title><structname>pg_auth_members</> Columns</title>
1181 <tgroup cols=4>
1182 <thead>
1183 <row>
1184 <entry>Name</entry>
1185 <entry>Type</entry>
1186 <entry>References</entry>
1187 <entry>Description</entry>
1188 </row>
1189 </thead>
1191 <tbody>
1192 <row>
1193 <entry><structfield>roleid</structfield></entry>
1194 <entry><type>oid</type></entry>
1195 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1196 <entry>ID of a role that has a member</entry>
1197 </row>
1199 <row>
1200 <entry><structfield>member</structfield></entry>
1201 <entry><type>oid</type></entry>
1202 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1203 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1204 </row>
1206 <row>
1207 <entry><structfield>grantor</structfield></entry>
1208 <entry><type>oid</type></entry>
1209 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1210 <entry>ID of the role that granted this membership</entry>
1211 </row>
1213 <row>
1214 <entry><structfield>admin_option</structfield></entry>
1215 <entry><type>bool</type></entry>
1216 <entry></entry>
1217 <entry>True if <structfield>member</> can grant membership in
1218 <structfield>roleid</> to others</entry>
1219 </row>
1220 </tbody>
1221 </tgroup>
1222 </table>
1224 </sect1>
1227 <sect1 id="catalog-pg-autovacuum">
1228 <title><structname>pg_autovacuum</structname></title>
1230 <indexterm zone="catalog-pg-autovacuum">
1231 <primary>pg_autovacuum</primary>
1232 </indexterm>
1234 <indexterm zone="catalog-pg-autovacuum">
1235 <primary>autovacuum</primary>
1236 <secondary>table-specific configuration</secondary>
1237 </indexterm>
1239 <para>
1240 The catalog <structname>pg_autovacuum</structname> stores optional
1241 per-relation configuration parameters for the autovacuum daemon.
1242 If there is an entry here for a particular relation, the given
1243 parameters will be used for autovacuuming that table. If no entry
1244 is present, the system-wide defaults will be used. For more information
1245 about the autovacuum daemon, see <xref linkend="autovacuum">.
1246 </para>
1248 <note>
1249 <para>
1250 It is likely that <structname>pg_autovacuum</structname> will disappear
1251 in a future release, with the information instead being kept in
1252 <structname>pg_class</>.<structfield>reloptions</> entries.
1253 </para>
1254 </note>
1256 <table>
1257 <title><structname>pg_autovacuum</> Columns</title>
1259 <tgroup cols=4>
1260 <thead>
1261 <row>
1262 <entry>Name</entry>
1263 <entry>Type</entry>
1264 <entry>References</entry>
1265 <entry>Description</entry>
1266 </row>
1267 </thead>
1269 <tbody>
1270 <row>
1271 <entry><structfield>vacrelid</structfield></entry>
1272 <entry><type>oid</type></entry>
1273 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1274 <entry>The table this entry is for</entry>
1275 </row>
1277 <row>
1278 <entry><structfield>enabled</structfield></entry>
1279 <entry><type>bool</type></entry>
1280 <entry></entry>
1281 <entry>If false, this table will not be autovacuumed, except
1282 to prevent transaction ID wraparound</entry>
1283 </row>
1285 <row>
1286 <entry><structfield>vac_base_thresh</structfield></entry>
1287 <entry><type>integer</type></entry>
1288 <entry></entry>
1289 <entry>Minimum number of modified tuples before vacuum</entry>
1290 </row>
1292 <row>
1293 <entry><structfield>vac_scale_factor</structfield></entry>
1294 <entry><type>float4</type></entry>
1295 <entry></entry>
1296 <entry>Multiplier for <structfield>reltuples</> to add to
1297 <structfield>vac_base_thresh</></entry>
1298 </row>
1300 <row>
1301 <entry><structfield>anl_base_thresh</structfield></entry>
1302 <entry><type>integer</type></entry>
1303 <entry></entry>
1304 <entry>Minimum number of modified tuples before analyze</entry>
1305 </row>
1307 <row>
1308 <entry><structfield>anl_scale_factor</structfield></entry>
1309 <entry><type>float4</type></entry>
1310 <entry></entry>
1311 <entry>Multiplier for <structfield>reltuples</> to add to
1312 <structfield>anl_base_thresh</></entry>
1313 </row>
1315 <row>
1316 <entry><structfield>vac_cost_delay</structfield></entry>
1317 <entry><type>integer</type></entry>
1318 <entry></entry>
1319 <entry>Custom <varname>vacuum_cost_delay</> parameter</entry>
1320 </row>
1322 <row>
1323 <entry><structfield>vac_cost_limit</structfield></entry>
1324 <entry><type>integer</type></entry>
1325 <entry></entry>
1326 <entry>Custom <varname>vacuum_cost_limit</> parameter</entry>
1327 </row>
1329 <row>
1330 <entry><structfield>freeze_min_age</structfield></entry>
1331 <entry><type>integer</type></entry>
1332 <entry></entry>
1333 <entry>Custom <varname>vacuum_freeze_min_age</> parameter</entry>
1334 </row>
1336 <row>
1337 <entry><structfield>freeze_max_age</structfield></entry>
1338 <entry><type>integer</type></entry>
1339 <entry></entry>
1340 <entry>Custom <varname>autovacuum_freeze_max_age</> parameter</entry>
1341 </row>
1342 </tbody>
1343 </tgroup>
1344 </table>
1346 <para>
1347 The autovacuum daemon will initiate a <command>VACUUM</> operation
1348 on a particular table when the number of updated or deleted tuples
1349 exceeds <structfield>vac_base_thresh</structfield> plus
1350 <structfield>vac_scale_factor</structfield> times the number of
1351 live tuples currently estimated to be in the relation.
1352 Similarly, it will initiate an <command>ANALYZE</> operation
1353 when the number of inserted, updated or deleted tuples
1354 exceeds <structfield>anl_base_thresh</structfield> plus
1355 <structfield>anl_scale_factor</structfield> times the number of
1356 live tuples currently estimated to be in the relation.
1357 </para>
1359 <para>
1360 Also, the autovacuum daemon will perform a <command>VACUUM</> operation
1361 to prevent transaction ID wraparound if the table's
1362 <structname>pg_class</>.<structfield>relfrozenxid</> field attains an age
1363 of more than <structfield>freeze_max_age</> transactions, whether the table
1364 has been changed or not, even if
1365 <structname>pg_autovacuum</>.<structfield>enabled</> is set to
1366 <literal>false</> for it. The system will launch autovacuum to perform
1367 such <command>VACUUM</>s even if autovacuum is otherwise disabled.
1368 See <xref linkend="vacuum-for-wraparound"> for more about wraparound
1369 prevention.
1370 </para>
1372 <para>
1373 Any of the numerical fields can contain <literal>-1</> (or indeed
1374 any negative value) to indicate that the system-wide default should
1375 be used for this particular value. Observe that the
1376 <structfield>vac_cost_delay</> variable inherits its default value from the
1377 <xref linkend="guc-autovacuum-vacuum-cost-delay"> configuration parameter,
1378 or from <xref linkend="guc-vacuum-cost-delay"> if the former is set to a
1379 negative value. The same applies to <structfield>vac_cost_limit</>.
1380 Also, autovacuum will ignore attempts to set a per-table
1381 <structfield>freeze_max_age</> larger than the system-wide setting (it can
1382 only be set smaller), and the <structfield>freeze_min_age</> value will be
1383 limited to half the system-wide <xref
1384 linkend="guc-autovacuum-freeze-max-age"> setting. Note that while you
1385 can set <structfield>freeze_max_age</> very small, or even zero, this
1386 is usually unwise since it will force frequent vacuuming.
1387 </para>
1389 </sect1>
1392 <sect1 id="catalog-pg-cast">
1393 <title><structname>pg_cast</structname></title>
1395 <indexterm zone="catalog-pg-cast">
1396 <primary>pg_cast</primary>
1397 </indexterm>
1399 <para>
1400 The catalog <structname>pg_cast</structname> stores data type conversion
1401 paths, both built-in paths and those defined with
1402 <xref linkend="sql-createcast" endterm="sql-createcast-title">.
1403 </para>
1405 <para>
1406 It should be noted that <structname>pg_cast</structname> does not represent
1407 every type conversion that the system knows how to perform; only those that
1408 cannot be deduced from some generic rule. For example, casting between a
1409 domain and its base type is not explicitly represented in
1410 <structname>pg_cast</structname>. Another important exception is that
1411 <quote>I/O conversion casts</>, those performed using a data type's own
1412 I/O functions to convert to or from <type>text</> or other string types,
1413 are not explicitly represented in <structname>pg_cast</structname>.
1414 </para>
1416 <table>
1417 <title><structname>pg_cast</> Columns</title>
1419 <tgroup cols=4>
1420 <thead>
1421 <row>
1422 <entry>Name</entry>
1423 <entry>Type</entry>
1424 <entry>References</entry>
1425 <entry>Description</entry>
1426 </row>
1427 </thead>
1429 <tbody>
1430 <row>
1431 <entry><structfield>castsource</structfield></entry>
1432 <entry><type>oid</type></entry>
1433 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1434 <entry>OID of the source data type</entry>
1435 </row>
1437 <row>
1438 <entry><structfield>casttarget</structfield></entry>
1439 <entry><type>oid</type></entry>
1440 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1441 <entry>OID of the target data type</entry>
1442 </row>
1444 <row>
1445 <entry><structfield>castfunc</structfield></entry>
1446 <entry><type>oid</type></entry>
1447 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1448 <entry>
1449 The OID of the function to use to perform this cast. Zero is
1450 stored if the data types are binary coercible (that is, no
1451 run-time operation is needed to perform the cast)
1452 </entry>
1453 </row>
1455 <row>
1456 <entry><structfield>castcontext</structfield></entry>
1457 <entry><type>char</type></entry>
1458 <entry></entry>
1459 <entry>
1460 Indicates what contexts the cast can be invoked in.
1461 <literal>e</> means only as an explicit cast (using
1462 <literal>CAST</> or <literal>::</> syntax).
1463 <literal>a</> means implicitly in assignment
1464 to a target column, as well as explicitly.
1465 <literal>i</> means implicitly in expressions, as well as the
1466 other cases
1467 </entry>
1468 </row>
1469 </tbody>
1470 </tgroup>
1471 </table>
1473 <para>
1474 The cast functions listed in <structname>pg_cast</structname> must
1475 always take the cast source type as their first argument type, and
1476 return the cast destination type as their result type. A cast
1477 function can have up to three arguments. The second argument,
1478 if present, must be type <type>integer</>; it receives the type
1479 modifier associated with the destination type, or <literal>-1</>
1480 if there is none. The third argument,
1481 if present, must be type <type>boolean</>; it receives <literal>true</>
1482 if the cast is an explicit cast, <literal>false</> otherwise.
1483 </para>
1485 <para>
1486 It is legitimate to create a <structname>pg_cast</structname> entry
1487 in which the source and target types are the same, if the associated
1488 function takes more than one argument. Such entries represent
1489 <quote>length coercion functions</> that coerce values of the type
1490 to be legal for a particular type modifier value.
1491 </para>
1493 <para>
1494 When a <structname>pg_cast</structname> entry has different source and
1495 target types and a function that takes more than one argument, it
1496 represents converting from one type to another and applying a length
1497 coercion in a single step. When no such entry is available, coercion
1498 to a type that uses a type modifier involves two steps, one to
1499 convert between data types and a second to apply the modifier.
1500 </para>
1501 </sect1>
1503 <sect1 id="catalog-pg-class">
1504 <title><structname>pg_class</structname></title>
1506 <indexterm zone="catalog-pg-class">
1507 <primary>pg_class</primary>
1508 </indexterm>
1510 <para>
1511 The catalog <structname>pg_class</structname> catalogs tables and most
1512 everything else that has columns or is otherwise similar to a
1513 table. This includes indexes (but see also
1514 <structname>pg_index</structname>), sequences, views, composite types,
1515 and TOAST tables; see <structfield>relkind</>.
1516 Below, when we mean all of these
1517 kinds of objects we speak of <quote>relations</quote>. Not all
1518 columns are meaningful for all relation types.
1519 </para>
1521 <table>
1522 <title><structname>pg_class</> Columns</title>
1524 <tgroup cols=4>
1525 <thead>
1526 <row>
1527 <entry>Name</entry>
1528 <entry>Type</entry>
1529 <entry>References</entry>
1530 <entry>Description</entry>
1531 </row>
1532 </thead>
1534 <tbody>
1535 <row>
1536 <entry><structfield>relname</structfield></entry>
1537 <entry><type>name</type></entry>
1538 <entry></entry>
1539 <entry>Name of the table, index, view, etc.</entry>
1540 </row>
1542 <row>
1543 <entry><structfield>relnamespace</structfield></entry>
1544 <entry><type>oid</type></entry>
1545 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1546 <entry>
1547 The OID of the namespace that contains this relation
1548 </entry>
1549 </row>
1551 <row>
1552 <entry><structfield>reltype</structfield></entry>
1553 <entry><type>oid</type></entry>
1554 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1555 <entry>
1556 The OID of the data type that corresponds to this table's row type,
1557 if any (zero for indexes, which have no <structname>pg_type</> entry)
1558 </entry>
1559 </row>
1561 <row>
1562 <entry><structfield>relowner</structfield></entry>
1563 <entry><type>oid</type></entry>
1564 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1565 <entry>Owner of the relation</entry>
1566 </row>
1568 <row>
1569 <entry><structfield>relam</structfield></entry>
1570 <entry><type>oid</type></entry>
1571 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1572 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1573 </row>
1575 <row>
1576 <entry><structfield>relfilenode</structfield></entry>
1577 <entry><type>oid</type></entry>
1578 <entry></entry>
1579 <entry>Name of the on-disk file of this relation; 0 if none</entry>
1580 </row>
1582 <row>
1583 <entry><structfield>reltablespace</structfield></entry>
1584 <entry><type>oid</type></entry>
1585 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1586 <entry>
1587 The tablespace in which this relation is stored. If zero,
1588 the database's default tablespace is implied. (Not meaningful
1589 if the relation has no on-disk file.)
1590 </entry>
1591 </row>
1593 <row>
1594 <entry><structfield>relpages</structfield></entry>
1595 <entry><type>int4</type></entry>
1596 <entry></entry>
1597 <entry>
1598 Size of the on-disk representation of this table in pages (of size
1599 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1600 planner. It is updated by <command>VACUUM</command>,
1601 <command>ANALYZE</command>, and a few DDL commands such as
1602 <command>CREATE INDEX</command>
1603 </entry>
1604 </row>
1606 <row>
1607 <entry><structfield>reltuples</structfield></entry>
1608 <entry><type>float4</type></entry>
1609 <entry></entry>
1610 <entry>
1611 Number of rows in the table. This is only an estimate used by the
1612 planner. It is updated by <command>VACUUM</command>,
1613 <command>ANALYZE</command>, and a few DDL commands such as
1614 <command>CREATE INDEX</command>
1615 </entry>
1616 </row>
1618 <row>
1619 <entry><structfield>reltoastrelid</structfield></entry>
1620 <entry><type>oid</type></entry>
1621 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1622 <entry>
1623 OID of the TOAST table associated with this table, 0 if none. The
1624 TOAST table stores large attributes <quote>out of line</quote> in a
1625 secondary table
1626 </entry>
1627 </row>
1629 <row>
1630 <entry><structfield>reltoastidxid</structfield></entry>
1631 <entry><type>oid</type></entry>
1632 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1633 <entry>
1634 For a TOAST table, the OID of its index. 0 if not a TOAST table
1635 </entry>
1636 </row>
1638 <row>
1639 <entry><structfield>relhasindex</structfield></entry>
1640 <entry><type>bool</type></entry>
1641 <entry></entry>
1642 <entry>
1643 True if this is a table and it has (or recently had) any
1644 indexes. This is set by <command>CREATE INDEX</command>, but
1645 not cleared immediately by <command>DROP INDEX</command>.
1646 <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the
1647 table has no indexes
1648 </entry>
1649 </row>
1651 <row>
1652 <entry><structfield>relisshared</structfield></entry>
1653 <entry><type>bool</type></entry>
1654 <entry></entry>
1655 <entry>
1656 True if this table is shared across all databases in the cluster. Only
1657 certain system catalogs (such as <structname>pg_database</structname>)
1658 are shared
1659 </entry>
1660 </row>
1662 <row>
1663 <entry><structfield>relkind</structfield></entry>
1664 <entry><type>char</type></entry>
1665 <entry></entry>
1666 <entry>
1667 <literal>r</> = ordinary table, <literal>i</> = index,
1668 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1669 composite type, <literal>t</> = TOAST
1670 table
1671 </entry>
1672 </row>
1674 <row>
1675 <entry><structfield>relnatts</structfield></entry>
1676 <entry><type>int2</type></entry>
1677 <entry></entry>
1678 <entry>
1679 Number of user columns in the relation (system columns not
1680 counted). There must be this many corresponding entries in
1681 <structname>pg_attribute</structname>. See also
1682 <literal>pg_attribute.attnum</literal>
1683 </entry>
1684 </row>
1686 <row>
1687 <entry><structfield>relchecks</structfield></entry>
1688 <entry><type>int2</type></entry>
1689 <entry></entry>
1690 <entry>
1691 Number of check constraints on the table; see
1692 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1693 </entry>
1694 </row>
1696 <row>
1697 <entry><structfield>reltriggers</structfield></entry>
1698 <entry><type>int2</type></entry>
1699 <entry></entry>
1700 <entry>
1701 Number of triggers on the table; see
1702 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1703 </entry>
1704 </row>
1706 <row>
1707 <entry><structfield>relukeys</structfield></entry>
1708 <entry><type>int2</type></entry>
1709 <entry></entry>
1710 <entry>Unused (<emphasis>not</emphasis> the number of unique keys)</entry>
1711 </row>
1713 <row>
1714 <entry><structfield>relfkeys</structfield></entry>
1715 <entry><type>int2</type></entry>
1716 <entry></entry>
1717 <entry>Unused (<emphasis>not</emphasis> the number of foreign keys on the table)</entry>
1718 </row>
1720 <row>
1721 <entry><structfield>relrefs</structfield></entry>
1722 <entry><type>int2</type></entry>
1723 <entry></entry>
1724 <entry>Unused</entry>
1725 </row>
1727 <row>
1728 <entry><structfield>relhasoids</structfield></entry>
1729 <entry><type>bool</type></entry>
1730 <entry></entry>
1731 <entry>
1732 True if we generate an OID for each row of the relation
1733 </entry>
1734 </row>
1736 <row>
1737 <entry><structfield>relhaspkey</structfield></entry>
1738 <entry><type>bool</type></entry>
1739 <entry></entry>
1740 <entry>
1741 True if the table has (or once had) a primary key
1742 </entry>
1743 </row>
1745 <row>
1746 <entry><structfield>relhasrules</structfield></entry>
1747 <entry><type>bool</type></entry>
1748 <entry></entry>
1749 <entry>
1750 True if table has rules; see
1751 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1752 </entry>
1753 </row>
1755 <row>
1756 <entry><structfield>relhassubclass</structfield></entry>
1757 <entry><type>bool</type></entry>
1758 <entry></entry>
1759 <entry>True if table has (or once had) any inheritance children</entry>
1760 </row>
1762 <row>
1763 <entry><structfield>relfrozenxid</structfield></entry>
1764 <entry><type>xid</type></entry>
1765 <entry></entry>
1766 <entry>
1767 All transaction IDs before this one have been replaced with a permanent
1768 (<quote>frozen</>) transaction ID in this table. This is used to track
1769 whether the table needs to be vacuumed in order to prevent transaction
1770 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1771 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table
1772 </entry>
1773 </row>
1775 <row>
1776 <entry><structfield>relacl</structfield></entry>
1777 <entry><type>aclitem[]</type></entry>
1778 <entry></entry>
1779 <entry>
1780 Access privileges; see
1781 <xref linkend="sql-grant" endterm="sql-grant-title"> and
1782 <xref linkend="sql-revoke" endterm="sql-revoke-title">
1783 for details
1784 </entry>
1785 </row>
1787 <row>
1788 <entry><structfield>reloptions</structfield></entry>
1789 <entry><type>text[]</type></entry>
1790 <entry></entry>
1791 <entry>
1792 Access-method-specific options, as <quote>keyword=value</> strings
1793 </entry>
1794 </row>
1795 </tbody>
1796 </tgroup>
1797 </table>
1798 </sect1>
1800 <sect1 id="catalog-pg-constraint">
1801 <title><structname>pg_constraint</structname></title>
1803 <indexterm zone="catalog-pg-constraint">
1804 <primary>pg_constraint</primary>
1805 </indexterm>
1807 <para>
1808 The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
1809 key constraints on tables. (Column constraints are not treated
1810 specially. Every column constraint is equivalent to some table
1811 constraint.) Not-null constraints are represented in the
1812 <structname>pg_attribute</> catalog.
1813 </para>
1815 <para>
1816 Check constraints on domains are stored here, too.
1817 </para>
1819 <table>
1820 <title><structname>pg_constraint</> Columns</title>
1822 <tgroup cols=4>
1823 <thead>
1824 <row>
1825 <entry>Name</entry>
1826 <entry>Type</entry>
1827 <entry>References</entry>
1828 <entry>Description</entry>
1829 </row>
1830 </thead>
1832 <tbody>
1833 <row>
1834 <entry><structfield>conname</structfield></entry>
1835 <entry><type>name</type></entry>
1836 <entry></entry>
1837 <entry>Constraint name (not necessarily unique!)</entry>
1838 </row>
1840 <row>
1841 <entry><structfield>connamespace</structfield></entry>
1842 <entry><type>oid</type></entry>
1843 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1844 <entry>
1845 The OID of the namespace that contains this constraint
1846 </entry>
1847 </row>
1849 <row>
1850 <entry><structfield>contype</structfield></entry>
1851 <entry><type>char</type></entry>
1852 <entry></entry>
1853 <entry>
1854 <literal>c</> = check constraint,
1855 <literal>f</> = foreign key constraint,
1856 <literal>p</> = primary key constraint,
1857 <literal>u</> = unique constraint
1858 </entry>
1859 </row>
1861 <row>
1862 <entry><structfield>condeferrable</structfield></entry>
1863 <entry><type>bool</type></entry>
1864 <entry></entry>
1865 <entry>Is the constraint deferrable?</entry>
1866 </row>
1868 <row>
1869 <entry><structfield>condeferred</structfield></entry>
1870 <entry><type>bool</type></entry>
1871 <entry></entry>
1872 <entry>Is the constraint deferred by default?</entry>
1873 </row>
1875 <row>
1876 <entry><structfield>conrelid</structfield></entry>
1877 <entry><type>oid</type></entry>
1878 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1879 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1880 </row>
1882 <row>
1883 <entry><structfield>contypid</structfield></entry>
1884 <entry><type>oid</type></entry>
1885 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1886 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1887 </row>
1889 <row>
1890 <entry><structfield>confrelid</structfield></entry>
1891 <entry><type>oid</type></entry>
1892 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1893 <entry>If a foreign key, the referenced table; else 0</entry>
1894 </row>
1896 <row>
1897 <entry><structfield>confupdtype</structfield></entry>
1898 <entry><type>char</type></entry>
1899 <entry></entry>
1900 <entry>Foreign key update action code</entry>
1901 </row>
1903 <row>
1904 <entry><structfield>confdeltype</structfield></entry>
1905 <entry><type>char</type></entry>
1906 <entry></entry>
1907 <entry>Foreign key deletion action code</entry>
1908 </row>
1910 <row>
1911 <entry><structfield>confmatchtype</structfield></entry>
1912 <entry><type>char</type></entry>
1913 <entry></entry>
1914 <entry>Foreign key match type</entry>
1915 </row>
1917 <row>
1918 <entry><structfield>conislocal</structfield></entry>
1919 <entry><type>bool</type></entry>
1920 <entry></entry>
1921 <entry>
1922 This constraint is defined locally in the relation. Note that a
1923 constraint can be locally defined and inherited simultaneously
1924 </entry>
1925 </row>
1927 <row>
1928 <entry><structfield>coninhcount</structfield></entry>
1929 <entry><type>int4</type></entry>
1930 <entry></entry>
1931 <entry>
1932 The number of direct ancestors this constraint has. A constraint with
1933 a nonzero number of ancestors cannot be dropped nor renamed
1934 </entry>
1935 </row>
1937 <row>
1938 <entry><structfield>conkey</structfield></entry>
1939 <entry><type>int2[]</type></entry>
1940 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1941 <entry>If a table constraint, list of columns which the constraint constrains</entry>
1942 </row>
1944 <row>
1945 <entry><structfield>confkey</structfield></entry>
1946 <entry><type>int2[]</type></entry>
1947 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1948 <entry>If a foreign key, list of the referenced columns</entry>
1949 </row>
1951 <row>
1952 <entry><structfield>conpfeqop</structfield></entry>
1953 <entry><type>oid[]</type></entry>
1954 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1955 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
1956 </row>
1958 <row>
1959 <entry><structfield>conppeqop</structfield></entry>
1960 <entry><type>oid[]</type></entry>
1961 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1962 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
1963 </row>
1965 <row>
1966 <entry><structfield>conffeqop</structfield></entry>
1967 <entry><type>oid[]</type></entry>
1968 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1969 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
1970 </row>
1972 <row>
1973 <entry><structfield>conbin</structfield></entry>
1974 <entry><type>text</type></entry>
1975 <entry></entry>
1976 <entry>If a check constraint, an internal representation of the expression</entry>
1977 </row>
1979 <row>
1980 <entry><structfield>consrc</structfield></entry>
1981 <entry><type>text</type></entry>
1982 <entry></entry>
1983 <entry>If a check constraint, a human-readable representation of the expression</entry>
1984 </row>
1985 </tbody>
1986 </tgroup>
1987 </table>
1989 <note>
1990 <para>
1991 <structfield>consrc</structfield> is not updated when referenced objects
1992 change; for example, it won't track renaming of columns. Rather than
1993 relying on this field, it's best to use <function>pg_get_constraintdef()</>
1994 to extract the definition of a check constraint.
1995 </para>
1996 </note>
1998 <note>
1999 <para>
2000 <literal>pg_class.relchecks</literal> needs to agree with the
2001 number of check-constraint entries found in this table for each
2002 relation.
2003 </para>
2004 </note>
2006 </sect1>
2008 <sect1 id="catalog-pg-conversion">
2009 <title><structname>pg_conversion</structname></title>
2011 <indexterm zone="catalog-pg-conversion">
2012 <primary>pg_conversion</primary>
2013 </indexterm>
2015 <para>
2016 The catalog <structname>pg_conversion</structname> describes the
2017 available encoding conversion procedures. See
2018 <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
2019 for more information.
2020 </para>
2022 <table>
2023 <title><structname>pg_conversion</> Columns</title>
2025 <tgroup cols=4>
2026 <thead>
2027 <row>
2028 <entry>Name</entry>
2029 <entry>Type</entry>
2030 <entry>References</entry>
2031 <entry>Description</entry>
2032 </row>
2033 </thead>
2035 <tbody>
2036 <row>
2037 <entry><structfield>conname</structfield></entry>
2038 <entry><type>name</type></entry>
2039 <entry></entry>
2040 <entry>Conversion name (unique within a namespace)</entry>
2041 </row>
2043 <row>
2044 <entry><structfield>connamespace</structfield></entry>
2045 <entry><type>oid</type></entry>
2046 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2047 <entry>
2048 The OID of the namespace that contains this conversion
2049 </entry>
2050 </row>
2052 <row>
2053 <entry><structfield>conowner</structfield></entry>
2054 <entry><type>oid</type></entry>
2055 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2056 <entry>Owner of the conversion</entry>
2057 </row>
2059 <row>
2060 <entry><structfield>conforencoding</structfield></entry>
2061 <entry><type>int4</type></entry>
2062 <entry></entry>
2063 <entry>Source encoding ID</entry>
2064 </row>
2066 <row>
2067 <entry><structfield>contoencoding</structfield></entry>
2068 <entry><type>int4</type></entry>
2069 <entry></entry>
2070 <entry>Destination encoding ID</entry>
2071 </row>
2073 <row>
2074 <entry><structfield>conproc</structfield></entry>
2075 <entry><type>regproc</type></entry>
2076 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2077 <entry>Conversion procedure</entry>
2078 </row>
2080 <row>
2081 <entry><structfield>condefault</structfield></entry>
2082 <entry><type>bool</type></entry>
2083 <entry></entry>
2084 <entry>True if this is the default conversion</entry>
2085 </row>
2087 </tbody>
2088 </tgroup>
2089 </table>
2091 </sect1>
2093 <sect1 id="catalog-pg-database">
2094 <title><structname>pg_database</structname></title>
2096 <indexterm zone="catalog-pg-database">
2097 <primary>pg_database</primary>
2098 </indexterm>
2100 <para>
2101 The catalog <structname>pg_database</structname> stores information about
2102 the available databases. Databases are created with the <xref
2103 linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
2104 Consult <xref linkend="managing-databases"> for details about the meaning
2105 of some of the parameters.
2106 </para>
2108 <para>
2109 Unlike most system catalogs, <structname>pg_database</structname>
2110 is shared across all databases of a cluster: there is only one
2111 copy of <structname>pg_database</structname> per cluster, not
2112 one per database.
2113 </para>
2115 <table>
2116 <title><structname>pg_database</> Columns</title>
2118 <tgroup cols=4>
2119 <thead>
2120 <row>
2121 <entry>Name</entry>
2122 <entry>Type</entry>
2123 <entry>References</entry>
2124 <entry>Description</entry>
2125 </row>
2126 </thead>
2128 <tbody>
2129 <row>
2130 <entry><structfield>datname</structfield></entry>
2131 <entry><type>name</type></entry>
2132 <entry></entry>
2133 <entry>Database name</entry>
2134 </row>
2136 <row>
2137 <entry><structfield>datdba</structfield></entry>
2138 <entry><type>oid</type></entry>
2139 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2140 <entry>Owner of the database, usually the user who created it</entry>
2141 </row>
2143 <row>
2144 <entry><structfield>encoding</structfield></entry>
2145 <entry><type>int4</type></entry>
2146 <entry></entry>
2147 <entry>Character encoding for this database
2148 (<function>pg_encoding_to_char()</function> can translate
2149 this number to the encoding name)</entry>
2150 </row>
2152 <row>
2153 <entry><structfield>datcollate</structfield></entry>
2154 <entry><type>name</type></entry>
2155 <entry></entry>
2156 <entry>LC_COLLATE for this database</entry>
2157 </row>
2159 <row>
2160 <entry><structfield>datctype</structfield></entry>
2161 <entry><type>name</type></entry>
2162 <entry></entry>
2163 <entry>LC_CTYPE for this database</entry>
2164 </row>
2166 <row>
2167 <entry><structfield>datistemplate</structfield></entry>
2168 <entry><type>bool</type></entry>
2169 <entry></entry>
2170 <entry>
2171 If true then this database can be used in the
2172 <literal>TEMPLATE</literal> clause of <command>CREATE
2173 DATABASE</command> to create a new database as a clone of
2174 this one
2175 </entry>
2176 </row>
2178 <row>
2179 <entry><structfield>datallowconn</structfield></entry>
2180 <entry><type>bool</type></entry>
2181 <entry></entry>
2182 <entry>
2183 If false then no one can connect to this database. This is
2184 used to protect the <literal>template0</> database from being altered
2185 </entry>
2186 </row>
2188 <row>
2189 <entry><structfield>datconnlimit</structfield></entry>
2190 <entry><type>int4</type></entry>
2191 <entry></entry>
2192 <entry>
2193 Sets maximum number of concurrent connections that can be made
2194 to this database. -1 means no limit
2195 </entry>
2196 </row>
2198 <row>
2199 <entry><structfield>datlastsysoid</structfield></entry>
2200 <entry><type>oid</type></entry>
2201 <entry></entry>
2202 <entry>
2203 Last system OID in the database; useful
2204 particularly to <application>pg_dump</application>
2205 </entry>
2206 </row>
2208 <row>
2209 <entry><structfield>datfrozenxid</structfield></entry>
2210 <entry><type>xid</type></entry>
2211 <entry></entry>
2212 <entry>
2213 All transaction IDs before this one have been replaced with a permanent
2214 (<quote>frozen</>) transaction ID in this database. This is used to
2215 track whether the database needs to be vacuumed in order to prevent
2216 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2217 It is the minimum of the per-table
2218 <structname>pg_class</>.<structfield>relfrozenxid</> values
2219 </entry>
2220 </row>
2222 <row>
2223 <entry><structfield>dattablespace</structfield></entry>
2224 <entry><type>oid</type></entry>
2225 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2226 <entry>
2227 The default tablespace for the database.
2228 Within this database, all tables for which
2229 <structname>pg_class</>.<structfield>reltablespace</> is zero
2230 will be stored in this tablespace; in particular, all the non-shared
2231 system catalogs will be there
2232 </entry>
2233 </row>
2235 <row>
2236 <entry><structfield>datconfig</structfield></entry>
2237 <entry><type>text[]</type></entry>
2238 <entry></entry>
2239 <entry>Session defaults for run-time configuration variables</entry>
2240 </row>
2242 <row>
2243 <entry><structfield>datacl</structfield></entry>
2244 <entry><type>aclitem[]</type></entry>
2245 <entry></entry>
2246 <entry>
2247 Access privileges; see
2248 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2249 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2250 for details
2251 </entry>
2252 </row>
2253 </tbody>
2254 </tgroup>
2255 </table>
2256 </sect1>
2259 <sect1 id="catalog-pg-depend">
2260 <title><structname>pg_depend</structname></title>
2262 <indexterm zone="catalog-pg-depend">
2263 <primary>pg_depend</primary>
2264 </indexterm>
2266 <para>
2267 The catalog <structname>pg_depend</structname> records the dependency
2268 relationships between database objects. This information allows
2269 <command>DROP</> commands to find which other objects must be dropped
2270 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2271 RESTRICT</> case.
2272 </para>
2274 <para>
2275 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2276 which performs a similar function for dependencies involving objects
2277 that are shared across a database cluster.
2278 </para>
2280 <table>
2281 <title><structname>pg_depend</> Columns</title>
2283 <tgroup cols=4>
2284 <thead>
2285 <row>
2286 <entry>Name</entry>
2287 <entry>Type</entry>
2288 <entry>References</entry>
2289 <entry>Description</entry>
2290 </row>
2291 </thead>
2293 <tbody>
2294 <row>
2295 <entry><structfield>classid</structfield></entry>
2296 <entry><type>oid</type></entry>
2297 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2298 <entry>The OID of the system catalog the dependent object is in</entry>
2299 </row>
2301 <row>
2302 <entry><structfield>objid</structfield></entry>
2303 <entry><type>oid</type></entry>
2304 <entry>any OID column</entry>
2305 <entry>The OID of the specific dependent object</entry>
2306 </row>
2308 <row>
2309 <entry><structfield>objsubid</structfield></entry>
2310 <entry><type>int4</type></entry>
2311 <entry></entry>
2312 <entry>
2313 For a table column, this is the column number (the
2314 <structfield>objid</> and <structfield>classid</> refer to the
2315 table itself). For all other object types, this column is
2316 zero
2317 </entry>
2318 </row>
2320 <row>
2321 <entry><structfield>refclassid</structfield></entry>
2322 <entry><type>oid</type></entry>
2323 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2324 <entry>The OID of the system catalog the referenced object is in</entry>
2325 </row>
2327 <row>
2328 <entry><structfield>refobjid</structfield></entry>
2329 <entry><type>oid</type></entry>
2330 <entry>any OID column</entry>
2331 <entry>The OID of the specific referenced object</entry>
2332 </row>
2334 <row>
2335 <entry><structfield>refobjsubid</structfield></entry>
2336 <entry><type>int4</type></entry>
2337 <entry></entry>
2338 <entry>
2339 For a table column, this is the column number (the
2340 <structfield>refobjid</> and <structfield>refclassid</> refer
2341 to the table itself). For all other object types, this column
2342 is zero
2343 </entry>
2344 </row>
2346 <row>
2347 <entry><structfield>deptype</structfield></entry>
2348 <entry><type>char</type></entry>
2349 <entry></entry>
2350 <entry>
2351 A code defining the specific semantics of this dependency relationship; see text
2352 </entry>
2353 </row>
2355 </tbody>
2356 </tgroup>
2357 </table>
2359 <para>
2360 In all cases, a <structname>pg_depend</structname> entry indicates that the
2361 referenced object cannot be dropped without also dropping the dependent
2362 object. However, there are several subflavors identified by
2363 <structfield>deptype</>:
2365 <variablelist>
2366 <varlistentry>
2367 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2368 <listitem>
2369 <para>
2370 A normal relationship between separately-created objects. The
2371 dependent object can be dropped without affecting the
2372 referenced object. The referenced object can only be dropped
2373 by specifying <literal>CASCADE</>, in which case the dependent
2374 object is dropped, too. Example: a table column has a normal
2375 dependency on its data type.
2376 </para>
2377 </listitem>
2378 </varlistentry>
2380 <varlistentry>
2381 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2382 <listitem>
2383 <para>
2384 The dependent object can be dropped separately from the
2385 referenced object, and should be automatically dropped
2386 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2387 mode) if the referenced object is dropped. Example: a named
2388 constraint on a table is made autodependent on the table, so
2389 that it will go away if the table is dropped.
2390 </para>
2391 </listitem>
2392 </varlistentry>
2394 <varlistentry>
2395 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2396 <listitem>
2397 <para>
2398 The dependent object was created as part of creation of the
2399 referenced object, and is really just a part of its internal
2400 implementation. A <command>DROP</> of the dependent object
2401 will be disallowed outright (we'll tell the user to issue a
2402 <command>DROP</> against the referenced object, instead). A
2403 <command>DROP</> of the referenced object will be propagated
2404 through to drop the dependent object whether
2405 <command>CASCADE</> is specified or not. Example: a trigger
2406 that's created to enforce a foreign-key constraint is made
2407 internally dependent on the constraint's
2408 <structname>pg_constraint</> entry.
2409 </para>
2410 </listitem>
2411 </varlistentry>
2413 <varlistentry>
2414 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2415 <listitem>
2416 <para>
2417 There is no dependent object; this type of entry is a signal
2418 that the system itself depends on the referenced object, and so
2419 that object must never be deleted. Entries of this type are
2420 created only by <command>initdb</command>. The columns for the
2421 dependent object contain zeroes.
2422 </para>
2423 </listitem>
2424 </varlistentry>
2425 </variablelist>
2427 Other dependency flavors might be needed in future.
2428 </para>
2430 </sect1>
2433 <sect1 id="catalog-pg-description">
2434 <title><structname>pg_description</structname></title>
2436 <indexterm zone="catalog-pg-description">
2437 <primary>pg_description</primary>
2438 </indexterm>
2440 <para>
2441 The catalog <structname>pg_description</> stores optional descriptions
2442 (comments) for each database object. Descriptions can be manipulated
2443 with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2444 <application>psql</application>'s <literal>\d</literal> commands.
2445 Descriptions of many built-in system objects are provided in the initial
2446 contents of <structname>pg_description</structname>.
2447 </para>
2449 <para>
2450 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2451 which performs a similar function for descriptions involving objects that
2452 are shared across a database cluster.
2453 </para>
2455 <table>
2456 <title><structname>pg_description</> Columns</title>
2458 <tgroup cols=4>
2459 <thead>
2460 <row>
2461 <entry>Name</entry>
2462 <entry>Type</entry>
2463 <entry>References</entry>
2464 <entry>Description</entry>
2465 </row>
2466 </thead>
2468 <tbody>
2469 <row>
2470 <entry><structfield>objoid</structfield></entry>
2471 <entry><type>oid</type></entry>
2472 <entry>any OID column</entry>
2473 <entry>The OID of the object this description pertains to</entry>
2474 </row>
2476 <row>
2477 <entry><structfield>classoid</structfield></entry>
2478 <entry><type>oid</type></entry>
2479 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2480 <entry>The OID of the system catalog this object appears in</entry>
2481 </row>
2483 <row>
2484 <entry><structfield>objsubid</structfield></entry>
2485 <entry><type>int4</type></entry>
2486 <entry></entry>
2487 <entry>
2488 For a comment on a table column, this is the column number (the
2489 <structfield>objoid</> and <structfield>classoid</> refer to
2490 the table itself). For all other object types, this column is
2491 zero
2492 </entry>
2493 </row>
2495 <row>
2496 <entry><structfield>description</structfield></entry>
2497 <entry><type>text</type></entry>
2498 <entry></entry>
2499 <entry>Arbitrary text that serves as the description of this object</entry>
2500 </row>
2501 </tbody>
2502 </tgroup>
2503 </table>
2505 </sect1>
2508 <sect1 id="catalog-pg-enum">
2509 <title><structname>pg_enum</structname></title>
2511 <indexterm zone="catalog-pg-enum">
2512 <primary>pg_enum</primary>
2513 </indexterm>
2515 <para>
2516 The <structname>pg_enum</structname> catalog contains entries
2517 matching enum types to their associated values and labels. The
2518 internal representation of a given enum value is actually the OID
2519 of its associated row in <structname>pg_enum</structname>. The
2520 OIDs for a particular enum type are guaranteed to be ordered in
2521 the way the type should sort, but there is no guarantee about the
2522 ordering of OIDs of unrelated enum types.
2523 </para>
2525 <table>
2526 <title><structname>pg_enum</> Columns</title>
2528 <tgroup cols=4>
2529 <thead>
2530 <row>
2531 <entry>Name</entry>
2532 <entry>Type</entry>
2533 <entry>References</entry>
2534 <entry>Description</entry>
2535 </row>
2536 </thead>
2538 <tbody>
2539 <row>
2540 <entry><structfield>enumtypid</structfield></entry>
2541 <entry><type>oid</type></entry>
2542 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2543 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2544 </row>
2546 <row>
2547 <entry><structfield>enumlabel</structfield></entry>
2548 <entry><type>name</type></entry>
2549 <entry></entry>
2550 <entry>The textual label for this enum value</entry>
2551 </row>
2552 </tbody>
2553 </tgroup>
2554 </table>
2555 </sect1>
2558 <sect1 id="catalog-pg-index">
2559 <title><structname>pg_index</structname></title>
2561 <indexterm zone="catalog-pg-index">
2562 <primary>pg_index</primary>
2563 </indexterm>
2565 <para>
2566 The catalog <structname>pg_index</structname> contains part of the information
2567 about indexes. The rest is mostly in
2568 <structname>pg_class</structname>.
2569 </para>
2571 <table>
2572 <title><structname>pg_index</> Columns</title>
2574 <tgroup cols=4>
2575 <thead>
2576 <row>
2577 <entry>Name</entry>
2578 <entry>Type</entry>
2579 <entry>References</entry>
2580 <entry>Description</entry>
2581 </row>
2582 </thead>
2584 <tbody>
2585 <row>
2586 <entry><structfield>indexrelid</structfield></entry>
2587 <entry><type>oid</type></entry>
2588 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2589 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2590 </row>
2592 <row>
2593 <entry><structfield>indrelid</structfield></entry>
2594 <entry><type>oid</type></entry>
2595 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2596 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2597 </row>
2599 <row>
2600 <entry><structfield>indnatts</structfield></entry>
2601 <entry><type>int2</type></entry>
2602 <entry></entry>
2603 <entry>The number of columns in the index (duplicates
2604 <literal>pg_class.relnatts</literal>)</entry>
2605 </row>
2607 <row>
2608 <entry><structfield>indisunique</structfield></entry>
2609 <entry><type>bool</type></entry>
2610 <entry></entry>
2611 <entry>If true, this is a unique index</entry>
2612 </row>
2614 <row>
2615 <entry><structfield>indisprimary</structfield></entry>
2616 <entry><type>bool</type></entry>
2617 <entry></entry>
2618 <entry>If true, this index represents the primary key of the table
2619 (<structfield>indisunique</> should always be true when this is true)</entry>
2620 </row>
2622 <row>
2623 <entry><structfield>indisclustered</structfield></entry>
2624 <entry><type>bool</type></entry>
2625 <entry></entry>
2626 <entry>If true, the table was last clustered on this index</entry>
2627 </row>
2629 <row>
2630 <entry><structfield>indisvalid</structfield></entry>
2631 <entry><type>bool</type></entry>
2632 <entry></entry>
2633 <entry>
2634 If true, the index is currently valid for queries. False means the
2635 index is possibly incomplete: it must still be modified by
2636 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2637 be used for queries. If it is unique, the uniqueness property is not
2638 true either
2639 </entry>
2640 </row>
2642 <row>
2643 <entry><structfield>indcheckxmin</structfield></entry>
2644 <entry><type>bool</type></entry>
2645 <entry></entry>
2646 <entry>
2647 If true, queries must not use the index until the <structfield>xmin</>
2648 of this <structname>pg_index</> row is below their TransactionXmin
2649 event horizon, because the table may contain broken HOT chains with
2650 incompatible rows that they can see
2651 </entry>
2652 </row>
2654 <row>
2655 <entry><structfield>indisready</structfield></entry>
2656 <entry><type>bool</type></entry>
2657 <entry></entry>
2658 <entry>
2659 If true, the index is currently ready for inserts. False means the
2660 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2661 operations
2662 </entry>
2663 </row>
2665 <row>
2666 <entry><structfield>indkey</structfield></entry>
2667 <entry><type>int2vector</type></entry>
2668 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2669 <entry>
2670 This is an array of <structfield>indnatts</structfield> values that
2671 indicate which table columns this index indexes. For example a value
2672 of <literal>1 3</literal> would mean that the first and the third table
2673 columns make up the index key. A zero in this array indicates that the
2674 corresponding index attribute is an expression over the table columns,
2675 rather than a simple column reference
2676 </entry>
2677 </row>
2679 <row>
2680 <entry><structfield>indclass</structfield></entry>
2681 <entry><type>oidvector</type></entry>
2682 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2683 <entry>
2684 For each column in the index key, this contains the OID of
2685 the operator class to use. See
2686 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2687 </entry>
2688 </row>
2690 <row>
2691 <entry><structfield>indoption</structfield></entry>
2692 <entry><type>int2vector</type></entry>
2693 <entry></entry>
2694 <entry>
2695 This is an array of <structfield>indnatts</structfield> values that
2696 store per-column flag bits. The meaning of the bits is defined by
2697 the index's access method
2698 </entry>
2699 </row>
2701 <row>
2702 <entry><structfield>indexprs</structfield></entry>
2703 <entry><type>text</type></entry>
2704 <entry></entry>
2705 <entry>Expression trees (in <function>nodeToString()</function> representation)
2706 for index attributes that are not simple column references. This is a
2707 list with one element for each zero entry in <structfield>indkey</>.
2708 NULL if all index attributes are simple references</entry>
2709 </row>
2711 <row>
2712 <entry><structfield>indpred</structfield></entry>
2713 <entry><type>text</type></entry>
2714 <entry></entry>
2715 <entry>Expression tree (in <function>nodeToString()</function> representation)
2716 for partial index predicate. NULL if not a partial index</entry>
2717 </row>
2718 </tbody>
2719 </tgroup>
2720 </table>
2722 </sect1>
2725 <sect1 id="catalog-pg-inherits">
2726 <title><structname>pg_inherits</structname></title>
2728 <indexterm zone="catalog-pg-inherits">
2729 <primary>pg_inherits</primary>
2730 </indexterm>
2732 <para>
2733 The catalog <structname>pg_inherits</> records information about
2734 table inheritance hierarchies. There is one entry for each direct
2735 child table in the database. (Indirect inheritance can be determined
2736 by following chains of entries.)
2737 </para>
2739 <table>
2740 <title><structname>pg_inherits</> Columns</title>
2742 <tgroup cols=4>
2743 <thead>
2744 <row>
2745 <entry>Name</entry>
2746 <entry>Type</entry>
2747 <entry>References</entry>
2748 <entry>Description</entry>
2749 </row>
2750 </thead>
2752 <tbody>
2753 <row>
2754 <entry><structfield>inhrelid</structfield></entry>
2755 <entry><type>oid</type></entry>
2756 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2757 <entry>
2758 The OID of the child table
2759 </entry>
2760 </row>
2762 <row>
2763 <entry><structfield>inhparent</structfield></entry>
2764 <entry><type>oid</type></entry>
2765 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2766 <entry>
2767 The OID of the parent table
2768 </entry>
2769 </row>
2771 <row>
2772 <entry><structfield>inhseqno</structfield></entry>
2773 <entry><type>int4</type></entry>
2774 <entry></entry>
2775 <entry>
2776 If there is more than one direct parent for a child table (multiple
2777 inheritance), this number tells the order in which the
2778 inherited columns are to be arranged. The count starts at 1
2779 </entry>
2780 </row>
2781 </tbody>
2782 </tgroup>
2783 </table>
2785 </sect1>
2788 <sect1 id="catalog-pg-language">
2789 <title><structname>pg_language</structname></title>
2791 <indexterm zone="catalog-pg-language">
2792 <primary>pg_language</primary>
2793 </indexterm>
2795 <para>
2796 The catalog <structname>pg_language</structname> registers
2797 languages in which you can write functions or stored procedures.
2798 See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
2799 and <xref linkend="xplang"> for more information about language handlers.
2800 </para>
2802 <table>
2803 <title><structname>pg_language</> Columns</title>
2805 <tgroup cols=4>
2806 <thead>
2807 <row>
2808 <entry>Name</entry>
2809 <entry>Type</entry>
2810 <entry>References</entry>
2811 <entry>Description</entry>
2812 </row>
2813 </thead>
2815 <tbody>
2816 <row>
2817 <entry><structfield>lanname</structfield></entry>
2818 <entry><type>name</type></entry>
2819 <entry></entry>
2820 <entry>Name of the language</entry>
2821 </row>
2823 <row>
2824 <entry><structfield>lanowner</structfield></entry>
2825 <entry><type>oid</type></entry>
2826 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2827 <entry>Owner of the language</entry>
2828 </row>
2830 <row>
2831 <entry><structfield>lanispl</structfield></entry>
2832 <entry><type>bool</type></entry>
2833 <entry></entry>
2834 <entry>
2835 This is false for internal languages (such as
2836 <acronym>SQL</acronym>) and true for user-defined languages.
2837 Currently, <application>pg_dump</application> still uses this
2838 to determine which languages need to be dumped, but this might be
2839 replaced by a different mechanism in the future
2840 </entry>
2841 </row>
2843 <row>
2844 <entry><structfield>lanpltrusted</structfield></entry>
2845 <entry><type>bool</type></entry>
2846 <entry></entry>
2847 <entry>
2848 True if this is a trusted language, which means that it is believed
2849 not to grant access to anything outside the normal SQL execution
2850 environment. Only superusers can create functions in untrusted
2851 languages
2852 </entry>
2853 </row>
2855 <row>
2856 <entry><structfield>lanplcallfoid</structfield></entry>
2857 <entry><type>oid</type></entry>
2858 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2859 <entry>
2860 For noninternal languages this references the language
2861 handler, which is a special function that is responsible for
2862 executing all functions that are written in the particular
2863 language
2864 </entry>
2865 </row>
2867 <row>
2868 <entry><structfield>lanvalidator</structfield></entry>
2869 <entry><type>oid</type></entry>
2870 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2871 <entry>
2872 This references a language validator function that is responsible
2873 for checking the syntax and validity of new functions when they
2874 are created. Zero if no validator is provided
2875 </entry>
2876 </row>
2878 <row>
2879 <entry><structfield>lanacl</structfield></entry>
2880 <entry><type>aclitem[]</type></entry>
2881 <entry></entry>
2882 <entry>
2883 Access privileges; see
2884 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2885 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2886 for details
2887 </entry>
2888 </row>
2889 </tbody>
2890 </tgroup>
2891 </table>
2893 </sect1>
2896 <sect1 id="catalog-pg-largeobject">
2897 <title><structname>pg_largeobject</structname></title>
2899 <indexterm zone="catalog-pg-largeobject">
2900 <primary>pg_largeobject</primary>
2901 </indexterm>
2903 <para>
2904 The catalog <structname>pg_largeobject</structname> holds the data making up
2905 <quote>large objects</quote>. A large object is identified by an
2906 OID assigned when it is created. Each large object is broken into
2907 segments or <quote>pages</> small enough to be conveniently stored as rows
2908 in <structname>pg_largeobject</structname>.
2909 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
2910 <literal>BLCKSZ/4</>, or typically 2 kB).
2911 </para>
2913 <table>
2914 <title><structname>pg_largeobject</> Columns</title>
2916 <tgroup cols=3>
2917 <thead>
2918 <row>
2919 <entry>Name</entry>
2920 <entry>Type</entry>
2921 <entry>Description</entry>
2922 </row>
2923 </thead>
2925 <tbody>
2926 <row>
2927 <entry><structfield>loid</structfield></entry>
2928 <entry><type>oid</type></entry>
2929 <entry>Identifier of the large object that includes this page</entry>
2930 </row>
2932 <row>
2933 <entry><structfield>pageno</structfield></entry>
2934 <entry><type>int4</type></entry>
2935 <entry>Page number of this page within its large object
2936 (counting from zero)</entry>
2937 </row>
2939 <row>
2940 <entry><structfield>data</structfield></entry>
2941 <entry><type>bytea</type></entry>
2942 <entry>
2943 Actual data stored in the large object.
2944 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
2945 </entry>
2946 </row>
2947 </tbody>
2948 </tgroup>
2949 </table>
2951 <para>
2952 Each row of <structname>pg_largeobject</structname> holds data
2953 for one page of a large object, beginning at
2954 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
2955 allows sparse storage: pages might be missing, and might be shorter than
2956 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
2957 Missing regions within a large object read as zeroes.
2958 </para>
2960 </sect1>
2963 <sect1 id="catalog-pg-listener">
2964 <title><structname>pg_listener</structname></title>
2966 <indexterm zone="catalog-pg-listener">
2967 <primary>pg_listener</primary>
2968 </indexterm>
2970 <para>
2971 The catalog <structname>pg_listener</structname> supports the
2972 <xref linkend="sql-listen" endterm="sql-listen-title"> and
2973 <xref linkend="sql-notify" endterm="sql-notify-title">
2974 commands. A listener creates an entry in
2975 <structname>pg_listener</structname> for each notification name
2976 it is listening for. A notifier scans <structname>pg_listener</structname>
2977 and updates each matching entry to show that a notification has occurred.
2978 The notifier also sends a signal (using the PID recorded in the table)
2979 to awaken the listener from sleep.
2980 </para>
2982 <table>
2983 <title><structname>pg_listener</> Columns</title>
2985 <tgroup cols=4>
2986 <thead>
2987 <row>
2988 <entry>Name</entry>
2989 <entry>Type</entry>
2990 <entry>References</entry>
2991 <entry>Description</entry>
2992 </row>
2993 </thead>
2995 <tbody>
2996 <row>
2997 <entry><structfield>relname</structfield></entry>
2998 <entry><type>name</type></entry>
2999 <entry>
3000 Notify condition name. (The name need not match any actual
3001 relation in the database; the name <structfield>relname</> is historical.)
3002 </entry>
3003 </row>
3005 <row>
3006 <entry><structfield>listenerpid</structfield></entry>
3007 <entry><type>int4</type></entry>
3008 <entry>PID of the server process that created this entry</entry>
3009 </row>
3011 <row>
3012 <entry><structfield>notification</structfield></entry>
3013 <entry><type>int4</type></entry>
3014 <entry>
3015 Zero if no event is pending for this listener. If an event is
3016 pending, the PID of the server process that sent the notification
3017 </entry>
3018 </row>
3019 </tbody>
3020 </tgroup>
3021 </table>
3023 </sect1>
3026 <sect1 id="catalog-pg-namespace">
3027 <title><structname>pg_namespace</structname></title>
3029 <indexterm zone="catalog-pg-namespace">
3030 <primary>pg_namespace</primary>
3031 </indexterm>
3033 <para>
3034 The catalog <structname>pg_namespace</> stores namespaces.
3035 A namespace is the structure underlying SQL schemas: each namespace
3036 can have a separate collection of relations, types, etc. without name
3037 conflicts.
3038 </para>
3040 <table>
3041 <title><structname>pg_namespace</> Columns</title>
3043 <tgroup cols=4>
3044 <thead>
3045 <row>
3046 <entry>Name</entry>
3047 <entry>Type</entry>
3048 <entry>References</entry>
3049 <entry>Description</entry>
3050 </row>
3051 </thead>
3053 <tbody>
3054 <row>
3055 <entry><structfield>nspname</structfield></entry>
3056 <entry><type>name</type></entry>
3057 <entry></entry>
3058 <entry>Name of the namespace</entry>
3059 </row>
3061 <row>
3062 <entry><structfield>nspowner</structfield></entry>
3063 <entry><type>oid</type></entry>
3064 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3065 <entry>Owner of the namespace</entry>
3066 </row>
3068 <row>
3069 <entry><structfield>nspacl</structfield></entry>
3070 <entry><type>aclitem[]</type></entry>
3071 <entry></entry>
3072 <entry>
3073 Access privileges; see
3074 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3075 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3076 for details
3077 </entry>
3078 </row>
3079 </tbody>
3080 </tgroup>
3081 </table>
3083 </sect1>
3086 <sect1 id="catalog-pg-opclass">
3087 <title><structname>pg_opclass</structname></title>
3089 <indexterm zone="catalog-pg-opclass">
3090 <primary>pg_opclass</primary>
3091 </indexterm>
3093 <para>
3094 The catalog <structname>pg_opclass</structname> defines
3095 index access method operator classes. Each operator class defines
3096 semantics for index columns of a particular data type and a particular
3097 index access method. An operator class essentially specifies that a
3098 particular operator family is applicable to a particular indexable column
3099 data type. The set of operators from the family that are actually usable
3100 with the indexed column are whichever ones accept the column's data type
3101 as their lefthand input.
3102 </para>
3104 <para>
3105 Operator classes are described at length in <xref linkend="xindex">.
3106 </para>
3108 <table>
3109 <title><structname>pg_opclass</> Columns</title>
3111 <tgroup cols=4>
3112 <thead>
3113 <row>
3114 <entry>Name</entry>
3115 <entry>Type</entry>
3116 <entry>References</entry>
3117 <entry>Description</entry>
3118 </row>
3119 </thead>
3120 <tbody>
3122 <row>
3123 <entry><structfield>opcmethod</structfield></entry>
3124 <entry><type>oid</type></entry>
3125 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3126 <entry>Index access method operator class is for</entry>
3127 </row>
3129 <row>
3130 <entry><structfield>opcname</structfield></entry>
3131 <entry><type>name</type></entry>
3132 <entry></entry>
3133 <entry>Name of this operator class</entry>
3134 </row>
3136 <row>
3137 <entry><structfield>opcnamespace</structfield></entry>
3138 <entry><type>oid</type></entry>
3139 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3140 <entry>Namespace of this operator class</entry>
3141 </row>
3143 <row>
3144 <entry><structfield>opcowner</structfield></entry>
3145 <entry><type>oid</type></entry>
3146 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3147 <entry>Owner of the operator class</entry>
3148 </row>
3150 <row>
3151 <entry><structfield>opcfamily</structfield></entry>
3152 <entry><type>oid</type></entry>
3153 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3154 <entry>Operator family containing the operator class</entry>
3155 </row>
3157 <row>
3158 <entry><structfield>opcintype</structfield></entry>
3159 <entry><type>oid</type></entry>
3160 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3161 <entry>Data type that the operator class indexes</entry>
3162 </row>
3164 <row>
3165 <entry><structfield>opcdefault</structfield></entry>
3166 <entry><type>bool</type></entry>
3167 <entry></entry>
3168 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3169 </row>
3171 <row>
3172 <entry><structfield>opckeytype</structfield></entry>
3173 <entry><type>oid</type></entry>
3174 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3175 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3176 </row>
3178 </tbody>
3179 </tgroup>
3180 </table>
3182 <para>
3183 An operator class's <structfield>opcmethod</> must match the
3184 <structname>opfmethod</> of its containing operator family.
3185 Also, there must be no more than one <structname>pg_opclass</structname>
3186 row having <structname>opcdefault</> true for any given combination of
3187 <structname>opcmethod</> and <structname>opcintype</>.
3188 </para>
3190 </sect1>
3193 <sect1 id="catalog-pg-operator">
3194 <title><structname>pg_operator</structname></title>
3196 <indexterm zone="catalog-pg-operator">
3197 <primary>pg_operator</primary>
3198 </indexterm>
3200 <para>
3201 The catalog <structname>pg_operator</> stores information about operators.
3202 See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3203 and <xref linkend="xoper"> for more information.
3204 </para>
3206 <table>
3207 <title><structname>pg_operator</> Columns</title>
3209 <tgroup cols=4>
3210 <thead>
3211 <row>
3212 <entry>Name</entry>
3213 <entry>Type</entry>
3214 <entry>References</entry>
3215 <entry>Description</entry>
3216 </row>
3217 </thead>
3219 <tbody>
3220 <row>
3221 <entry><structfield>oprname</structfield></entry>
3222 <entry><type>name</type></entry>
3223 <entry></entry>
3224 <entry>Name of the operator</entry>
3225 </row>
3227 <row>
3228 <entry><structfield>oprnamespace</structfield></entry>
3229 <entry><type>oid</type></entry>
3230 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3231 <entry>
3232 The OID of the namespace that contains this operator
3233 </entry>
3234 </row>
3236 <row>
3237 <entry><structfield>oprowner</structfield></entry>
3238 <entry><type>oid</type></entry>
3239 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3240 <entry>Owner of the operator</entry>
3241 </row>
3243 <row>
3244 <entry><structfield>oprkind</structfield></entry>
3245 <entry><type>char</type></entry>
3246 <entry></entry>
3247 <entry>
3248 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3249 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3250 </entry>
3251 </row>
3253 <row>
3254 <entry><structfield>oprcanmerge</structfield></entry>
3255 <entry><type>bool</type></entry>
3256 <entry></entry>
3257 <entry>This operator supports merge joins</entry>
3258 </row>
3260 <row>
3261 <entry><structfield>oprcanhash</structfield></entry>
3262 <entry><type>bool</type></entry>
3263 <entry></entry>
3264 <entry>This operator supports hash joins</entry>
3265 </row>
3267 <row>
3268 <entry><structfield>oprleft</structfield></entry>
3269 <entry><type>oid</type></entry>
3270 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3271 <entry>Type of the left operand</entry>
3272 </row>
3274 <row>
3275 <entry><structfield>oprright</structfield></entry>
3276 <entry><type>oid</type></entry>
3277 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3278 <entry>Type of the right operand</entry>
3279 </row>
3281 <row>
3282 <entry><structfield>oprresult</structfield></entry>
3283 <entry><type>oid</type></entry>
3284 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3285 <entry>Type of the result</entry>
3286 </row>
3288 <row>
3289 <entry><structfield>oprcom</structfield></entry>
3290 <entry><type>oid</type></entry>
3291 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3292 <entry>Commutator of this operator, if any</entry>
3293 </row>
3295 <row>
3296 <entry><structfield>oprnegate</structfield></entry>
3297 <entry><type>oid</type></entry>
3298 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3299 <entry>Negator of this operator, if any</entry>
3300 </row>
3302 <row>
3303 <entry><structfield>oprcode</structfield></entry>
3304 <entry><type>regproc</type></entry>
3305 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3306 <entry>Function that implements this operator</entry>
3307 </row>
3309 <row>
3310 <entry><structfield>oprrest</structfield></entry>
3311 <entry><type>regproc</type></entry>
3312 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3313 <entry>Restriction selectivity estimation function for this operator</entry>
3314 </row>
3316 <row>
3317 <entry><structfield>oprjoin</structfield></entry>
3318 <entry><type>regproc</type></entry>
3319 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3320 <entry>Join selectivity estimation function for this operator</entry>
3321 </row>
3322 </tbody>
3323 </tgroup>
3324 </table>
3326 <para>
3327 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3328 is zero for a prefix operator.
3329 </para>
3331 </sect1>
3334 <sect1 id="catalog-pg-opfamily">
3335 <title><structname>pg_opfamily</structname></title>
3337 <indexterm zone="catalog-pg-opfamily">
3338 <primary>pg_opfamily</primary>
3339 </indexterm>
3341 <para>
3342 The catalog <structname>pg_opfamily</structname> defines operator families.
3343 Each operator family is a collection of operators and associated
3344 support routines that implement the semantics specified for a particular
3345 index access method. Furthermore, the operators in a family are all
3346 <quote>compatible</>, in a way that is specified by the access method.
3347 The operator family concept allows cross-data-type operators to be used
3348 with indexes and to be reasoned about using knowledge of access method
3349 semantics.
3350 </para>
3352 <para>
3353 Operator families are described at length in <xref linkend="xindex">.
3354 </para>
3356 <table>
3357 <title><structname>pg_opfamily</> Columns</title>
3359 <tgroup cols=4>
3360 <thead>
3361 <row>
3362 <entry>Name</entry>
3363 <entry>Type</entry>
3364 <entry>References</entry>
3365 <entry>Description</entry>
3366 </row>
3367 </thead>
3368 <tbody>
3370 <row>
3371 <entry><structfield>opfmethod</structfield></entry>
3372 <entry><type>oid</type></entry>
3373 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3374 <entry>Index access method operator family is for</entry>
3375 </row>
3377 <row>
3378 <entry><structfield>opfname</structfield></entry>
3379 <entry><type>name</type></entry>
3380 <entry></entry>
3381 <entry>Name of this operator family</entry>
3382 </row>
3384 <row>
3385 <entry><structfield>opfnamespace</structfield></entry>
3386 <entry><type>oid</type></entry>
3387 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3388 <entry>Namespace of this operator family</entry>
3389 </row>
3391 <row>
3392 <entry><structfield>opfowner</structfield></entry>
3393 <entry><type>oid</type></entry>
3394 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3395 <entry>Owner of the operator family</entry>
3396 </row>
3398 </tbody>
3399 </tgroup>
3400 </table>
3402 <para>
3403 The majority of the information defining an operator family is not in its
3404 <structname>pg_opfamily</structname> row, but in the associated rows in
3405 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3406 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3408 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3409 </para>
3411 </sect1>
3414 <sect1 id="catalog-pg-pltemplate">
3415 <title><structname>pg_pltemplate</structname></title>
3417 <indexterm zone="catalog-pg-pltemplate">
3418 <primary>pg_pltemplate</primary>
3419 </indexterm>
3421 <para>
3422 The catalog <structname>pg_pltemplate</structname> stores
3423 <quote>template</> information for procedural languages.
3424 A template for a language allows the language to be created in a
3425 particular database by a simple <command>CREATE LANGUAGE</> command,
3426 with no need to specify implementation details.
3427 </para>
3429 <para>
3430 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3431 is shared across all databases of a cluster: there is only one
3432 copy of <structname>pg_pltemplate</structname> per cluster, not
3433 one per database. This allows the information to be accessible in
3434 each database as it is needed.
3435 </para>
3437 <table>
3438 <title><structname>pg_pltemplate</> Columns</title>
3440 <tgroup cols=3>
3441 <thead>
3442 <row>
3443 <entry>Name</entry>
3444 <entry>Type</entry>
3445 <entry>Description</entry>
3446 </row>
3447 </thead>
3449 <tbody>
3450 <row>
3451 <entry><structfield>tmplname</structfield></entry>
3452 <entry><type>name</type></entry>
3453 <entry>Name of the language this template is for</entry>
3454 </row>
3456 <row>
3457 <entry><structfield>tmpltrusted</structfield></entry>
3458 <entry><type>boolean</type></entry>
3459 <entry>True if language is considered trusted</entry>
3460 </row>
3462 <row>
3463 <entry><structfield>tmpldbacreate</structfield></entry>
3464 <entry><type>boolean</type></entry>
3465 <entry>True if language may be created by a database owner</entry>
3466 </row>
3468 <row>
3469 <entry><structfield>tmplhandler</structfield></entry>
3470 <entry><type>text</type></entry>
3471 <entry>Name of call handler function</entry>
3472 </row>
3474 <row>
3475 <entry><structfield>tmplvalidator</structfield></entry>
3476 <entry><type>text</type></entry>
3477 <entry>Name of validator function, or NULL if none</entry>
3478 </row>
3480 <row>
3481 <entry><structfield>tmpllibrary</structfield></entry>
3482 <entry><type>text</type></entry>
3483 <entry>Path of shared library that implements language</entry>
3484 </row>
3486 <row>
3487 <entry><structfield>tmplacl</structfield></entry>
3488 <entry><type>aclitem[]</type></entry>
3489 <entry>Access privileges for template (not yet used)</entry>
3490 </row>
3492 </tbody>
3493 </tgroup>
3494 </table>
3496 <para>
3497 There are not currently any commands that manipulate procedural language
3498 templates; to change the built-in information, a superuser must modify
3499 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3500 or <command>UPDATE</command> commands. It is likely that a future
3501 release of <productname>PostgreSQL</productname> will offer
3502 commands to change the entries in a cleaner fashion.
3503 </para>
3505 <para>
3506 When implemented, the <structfield>tmplacl</structfield> field will provide
3507 access control for the template itself (i.e., the right to create a
3508 language using it), not for the languages created from the template.
3509 </para>
3511 </sect1>
3514 <sect1 id="catalog-pg-proc">
3515 <title><structname>pg_proc</structname></title>
3517 <indexterm zone="catalog-pg-proc">
3518 <primary>pg_proc</primary>
3519 </indexterm>
3521 <para>
3522 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3523 See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3524 and <xref linkend="xfunc"> for more information.
3525 </para>
3527 <para>
3528 The table contains data for aggregate functions as well as plain functions.
3529 If <structfield>proisagg</structfield> is true, there should be a matching
3530 row in <structfield>pg_aggregate</structfield>.
3531 </para>
3533 <table>
3534 <title><structname>pg_proc</> Columns</title>
3536 <tgroup cols=4>
3537 <thead>
3538 <row>
3539 <entry>Name</entry>
3540 <entry>Type</entry>
3541 <entry>References</entry>
3542 <entry>Description</entry>
3543 </row>
3544 </thead>
3546 <tbody>
3547 <row>
3548 <entry><structfield>proname</structfield></entry>
3549 <entry><type>name</type></entry>
3550 <entry></entry>
3551 <entry>Name of the function</entry>
3552 </row>
3554 <row>
3555 <entry><structfield>pronamespace</structfield></entry>
3556 <entry><type>oid</type></entry>
3557 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3558 <entry>
3559 The OID of the namespace that contains this function
3560 </entry>
3561 </row>
3563 <row>
3564 <entry><structfield>proowner</structfield></entry>
3565 <entry><type>oid</type></entry>
3566 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3567 <entry>Owner of the function</entry>
3568 </row>
3570 <row>
3571 <entry><structfield>prolang</structfield></entry>
3572 <entry><type>oid</type></entry>
3573 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3574 <entry>Implementation language or call interface of this function</entry>
3575 </row>
3577 <row>
3578 <entry><structfield>procost</structfield></entry>
3579 <entry><type>float4</type></entry>
3580 <entry></entry>
3581 <entry>Estimated execution cost (in units of
3582 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3583 this is cost per row returned</entry>
3584 </row>
3586 <row>
3587 <entry><structfield>prorows</structfield></entry>
3588 <entry><type>float4</type></entry>
3589 <entry></entry>
3590 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3591 </row>
3593 <row>
3594 <entry><structfield>provariadic</structfield></entry>
3595 <entry><type>oid</type></entry>
3596 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3597 <entry>Data type of the variadic array parameter's elements,
3598 or zero if the function does not have a variadic parameter</entry>
3599 </row>
3601 <row>
3602 <entry><structfield>proisagg</structfield></entry>
3603 <entry><type>bool</type></entry>
3604 <entry></entry>
3605 <entry>Function is an aggregate function</entry>
3606 </row>
3608 <row>
3609 <entry><structfield>prosecdef</structfield></entry>
3610 <entry><type>bool</type></entry>
3611 <entry></entry>
3612 <entry>Function is a security definer (i.e., a <quote>setuid</>
3613 function)</entry>
3614 </row>
3616 <row>
3617 <entry><structfield>proisstrict</structfield></entry>
3618 <entry><type>bool</type></entry>
3619 <entry></entry>
3620 <entry>
3621 Function returns null if any call argument is null. In that
3622 case the function won't actually be called at all. Functions
3623 that are not <quote>strict</quote> must be prepared to handle
3624 null inputs
3625 </entry>
3626 </row>
3628 <row>
3629 <entry><structfield>proretset</structfield></entry>
3630 <entry><type>bool</type></entry>
3631 <entry></entry>
3632 <entry>Function returns a set (i.e., multiple values of the specified
3633 data type)</entry>
3634 </row>
3636 <row>
3637 <entry><structfield>provolatile</structfield></entry>
3638 <entry><type>char</type></entry>
3639 <entry></entry>
3640 <entry>
3641 <structfield>provolatile</structfield> tells whether the function's
3642 result depends only on its input arguments, or is affected by outside
3643 factors.
3644 It is <literal>i</literal> for <quote>immutable</> functions,
3645 which always deliver the same result for the same inputs.
3646 It is <literal>s</literal> for <quote>stable</> functions,
3647 whose results (for fixed inputs) do not change within a scan.
3648 It is <literal>v</literal> for <quote>volatile</> functions,
3649 whose results might change at any time. (Use <literal>v</literal> also
3650 for functions with side-effects, so that calls to them cannot get
3651 optimized away.)
3652 </entry>
3653 </row>
3655 <row>
3656 <entry><structfield>pronargs</structfield></entry>
3657 <entry><type>int2</type></entry>
3658 <entry></entry>
3659 <entry>Number of arguments</entry>
3660 </row>
3662 <row>
3663 <entry><structfield>prorettype</structfield></entry>
3664 <entry><type>oid</type></entry>
3665 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3666 <entry>Data type of the return value</entry>
3667 </row>
3669 <row>
3670 <entry><structfield>proargtypes</structfield></entry>
3671 <entry><type>oidvector</type></entry>
3672 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3673 <entry>
3674 An array with the data types of the function arguments. This includes
3675 only input arguments (including <literal>INOUT</literal> and
3676 <literal>VARIADIC</> arguments), and thus represents
3677 the call signature of the function
3678 </entry>
3679 </row>
3681 <row>
3682 <entry><structfield>proallargtypes</structfield></entry>
3683 <entry><type>oid[]</type></entry>
3684 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3685 <entry>
3686 An array with the data types of the function arguments. This includes
3687 all arguments (including <literal>OUT</literal> and
3688 <literal>INOUT</literal> arguments); however, if all the
3689 arguments are <literal>IN</literal> arguments, this field will be null.
3690 Note that subscripting is 1-based, whereas for historical reasons
3691 <structfield>proargtypes</> is subscripted from 0
3692 </entry>
3693 </row>
3695 <row>
3696 <entry><structfield>proargmodes</structfield></entry>
3697 <entry><type>char[]</type></entry>
3698 <entry></entry>
3699 <entry>
3700 An array with the modes of the function arguments, encoded as
3701 <literal>i</literal> for <literal>IN</> arguments,
3702 <literal>o</literal> for <literal>OUT</> arguments,
3703 <literal>b</literal> for <literal>INOUT</> arguments,
3704 <literal>v</literal> for <literal>VARIADIC</> arguments,
3705 <literal>t</literal> for <literal>TABLE</> arguments.
3706 If all the arguments are <literal>IN</literal> arguments,
3707 this field will be null.
3708 Note that subscripts correspond to positions of
3709 <structfield>proallargtypes</> not <structfield>proargtypes</>
3710 </entry>
3711 </row>
3713 <row>
3714 <entry><structfield>proargnames</structfield></entry>
3715 <entry><type>text[]</type></entry>
3716 <entry></entry>
3717 <entry>
3718 An array with the names of the function arguments.
3719 Arguments without a name are set to empty strings in the array.
3720 If none of the arguments have a name, this field will be null.
3721 Note that subscripts correspond to positions of
3722 <structfield>proallargtypes</> not <structfield>proargtypes</>
3723 </entry>
3724 </row>
3726 <row>
3727 <entry><structfield>prosrc</structfield></entry>
3728 <entry><type>text</type></entry>
3729 <entry></entry>
3730 <entry>
3731 This tells the function handler how to invoke the function. It
3732 might be the actual source code of the function for interpreted
3733 languages, a link symbol, a file name, or just about anything
3734 else, depending on the implementation language/call convention
3735 </entry>
3736 </row>
3738 <row>
3739 <entry><structfield>probin</structfield></entry>
3740 <entry><type>bytea</type></entry>
3741 <entry></entry>
3742 <entry>
3743 Additional information about how to invoke the function.
3744 Again, the interpretation is language-specific
3745 </entry>
3746 </row>
3748 <row>
3749 <entry><structfield>proconfig</structfield></entry>
3750 <entry><type>text[]</type></entry>
3751 <entry></entry>
3752 <entry>Function's local settings for run-time configuration variables</entry>
3753 </row>
3755 <row>
3756 <entry><structfield>proacl</structfield></entry>
3757 <entry><type>aclitem[]</type></entry>
3758 <entry></entry>
3759 <entry>
3760 Access privileges; see
3761 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3762 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3763 for details
3764 </entry>
3765 </row>
3766 </tbody>
3767 </tgroup>
3768 </table>
3770 <para>
3771 For compiled functions, both built-in and dynamically loaded,
3772 <structfield>prosrc</structfield> contains the function's C-language
3773 name (link symbol). For all other currently-known language types,
3774 <structfield>prosrc</structfield> contains the function's source
3775 text. <structfield>probin</structfield> is unused except for
3776 dynamically-loaded C functions, for which it gives the name of the
3777 shared library file containing the function.
3778 </para>
3780 </sect1>
3782 <sect1 id="catalog-pg-rewrite">
3783 <title><structname>pg_rewrite</structname></title>
3785 <indexterm zone="catalog-pg-rewrite">
3786 <primary>pg_rewrite</primary>
3787 </indexterm>
3789 <para>
3790 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
3791 </para>
3793 <table>
3794 <title><structname>pg_rewrite</> Columns</title>
3796 <tgroup cols=4>
3797 <thead>
3798 <row>
3799 <entry>Name</entry>
3800 <entry>Type</entry>
3801 <entry>References</entry>
3802 <entry>Description</entry>
3803 </row>
3804 </thead>
3806 <tbody>
3807 <row>
3808 <entry><structfield>rulename</structfield></entry>
3809 <entry><type>name</type></entry>
3810 <entry></entry>
3811 <entry>Rule name</entry>
3812 </row>
3814 <row>
3815 <entry><structfield>ev_class</structfield></entry>
3816 <entry><type>oid</type></entry>
3817 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3818 <entry>The table this rule is for</entry>
3819 </row>
3821 <row>
3822 <entry><structfield>ev_attr</structfield></entry>
3823 <entry><type>int2</type></entry>
3824 <entry></entry>
3825 <entry>The column this rule is for (currently, always zero to
3826 indicate the whole table)</entry>
3827 </row>
3829 <row>
3830 <entry><structfield>ev_type</structfield></entry>
3831 <entry><type>char</type></entry>
3832 <entry></entry>
3833 <entry>
3834 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
3835 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
3836 <command>DELETE</>
3837 </entry>
3838 </row>
3840 <row>
3841 <entry><structfield>ev_enabled</structfield></entry>
3842 <entry><type>char</type></entry>
3843 <entry></entry>
3844 <entry>
3845 Controls in which <xref linkend="guc-session-replication-role"> modes
3846 the rule fires.
3847 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
3848 <literal>D</> = rule is disabled,
3849 <literal>R</> = rule fires in <quote>replica</> mode,
3850 <literal>A</> = rule fires always.
3851 </entry>
3852 </row>
3854 <row>
3855 <entry><structfield>is_instead</structfield></entry>
3856 <entry><type>bool</type></entry>
3857 <entry></entry>
3858 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
3859 </row>
3861 <row>
3862 <entry><structfield>ev_qual</structfield></entry>
3863 <entry><type>text</type></entry>
3864 <entry></entry>
3865 <entry>
3866 Expression tree (in the form of a
3867 <function>nodeToString()</function> representation) for the
3868 rule's qualifying condition
3869 </entry>
3870 </row>
3872 <row>
3873 <entry><structfield>ev_action</structfield></entry>
3874 <entry><type>text</type></entry>
3875 <entry></entry>
3876 <entry>
3877 Query tree (in the form of a
3878 <function>nodeToString()</function> representation) for the
3879 rule's action
3880 </entry>
3881 </row>
3882 </tbody>
3883 </tgroup>
3884 </table>
3886 <note>
3887 <para>
3888 <literal>pg_class.relhasrules</literal>
3889 must be true if a table has any rules in this catalog.
3890 </para>
3891 </note>
3893 </sect1>
3896 <sect1 id="catalog-pg-shdepend">
3897 <title><structname>pg_shdepend</structname></title>
3899 <indexterm zone="catalog-pg-shdepend">
3900 <primary>pg_shdepend</primary>
3901 </indexterm>
3903 <para>
3904 The catalog <structname>pg_shdepend</structname> records the
3905 dependency relationships between database objects and shared objects,
3906 such as roles. This information allows
3907 <productname>PostgreSQL</productname> to ensure that those objects are
3908 unreferenced before attempting to delete them.
3909 </para>
3911 <para>
3912 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
3913 which performs a similar function for dependencies involving objects
3914 within a single database.
3915 </para>
3917 <para>
3918 Unlike most system catalogs, <structname>pg_shdepend</structname>
3919 is shared across all databases of a cluster: there is only one
3920 copy of <structname>pg_shdepend</structname> per cluster, not
3921 one per database.
3922 </para>
3924 <table>
3925 <title><structname>pg_shdepend</> Columns</title>
3927 <tgroup cols=4>
3928 <thead>
3929 <row>
3930 <entry>Name</entry>
3931 <entry>Type</entry>
3932 <entry>References</entry>
3933 <entry>Description</entry>
3934 </row>
3935 </thead>
3937 <tbody>
3938 <row>
3939 <entry><structfield>dbid</structfield></entry>
3940 <entry><type>oid</type></entry>
3941 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
3942 <entry>The OID of the database the dependent object is in,
3943 or zero for a shared object</entry>
3944 </row>
3946 <row>
3947 <entry><structfield>classid</structfield></entry>
3948 <entry><type>oid</type></entry>
3949 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3950 <entry>The OID of the system catalog the dependent object is in</entry>
3951 </row>
3953 <row>
3954 <entry><structfield>objid</structfield></entry>
3955 <entry><type>oid</type></entry>
3956 <entry>any OID column</entry>
3957 <entry>The OID of the specific dependent object</entry>
3958 </row>
3960 <row>
3961 <entry><structfield>refclassid</structfield></entry>
3962 <entry><type>oid</type></entry>
3963 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3964 <entry>The OID of the system catalog the referenced object is in
3965 (must be a shared catalog)</entry>
3966 </row>
3968 <row>
3969 <entry><structfield>refobjid</structfield></entry>
3970 <entry><type>oid</type></entry>
3971 <entry>any OID column</entry>
3972 <entry>The OID of the specific referenced object</entry>
3973 </row>
3975 <row>
3976 <entry><structfield>deptype</structfield></entry>
3977 <entry><type>char</type></entry>
3978 <entry></entry>
3979 <entry>
3980 A code defining the specific semantics of this dependency relationship; see text
3981 </entry>
3982 </row>
3984 </tbody>
3985 </tgroup>
3986 </table>
3988 <para>
3989 In all cases, a <structname>pg_shdepend</structname> entry indicates that
3990 the referenced object cannot be dropped without also dropping the dependent
3991 object. However, there are several subflavors identified by
3992 <structfield>deptype</>:
3994 <variablelist>
3995 <varlistentry>
3996 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
3997 <listitem>
3998 <para>
3999 The referenced object (which must be a role) is the owner of the
4000 dependent object.
4001 </para>
4002 </listitem>
4003 </varlistentry>
4005 <varlistentry>
4006 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4007 <listitem>
4008 <para>
4009 The referenced object (which must be a role) is mentioned in the
4010 ACL (access control list, i.e., privileges list) of the
4011 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4012 not made for the owner of the object, since the owner will have
4013 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4014 </para>
4015 </listitem>
4016 </varlistentry>
4018 <varlistentry>
4019 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4020 <listitem>
4021 <para>
4022 There is no dependent object; this type of entry is a signal
4023 that the system itself depends on the referenced object, and so
4024 that object must never be deleted. Entries of this type are
4025 created only by <command>initdb</command>. The columns for the
4026 dependent object contain zeroes.
4027 </para>
4028 </listitem>
4029 </varlistentry>
4030 </variablelist>
4032 Other dependency flavors might be needed in future. Note in particular
4033 that the current definition only supports roles as referenced objects.
4034 </para>
4036 </sect1>
4038 <sect1 id="catalog-pg-shdescription">
4039 <title><structname>pg_shdescription</structname></title>
4041 <indexterm zone="catalog-pg-shdescription">
4042 <primary>pg_shdescription</primary>
4043 </indexterm>
4045 <para>
4046 The catalog <structname>pg_shdescription</structname> stores optional
4047 descriptions (comments) for shared database objects. Descriptions can be
4048 manipulated with the <xref linkend="sql-comment"
4049 endterm="sql-comment-title"> command and viewed with
4050 <application>psql</application>'s <literal>\d</literal> commands.
4051 </para>
4053 <para>
4054 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4055 which performs a similar function for descriptions involving objects
4056 within a single database.
4057 </para>
4059 <para>
4060 Unlike most system catalogs, <structname>pg_shdescription</structname>
4061 is shared across all databases of a cluster: there is only one
4062 copy of <structname>pg_shdescription</structname> per cluster, not
4063 one per database.
4064 </para>
4066 <table>
4067 <title><structname>pg_shdescription</> Columns</title>
4069 <tgroup cols=4>
4070 <thead>
4071 <row>
4072 <entry>Name</entry>
4073 <entry>Type</entry>
4074 <entry>References</entry>
4075 <entry>Description</entry>
4076 </row>
4077 </thead>
4079 <tbody>
4080 <row>
4081 <entry><structfield>objoid</structfield></entry>
4082 <entry><type>oid</type></entry>
4083 <entry>any OID column</entry>
4084 <entry>The OID of the object this description pertains to</entry>
4085 </row>
4087 <row>
4088 <entry><structfield>classoid</structfield></entry>
4089 <entry><type>oid</type></entry>
4090 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4091 <entry>The OID of the system catalog this object appears in</entry>
4092 </row>
4094 <row>
4095 <entry><structfield>description</structfield></entry>
4096 <entry><type>text</type></entry>
4097 <entry></entry>
4098 <entry>Arbitrary text that serves as the description of this object</entry>
4099 </row>
4100 </tbody>
4101 </tgroup>
4102 </table>
4104 </sect1>
4107 <sect1 id="catalog-pg-statistic">
4108 <title><structname>pg_statistic</structname></title>
4110 <indexterm zone="catalog-pg-statistic">
4111 <primary>pg_statistic</primary>
4112 </indexterm>
4114 <para>
4115 The catalog <structname>pg_statistic</structname> stores
4116 statistical data about the contents of the database. Entries are
4117 created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4118 and subsequently used by the query planner. There is one entry for
4119 each table column that has been analyzed. Note that all the
4120 statistical data is inherently approximate, even assuming that it
4121 is up-to-date.
4122 </para>
4124 <para>
4125 <structname>pg_statistic</structname> also stores statistical data about
4126 the values of index expressions. These are described as if they were
4127 actual data columns; in particular, <structfield>starelid</structfield>
4128 references the index. No entry is made for an ordinary non-expression
4129 index column, however, since it would be redundant with the entry
4130 for the underlying table column.
4131 </para>
4133 <para>
4134 Since different kinds of statistics might be appropriate for different
4135 kinds of data, <structname>pg_statistic</structname> is designed not
4136 to assume very much about what sort of statistics it stores. Only
4137 extremely general statistics (such as nullness) are given dedicated
4138 columns in <structname>pg_statistic</structname>. Everything else
4139 is stored in <quote>slots</quote>, which are groups of associated columns
4140 whose content is identified by a code number in one of the slot's columns.
4141 For more information see
4142 <filename>src/include/catalog/pg_statistic.h</filename>.
4143 </para>
4145 <para>
4146 <structname>pg_statistic</structname> should not be readable by the
4147 public, since even statistical information about a table's contents
4148 might be considered sensitive. (Example: minimum and maximum values
4149 of a salary column might be quite interesting.)
4150 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4151 is a publicly readable view on
4152 <structname>pg_statistic</structname> that only exposes information
4153 about those tables that are readable by the current user.
4154 </para>
4156 <table>
4157 <title><structname>pg_statistic</> Columns</title>
4159 <tgroup cols=4>
4160 <thead>
4161 <row>
4162 <entry>Name</entry>
4163 <entry>Type</entry>
4164 <entry>References</entry>
4165 <entry>Description</entry>
4166 </row>
4167 </thead>
4169 <tbody>
4170 <row>
4171 <entry><structfield>starelid</structfield></entry>
4172 <entry><type>oid</type></entry>
4173 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4174 <entry>The table or index that the described column belongs to</entry>
4175 </row>
4177 <row>
4178 <entry><structfield>staattnum</structfield></entry>
4179 <entry><type>int2</type></entry>
4180 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4181 <entry>The number of the described column</entry>
4182 </row>
4184 <row>
4185 <entry><structfield>stanullfrac</structfield></entry>
4186 <entry><type>float4</type></entry>
4187 <entry></entry>
4188 <entry>The fraction of the column's entries that are null</entry>
4189 </row>
4191 <row>
4192 <entry><structfield>stawidth</structfield></entry>
4193 <entry><type>int4</type></entry>
4194 <entry></entry>
4195 <entry>The average stored width, in bytes, of nonnull entries</entry>
4196 </row>
4198 <row>
4199 <entry><structfield>stadistinct</structfield></entry>
4200 <entry><type>float4</type></entry>
4201 <entry></entry>
4202 <entry>The number of distinct nonnull data values in the column.
4203 A value greater than zero is the actual number of distinct values.
4204 A value less than zero is the negative of a fraction of the number
4205 of rows in the table (for example, a column in which values appear about
4206 twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4207 A zero value means the number of distinct values is unknown
4208 </entry>
4209 </row>
4211 <row>
4212 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4213 <entry><type>int2</type></entry>
4214 <entry></entry>
4215 <entry>
4216 A code number indicating the kind of statistics stored in the
4217 <replaceable>N</>th <quote>slot</quote> of the
4218 <structname>pg_statistic</structname> row
4219 </entry>
4220 </row>
4222 <row>
4223 <entry><structfield>staop<replaceable>N</></structfield></entry>
4224 <entry><type>oid</type></entry>
4225 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4226 <entry>
4227 An operator used to derive the statistics stored in the
4228 <replaceable>N</>th <quote>slot</quote>. For example, a
4229 histogram slot would show the <literal>&lt;</literal> operator
4230 that defines the sort order of the data
4231 </entry>
4232 </row>
4234 <row>
4235 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4236 <entry><type>float4[]</type></entry>
4237 <entry></entry>
4238 <entry>
4239 Numerical statistics of the appropriate kind for the
4240 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4241 kind does not involve numerical values
4242 </entry>
4243 </row>
4245 <row>
4246 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4247 <entry><type>anyarray</type></entry>
4248 <entry></entry>
4249 <entry>
4250 Column data values of the appropriate kind for the
4251 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4252 kind does not store any data values. Each array's element
4253 values are actually of the specific column's data type, so there
4254 is no way to define these columns' type more specifically than
4255 <type>anyarray</>
4256 </entry>
4257 </row>
4258 </tbody>
4259 </tgroup>
4260 </table>
4262 </sect1>
4265 <sect1 id="catalog-pg-tablespace">
4266 <title><structname>pg_tablespace</structname></title>
4268 <indexterm zone="catalog-pg-tablespace">
4269 <primary>pg_tablespace</primary>
4270 </indexterm>
4272 <para>
4273 The catalog <structname>pg_tablespace</structname> stores information
4274 about the available tablespaces. Tables can be placed in particular
4275 tablespaces to aid administration of disk layout.
4276 </para>
4278 <para>
4279 Unlike most system catalogs, <structname>pg_tablespace</structname>
4280 is shared across all databases of a cluster: there is only one
4281 copy of <structname>pg_tablespace</structname> per cluster, not
4282 one per database.
4283 </para>
4285 <table>
4286 <title><structname>pg_tablespace</> Columns</title>
4288 <tgroup cols=4>
4289 <thead>
4290 <row>
4291 <entry>Name</entry>
4292 <entry>Type</entry>
4293 <entry>References</entry>
4294 <entry>Description</entry>
4295 </row>
4296 </thead>
4298 <tbody>
4299 <row>
4300 <entry><structfield>spcname</structfield></entry>
4301 <entry><type>name</type></entry>
4302 <entry></entry>
4303 <entry>Tablespace name</entry>
4304 </row>
4306 <row>
4307 <entry><structfield>spcowner</structfield></entry>
4308 <entry><type>oid</type></entry>
4309 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4310 <entry>Owner of the tablespace, usually the user who created it</entry>
4311 </row>
4313 <row>
4314 <entry><structfield>spclocation</structfield></entry>
4315 <entry><type>text</type></entry>
4316 <entry></entry>
4317 <entry>Location (directory path) of the tablespace</entry>
4318 </row>
4320 <row>
4321 <entry><structfield>spcacl</structfield></entry>
4322 <entry><type>aclitem[]</type></entry>
4323 <entry></entry>
4324 <entry>
4325 Access privileges; see
4326 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4327 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4328 for details
4329 </entry>
4330 </row>
4331 </tbody>
4332 </tgroup>
4333 </table>
4334 </sect1>
4337 <sect1 id="catalog-pg-trigger">
4338 <title><structname>pg_trigger</structname></title>
4340 <indexterm zone="catalog-pg-trigger">
4341 <primary>pg_trigger</primary>
4342 </indexterm>
4344 <para>
4345 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4346 See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4347 for more information.
4348 </para>
4350 <table>
4351 <title><structname>pg_trigger</> Columns</title>
4353 <tgroup cols=4>
4354 <thead>
4355 <row>
4356 <entry>Name</entry>
4357 <entry>Type</entry>
4358 <entry>References</entry>
4359 <entry>Description</entry>
4360 </row>
4361 </thead>
4363 <tbody>
4364 <row>
4365 <entry><structfield>tgrelid</structfield></entry>
4366 <entry><type>oid</type></entry>
4367 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4368 <entry>The table this trigger is on</entry>
4369 </row>
4371 <row>
4372 <entry><structfield>tgname</structfield></entry>
4373 <entry><type>name</type></entry>
4374 <entry></entry>
4375 <entry>Trigger name (must be unique among triggers of same table)</entry>
4376 </row>
4378 <row>
4379 <entry><structfield>tgfoid</structfield></entry>
4380 <entry><type>oid</type></entry>
4381 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4382 <entry>The function to be called</entry>
4383 </row>
4385 <row>
4386 <entry><structfield>tgtype</structfield></entry>
4387 <entry><type>int2</type></entry>
4388 <entry></entry>
4389 <entry>Bit mask identifying trigger conditions</entry>
4390 </row>
4392 <row>
4393 <entry><structfield>tgenabled</structfield></entry>
4394 <entry><type>char</type></entry>
4395 <entry></entry>
4396 <entry>
4397 Controls in which <xref linkend="guc-session-replication-role"> modes
4398 the trigger fires.
4399 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4400 <literal>D</> = trigger is disabled,
4401 <literal>R</> = trigger fires in <quote>replica</> mode,
4402 <literal>A</> = trigger fires always.
4403 </entry>
4404 </row>
4406 <row>
4407 <entry><structfield>tgisconstraint</structfield></entry>
4408 <entry><type>bool</type></entry>
4409 <entry></entry>
4410 <entry>True if trigger is a <quote>constraint trigger</></entry>
4411 </row>
4413 <row>
4414 <entry><structfield>tgconstrname</structfield></entry>
4415 <entry><type>name</type></entry>
4416 <entry></entry>
4417 <entry>Constraint name, if a constraint trigger</entry>
4418 </row>
4420 <row>
4421 <entry><structfield>tgconstrrelid</structfield></entry>
4422 <entry><type>oid</type></entry>
4423 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4424 <entry>The table referenced by a referential integrity constraint</entry>
4425 </row>
4427 <row>
4428 <entry><structfield>tgconstraint</structfield></entry>
4429 <entry><type>oid</type></entry>
4430 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4431 <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4432 </row>
4434 <row>
4435 <entry><structfield>tgdeferrable</structfield></entry>
4436 <entry><type>bool</type></entry>
4437 <entry></entry>
4438 <entry>True if constraint trigger is deferrable</entry>
4439 </row>
4441 <row>
4442 <entry><structfield>tginitdeferred</structfield></entry>
4443 <entry><type>bool</type></entry>
4444 <entry></entry>
4445 <entry>True if constraint trigger is initially deferred</entry>
4446 </row>
4448 <row>
4449 <entry><structfield>tgnargs</structfield></entry>
4450 <entry><type>int2</type></entry>
4451 <entry></entry>
4452 <entry>Number of argument strings passed to trigger function</entry>
4453 </row>
4455 <row>
4456 <entry><structfield>tgattr</structfield></entry>
4457 <entry><type>int2vector</type></entry>
4458 <entry></entry>
4459 <entry>Currently unused</entry>
4460 </row>
4462 <row>
4463 <entry><structfield>tgargs</structfield></entry>
4464 <entry><type>bytea</type></entry>
4465 <entry></entry>
4466 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4467 </row>
4468 </tbody>
4469 </tgroup>
4470 </table>
4472 <note>
4473 <para>
4474 When <structfield>tgconstraint</> is nonzero,
4475 <structfield>tgisconstraint</> must be true, and
4476 <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4477 <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4478 with the referenced <structname>pg_constraint</> entry. The reason we
4479 keep these fields is that we support <quote>stand-alone</> constraint
4480 triggers with no corresponding <structname>pg_constraint</> entry.
4481 </para>
4482 </note>
4484 <note>
4485 <para>
4486 <literal>pg_class.reltriggers</literal> needs to agree with the
4487 number of triggers found in this table for each relation.
4488 </para>
4489 </note>
4491 </sect1>
4494 <sect1 id="catalog-pg-ts-config">
4495 <title><structname>pg_ts_config</structname></title>
4497 <indexterm zone="catalog-pg-ts-config">
4498 <primary>pg_ts_config</primary>
4499 </indexterm>
4501 <para>
4502 The <structname>pg_ts_config</structname> catalog contains entries
4503 representing text search configurations. A configuration specifies
4504 a particular text search parser and a list of dictionaries to use
4505 for each of the parser's output token types. The parser is shown
4506 in the <structname>pg_ts_config</structname> entry, but the
4507 token-to-dictionary mapping is defined by subsidiary entries in <link
4508 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4509 </para>
4511 <para>
4512 <productname>PostgreSQL</productname>'s text search features are
4513 described at length in <xref linkend="textsearch">.
4514 </para>
4516 <table>
4517 <title><structname>pg_ts_config</> Columns</title>
4519 <tgroup cols=4>
4520 <thead>
4521 <row>
4522 <entry>Name</entry>
4523 <entry>Type</entry>
4524 <entry>References</entry>
4525 <entry>Description</entry>
4526 </row>
4527 </thead>
4529 <tbody>
4530 <row>
4531 <entry><structfield>cfgname</structfield></entry>
4532 <entry><type>name</type></entry>
4533 <entry></entry>
4534 <entry>Text search configuration name</entry>
4535 </row>
4537 <row>
4538 <entry><structfield>cfgnamespace</structfield></entry>
4539 <entry><type>oid</type></entry>
4540 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4541 <entry>
4542 The OID of the namespace that contains this configuration
4543 </entry>
4544 </row>
4546 <row>
4547 <entry><structfield>cfgowner</structfield></entry>
4548 <entry><type>oid</type></entry>
4549 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4550 <entry>Owner of the configuration</entry>
4551 </row>
4553 <row>
4554 <entry><structfield>cfgparser</structfield></entry>
4555 <entry><type>oid</type></entry>
4556 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4557 <entry>The OID of the text search parser for this configuration</entry>
4558 </row>
4559 </tbody>
4560 </tgroup>
4561 </table>
4562 </sect1>
4565 <sect1 id="catalog-pg-ts-config-map">
4566 <title><structname>pg_ts_config_map</structname></title>
4568 <indexterm zone="catalog-pg-ts-config-map">
4569 <primary>pg_ts_config_map</primary>
4570 </indexterm>
4572 <para>
4573 The <structname>pg_ts_config_map</structname> catalog contains entries
4574 showing which text search dictionaries should be consulted, and in
4575 what order, for each output token type of each text search configuration's
4576 parser.
4577 </para>
4579 <para>
4580 <productname>PostgreSQL</productname>'s text search features are
4581 described at length in <xref linkend="textsearch">.
4582 </para>
4584 <table>
4585 <title><structname>pg_ts_config_map</> Columns</title>
4587 <tgroup cols=4>
4588 <thead>
4589 <row>
4590 <entry>Name</entry>
4591 <entry>Type</entry>
4592 <entry>References</entry>
4593 <entry>Description</entry>
4594 </row>
4595 </thead>
4597 <tbody>
4598 <row>
4599 <entry><structfield>mapcfg</structfield></entry>
4600 <entry><type>oid</type></entry>
4601 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4602 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4603 </row>
4605 <row>
4606 <entry><structfield>maptokentype</structfield></entry>
4607 <entry><type>integer</type></entry>
4608 <entry></entry>
4609 <entry>A token type emitted by the configuration's parser</entry>
4610 </row>
4612 <row>
4613 <entry><structfield>mapseqno</structfield></entry>
4614 <entry><type>integer</type></entry>
4615 <entry></entry>
4616 <entry>Order in which to consult this entry (lower
4617 <structfield>mapseqno</>s first)</entry>
4618 </row>
4620 <row>
4621 <entry><structfield>mapdict</structfield></entry>
4622 <entry><type>oid</type></entry>
4623 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4624 <entry>The OID of the text search dictionary to consult</entry>
4625 </row>
4626 </tbody>
4627 </tgroup>
4628 </table>
4629 </sect1>
4632 <sect1 id="catalog-pg-ts-dict">
4633 <title><structname>pg_ts_dict</structname></title>
4635 <indexterm zone="catalog-pg-ts-dict">
4636 <primary>pg_ts_dict</primary>
4637 </indexterm>
4639 <para>
4640 The <structname>pg_ts_dict</structname> catalog contains entries
4641 defining text search dictionaries. A dictionary depends on a text
4642 search template, which specifies all the implementation functions
4643 needed; the dictionary itself provides values for the user-settable
4644 parameters supported by the template. This division of labor allows
4645 dictionaries to be created by unprivileged users. The parameters
4646 are specified by a text string <structfield>dictinitoption</>,
4647 whose format and meaning vary depending on the template.
4648 </para>
4650 <para>
4651 <productname>PostgreSQL</productname>'s text search features are
4652 described at length in <xref linkend="textsearch">.
4653 </para>
4655 <table>
4656 <title><structname>pg_ts_dict</> Columns</title>
4658 <tgroup cols=4>
4659 <thead>
4660 <row>
4661 <entry>Name</entry>
4662 <entry>Type</entry>
4663 <entry>References</entry>
4664 <entry>Description</entry>
4665 </row>
4666 </thead>
4668 <tbody>
4669 <row>
4670 <entry><structfield>dictname</structfield></entry>
4671 <entry><type>name</type></entry>
4672 <entry></entry>
4673 <entry>Text search dictionary name</entry>
4674 </row>
4676 <row>
4677 <entry><structfield>dictnamespace</structfield></entry>
4678 <entry><type>oid</type></entry>
4679 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4680 <entry>
4681 The OID of the namespace that contains this dictionary
4682 </entry>
4683 </row>
4685 <row>
4686 <entry><structfield>dictowner</structfield></entry>
4687 <entry><type>oid</type></entry>
4688 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4689 <entry>Owner of the dictionary</entry>
4690 </row>
4692 <row>
4693 <entry><structfield>dicttemplate</structfield></entry>
4694 <entry><type>oid</type></entry>
4695 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4696 <entry>The OID of the text search template for this dictionary</entry>
4697 </row>
4699 <row>
4700 <entry><structfield>dictinitoption</structfield></entry>
4701 <entry><type>text</type></entry>
4702 <entry></entry>
4703 <entry>Initialization option string for the template</entry>
4704 </row>
4705 </tbody>
4706 </tgroup>
4707 </table>
4708 </sect1>
4711 <sect1 id="catalog-pg-ts-parser">
4712 <title><structname>pg_ts_parser</structname></title>
4714 <indexterm zone="catalog-pg-ts-parser">
4715 <primary>pg_ts_parser</primary>
4716 </indexterm>
4718 <para>
4719 The <structname>pg_ts_parser</structname> catalog contains entries
4720 defining text search parsers. A parser is responsible for splitting
4721 input text into lexemes and assigning a token type to each lexeme.
4722 Since a parser must be implemented by C-language-level functions,
4723 creation of new parsers is restricted to database superusers.
4724 </para>
4726 <para>
4727 <productname>PostgreSQL</productname>'s text search features are
4728 described at length in <xref linkend="textsearch">.
4729 </para>
4731 <table>
4732 <title><structname>pg_ts_parser</> Columns</title>
4734 <tgroup cols=4>
4735 <thead>
4736 <row>
4737 <entry>Name</entry>
4738 <entry>Type</entry>
4739 <entry>References</entry>
4740 <entry>Description</entry>
4741 </row>
4742 </thead>
4744 <tbody>
4745 <row>
4746 <entry><structfield>prsname</structfield></entry>
4747 <entry><type>name</type></entry>
4748 <entry></entry>
4749 <entry>Text search parser name</entry>
4750 </row>
4752 <row>
4753 <entry><structfield>prsnamespace</structfield></entry>
4754 <entry><type>oid</type></entry>
4755 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4756 <entry>
4757 The OID of the namespace that contains this parser
4758 </entry>
4759 </row>
4761 <row>
4762 <entry><structfield>prsstart</structfield></entry>
4763 <entry><type>regproc</type></entry>
4764 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4765 <entry>OID of the parser's startup function</entry>
4766 </row>
4768 <row>
4769 <entry><structfield>prstoken</structfield></entry>
4770 <entry><type>regproc</type></entry>
4771 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4772 <entry>OID of the parser's next-token function</entry>
4773 </row>
4775 <row>
4776 <entry><structfield>prsend</structfield></entry>
4777 <entry><type>regproc</type></entry>
4778 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4779 <entry>OID of the parser's shutdown function</entry>
4780 </row>
4782 <row>
4783 <entry><structfield>prsheadline</structfield></entry>
4784 <entry><type>regproc</type></entry>
4785 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4786 <entry>OID of the parser's headline function</entry>
4787 </row>
4789 <row>
4790 <entry><structfield>prslextype</structfield></entry>
4791 <entry><type>regproc</type></entry>
4792 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4793 <entry>OID of the parser's lextype function</entry>
4794 </row>
4795 </tbody>
4796 </tgroup>
4797 </table>
4798 </sect1>
4801 <sect1 id="catalog-pg-ts-template">
4802 <title><structname>pg_ts_template</structname></title>
4804 <indexterm zone="catalog-pg-ts-template">
4805 <primary>pg_ts_template</primary>
4806 </indexterm>
4808 <para>
4809 The <structname>pg_ts_template</structname> catalog contains entries
4810 defining text search templates. A template is the implementation
4811 skeleton for a class of text search dictionaries.
4812 Since a template must be implemented by C-language-level functions,
4813 creation of new templates is restricted to database superusers.
4814 </para>
4816 <para>
4817 <productname>PostgreSQL</productname>'s text search features are
4818 described at length in <xref linkend="textsearch">.
4819 </para>
4821 <table>
4822 <title><structname>pg_ts_template</> Columns</title>
4824 <tgroup cols=4>
4825 <thead>
4826 <row>
4827 <entry>Name</entry>
4828 <entry>Type</entry>
4829 <entry>References</entry>
4830 <entry>Description</entry>
4831 </row>
4832 </thead>
4834 <tbody>
4835 <row>
4836 <entry><structfield>tmplname</structfield></entry>
4837 <entry><type>name</type></entry>
4838 <entry></entry>
4839 <entry>Text search template name</entry>
4840 </row>
4842 <row>
4843 <entry><structfield>tmplnamespace</structfield></entry>
4844 <entry><type>oid</type></entry>
4845 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4846 <entry>
4847 The OID of the namespace that contains this template
4848 </entry>
4849 </row>
4851 <row>
4852 <entry><structfield>tmplinit</structfield></entry>
4853 <entry><type>regproc</type></entry>
4854 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4855 <entry>OID of the template's initialization function</entry>
4856 </row>
4858 <row>
4859 <entry><structfield>tmpllexize</structfield></entry>
4860 <entry><type>regproc</type></entry>
4861 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4862 <entry>OID of the template's lexize function</entry>
4863 </row>
4864 </tbody>
4865 </tgroup>
4866 </table>
4867 </sect1>
4870 <sect1 id="catalog-pg-type">
4871 <title><structname>pg_type</structname></title>
4873 <indexterm zone="catalog-pg-type">
4874 <primary>pg_type</primary>
4875 </indexterm>
4877 <para>
4878 The catalog <structname>pg_type</structname> stores information about data
4879 types. Base types and enum types (scalar types) are created with
4880 <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
4881 domains with
4882 <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
4883 A composite type is automatically created for each table in the database, to
4884 represent the row structure of the table. It is also possible to create
4885 composite types with <command>CREATE TYPE AS</command>.
4886 </para>
4888 <table>
4889 <title><structname>pg_type</> Columns</title>
4891 <tgroup cols=4>
4892 <thead>
4893 <row>
4894 <entry>Name</entry>
4895 <entry>Type</entry>
4896 <entry>References</entry>
4897 <entry>Description</entry>
4898 </row>
4899 </thead>
4901 <tbody>
4902 <row>
4903 <entry><structfield>typname</structfield></entry>
4904 <entry><type>name</type></entry>
4905 <entry></entry>
4906 <entry>Data type name</entry>
4907 </row>
4909 <row>
4910 <entry><structfield>typnamespace</structfield></entry>
4911 <entry><type>oid</type></entry>
4912 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4913 <entry>
4914 The OID of the namespace that contains this type
4915 </entry>
4916 </row>
4918 <row>
4919 <entry><structfield>typowner</structfield></entry>
4920 <entry><type>oid</type></entry>
4921 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4922 <entry>Owner of the type</entry>
4923 </row>
4925 <row>
4926 <entry><structfield>typlen</structfield></entry>
4927 <entry><type>int2</type></entry>
4928 <entry></entry>
4929 <entry>
4930 For a fixed-size type, <structfield>typlen</structfield> is the number
4931 of bytes in the internal representation of the type. But for a
4932 variable-length type, <structfield>typlen</structfield> is negative.
4933 -1 indicates a <quote>varlena</> type (one that has a length word),
4934 -2 indicates a null-terminated C string.
4935 </entry>
4936 </row>
4938 <row>
4939 <entry><structfield>typbyval</structfield></entry>
4940 <entry><type>bool</type></entry>
4941 <entry></entry>
4942 <entry>
4943 <structfield>typbyval</structfield> determines whether internal
4944 routines pass a value of this type by value or by reference.
4945 <structfield>typbyval</structfield> had better be false if
4946 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
4947 where Datum is 8 bytes).
4948 Variable-length types are always passed by reference. Note that
4949 <structfield>typbyval</structfield> can be false even if the
4950 length would allow pass-by-value
4951 </entry>
4952 </row>
4954 <row>
4955 <entry><structfield>typtype</structfield></entry>
4956 <entry><type>char</type></entry>
4957 <entry></entry>
4958 <entry>
4959 <structfield>typtype</structfield> is
4960 <literal>b</literal> for a base type,
4961 <literal>c</literal> for a composite type (e.g., a table's row type),
4962 <literal>d</literal> for a domain,
4963 <literal>e</literal> for an enum type,
4964 or <literal>p</literal> for a pseudo-type.
4965 See also <structfield>typrelid</structfield> and
4966 <structfield>typbasetype</structfield>
4967 </entry>
4968 </row>
4970 <row>
4971 <entry><structfield>typcategory</structfield></entry>
4972 <entry><type>char</type></entry>
4973 <entry></entry>
4974 <entry>
4975 <structfield>typcategory</structfield> is an arbitrary classification
4976 of data types that is used by the parser to determine which implicit
4977 casts should be <quote>preferred</>.
4978 See <xref linkend="catalog-typcategory-table">
4979 </entry>
4980 </row>
4982 <row>
4983 <entry><structfield>typispreferred</structfield></entry>
4984 <entry><type>bool</type></entry>
4985 <entry></entry>
4986 <entry>
4987 True if the type is a preferred cast target within its
4988 <structfield>typcategory</structfield>
4989 </entry>
4990 </row>
4992 <row>
4993 <entry><structfield>typisdefined</structfield></entry>
4994 <entry><type>bool</type></entry>
4995 <entry></entry>
4996 <entry>
4997 True if the type is defined, false if this is a placeholder
4998 entry for a not-yet-defined type. When
4999 <structfield>typisdefined</structfield> is false, nothing
5000 except the type name, namespace, and OID can be relied on
5001 </entry>
5002 </row>
5004 <row>
5005 <entry><structfield>typdelim</structfield></entry>
5006 <entry><type>char</type></entry>
5007 <entry></entry>
5008 <entry>
5009 Character that separates two values of this type when parsing
5010 array input. Note that the delimiter is associated with the array
5011 element data type, not the array data type
5012 </entry>
5013 </row>
5015 <row>
5016 <entry><structfield>typrelid</structfield></entry>
5017 <entry><type>oid</type></entry>
5018 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5019 <entry>
5020 If this is a composite type (see
5021 <structfield>typtype</structfield>), then this column points to
5022 the <structname>pg_class</structname> entry that defines the
5023 corresponding table. (For a free-standing composite type, the
5024 <structname>pg_class</structname> entry doesn't really represent
5025 a table, but it is needed anyway for the type's
5026 <structname>pg_attribute</structname> entries to link to.)
5027 Zero for non-composite types
5028 </entry>
5029 </row>
5031 <row>
5032 <entry><structfield>typelem</structfield></entry>
5033 <entry><type>oid</type></entry>
5034 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5035 <entry>
5036 If <structfield>typelem</structfield> is not 0 then it
5037 identifies another row in <structname>pg_type</structname>.
5038 The current type can then be subscripted like an array yielding
5039 values of type <structfield>typelem</structfield>. A
5040 <quote>true</quote> array type is variable length
5041 (<structfield>typlen</structfield> = -1),
5042 but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
5043 also have nonzero <structfield>typelem</structfield>, for example
5044 <type>name</type> and <type>point</type>.
5045 If a fixed-length type has a <structfield>typelem</structfield> then
5046 its internal representation must be some number of values of the
5047 <structfield>typelem</structfield> data type with no other data.
5048 Variable-length array types have a header defined by the array
5049 subroutines
5050 </entry>
5051 </row>
5053 <row>
5054 <entry><structfield>typarray</structfield></entry>
5055 <entry><type>oid</type></entry>
5056 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5057 <entry>
5058 If <structfield>typarray</structfield> is not 0 then it
5059 identifies another row in <structname>pg_type</structname>, which
5060 is the <quote>true</quote> array type having this type as element
5061 </entry>
5062 </row>
5064 <row>
5065 <entry><structfield>typinput</structfield></entry>
5066 <entry><type>regproc</type></entry>
5067 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5068 <entry>Input conversion function (text format)</entry>
5069 </row>
5071 <row>
5072 <entry><structfield>typoutput</structfield></entry>
5073 <entry><type>regproc</type></entry>
5074 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5075 <entry>Output conversion function (text format)</entry>
5076 </row>
5078 <row>
5079 <entry><structfield>typreceive</structfield></entry>
5080 <entry><type>regproc</type></entry>
5081 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5082 <entry>Input conversion function (binary format), or 0 if none</entry>
5083 </row>
5085 <row>
5086 <entry><structfield>typsend</structfield></entry>
5087 <entry><type>regproc</type></entry>
5088 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5089 <entry>Output conversion function (binary format), or 0 if none</entry>
5090 </row>
5092 <row>
5093 <entry><structfield>typmodin</structfield></entry>
5094 <entry><type>regproc</type></entry>
5095 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5096 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5097 </row>
5099 <row>
5100 <entry><structfield>typmodout</structfield></entry>
5101 <entry><type>regproc</type></entry>
5102 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5103 <entry>Type modifier output function, or 0 to use the standard format</entry>
5104 </row>
5106 <row>
5107 <entry><structfield>typanalyze</structfield></entry>
5108 <entry><type>regproc</type></entry>
5109 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5110 <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5111 </row>
5113 <row>
5114 <entry><structfield>typalign</structfield></entry>
5115 <entry><type>char</type></entry>
5116 <entry></entry>
5117 <entry><para>
5119 <structfield>typalign</structfield> is the alignment required
5120 when storing a value of this type. It applies to storage on
5121 disk as well as most representations of the value inside
5122 <productname>PostgreSQL</>.
5123 When multiple values are stored consecutively, such
5124 as in the representation of a complete row on disk, padding is
5125 inserted before a datum of this type so that it begins on the
5126 specified boundary. The alignment reference is the beginning
5127 of the first datum in the sequence.
5128 </para><para>
5129 Possible values are:
5130 <itemizedlist>
5131 <listitem>
5132 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5133 </listitem>
5134 <listitem>
5135 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5136 </listitem>
5137 <listitem>
5138 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5139 </listitem>
5140 <listitem>
5141 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5142 </listitem>
5143 </itemizedlist>
5144 </para><note>
5145 <para>
5146 For types used in system tables, it is critical that the size
5147 and alignment defined in <structname>pg_type</structname>
5148 agree with the way that the compiler will lay out the column in
5149 a structure representing a table row.
5150 </para>
5151 </note></entry>
5152 </row>
5154 <row>
5155 <entry><structfield>typstorage</structfield></entry>
5156 <entry><type>char</type></entry>
5157 <entry></entry>
5158 <entry><para>
5159 <structfield>typstorage</structfield> tells for varlena
5160 types (those with <structfield>typlen</structfield> = -1) if
5161 the type is prepared for toasting and what the default strategy
5162 for attributes of this type should be.
5163 Possible values are
5164 <itemizedlist>
5165 <listitem>
5166 <para><literal>p</>: Value must always be stored plain.</para>
5167 </listitem>
5168 <listitem>
5169 <para>
5170 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5171 relation (if relation has one, see
5172 <literal>pg_class.reltoastrelid</literal>).
5173 </para>
5174 </listitem>
5175 <listitem>
5176 <para><literal>m</>: Value can be stored compressed inline.</para>
5177 </listitem>
5178 <listitem>
5179 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5180 </listitem>
5181 </itemizedlist>
5182 Note that <literal>m</> columns can also be moved out to secondary
5183 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5184 moved first).
5185 </para></entry>
5186 </row>
5188 <row>
5189 <entry><structfield>typnotnull</structfield></entry>
5190 <entry><type>bool</type></entry>
5191 <entry></entry>
5192 <entry><para>
5193 <structfield>typnotnull</structfield> represents a not-null
5194 constraint on a type. Used for domains only
5195 </para></entry>
5196 </row>
5198 <row>
5199 <entry><structfield>typbasetype</structfield></entry>
5200 <entry><type>oid</type></entry>
5201 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5202 <entry><para>
5203 If this is a domain (see <structfield>typtype</structfield>), then
5204 <structfield>typbasetype</structfield> identifies the type that this
5205 one is based on. Zero if this type is not a domain
5206 </para></entry>
5207 </row>
5209 <row>
5210 <entry><structfield>typtypmod</structfield></entry>
5211 <entry><type>int4</type></entry>
5212 <entry></entry>
5213 <entry><para>
5214 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5215 to be applied to their base type (-1 if base type does not use a
5216 <literal>typmod</>). -1 if this type is not a domain
5217 </para></entry>
5218 </row>
5220 <row>
5221 <entry><structfield>typndims</structfield></entry>
5222 <entry><type>int4</type></entry>
5223 <entry></entry>
5224 <entry><para>
5225 <structfield>typndims</structfield> is the number of array dimensions
5226 for a domain that is an array (that is, <structfield>typbasetype</> is
5227 an array type; the domain's <structfield>typelem</> will match the base
5228 type's <structfield>typelem</structfield>).
5229 Zero for types other than domains over array types
5230 </para></entry>
5231 </row>
5233 <row>
5234 <entry><structfield>typdefaultbin</structfield></entry>
5235 <entry><type>text</type></entry>
5236 <entry></entry>
5237 <entry><para>
5238 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5239 representation of a default expression for the type. This is
5240 only used for domains
5241 </para></entry>
5242 </row>
5244 <row>
5245 <entry><structfield>typdefault</structfield></entry>
5246 <entry><type>text</type></entry>
5247 <entry></entry>
5248 <entry><para>
5249 <structfield>typdefault</> is null if the type has no associated
5250 default value. If <structfield>typdefaultbin</> is not null,
5251 <structfield>typdefault</> must contain a human-readable version of the
5252 default expression represented by <structfield>typdefaultbin</>. If
5253 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5254 not, then <structfield>typdefault</> is the external representation of
5255 the type's default value, which might be fed to the type's input
5256 converter to produce a constant
5257 </para></entry>
5258 </row>
5259 </tbody>
5260 </tgroup>
5261 </table>
5263 <para>
5264 <xref linkend="catalog-typcategory-table"> lists the system-defined values
5265 of <structfield>typcategory</>. Any future additions to this list will
5266 also be upper-case ASCII letters. All other ASCII characters are reserved
5267 for user-defined categories.
5268 </para>
5270 <table id="catalog-typcategory-table">
5271 <title><structfield>typcategory</> Codes</title>
5273 <tgroup cols=2>
5274 <thead>
5275 <row>
5276 <entry>Code</entry>
5277 <entry>Category</entry>
5278 </row>
5279 </thead>
5281 <tbody>
5282 <row>
5283 <entry><literal>A</literal></entry>
5284 <entry>Array types</entry>
5285 </row>
5286 <row>
5287 <entry><literal>B</literal></entry>
5288 <entry>Boolean types</entry>
5289 </row>
5290 <row>
5291 <entry><literal>C</literal></entry>
5292 <entry>Composite types</entry>
5293 </row>
5294 <row>
5295 <entry><literal>D</literal></entry>
5296 <entry>Date/time types</entry>
5297 </row>
5298 <row>
5299 <entry><literal>E</literal></entry>
5300 <entry>Enum types</entry>
5301 </row>
5302 <row>
5303 <entry><literal>G</literal></entry>
5304 <entry>Geometric types</entry>
5305 </row>
5306 <row>
5307 <entry><literal>I</literal></entry>
5308 <entry>Network address types</entry>
5309 </row>
5310 <row>
5311 <entry><literal>N</literal></entry>
5312 <entry>Numeric types</entry>
5313 </row>
5314 <row>
5315 <entry><literal>P</literal></entry>
5316 <entry>Pseudo-types</entry>
5317 </row>
5318 <row>
5319 <entry><literal>S</literal></entry>
5320 <entry>String types</entry>
5321 </row>
5322 <row>
5323 <entry><literal>T</literal></entry>
5324 <entry>Timespan types</entry>
5325 </row>
5326 <row>
5327 <entry><literal>U</literal></entry>
5328 <entry>User-defined types</entry>
5329 </row>
5330 <row>
5331 <entry><literal>V</literal></entry>
5332 <entry>Bit-string types</entry>
5333 </row>
5334 <row>
5335 <entry><literal>X</literal></entry>
5336 <entry><type>unknown</> type</entry>
5337 </row>
5338 </tbody>
5339 </tgroup>
5340 </table>
5342 </sect1>
5344 <sect1 id="views-overview">
5345 <title>System Views</title>
5347 <para>
5348 In addition to the system catalogs, <productname>PostgreSQL</productname>
5349 provides a number of built-in views. Some system views provide convenient
5350 access to some commonly used queries on the system catalogs. Other views
5351 provide access to internal server state.
5352 </para>
5354 <para>
5355 The information schema (<xref linkend="information-schema">) provides
5356 an alternative set of views which overlap the functionality of the system
5357 views. Since the information schema is SQL-standard whereas the views
5358 described here are <productname>PostgreSQL</productname>-specific,
5359 it's usually better to use the information schema if it provides all
5360 the information you need.
5361 </para>
5363 <para>
5364 <xref linkend="view-table"> lists the system views described here.
5365 More detailed documentation of each view follows below.
5366 There are some additional views that provide access to the results of
5367 the statistics collector; they are described in <xref
5368 linkend="monitoring-stats-views-table">.
5369 </para>
5371 <para>
5372 Except where noted, all the views described here are read-only.
5373 </para>
5375 <table id="view-table">
5376 <title>System Views</title>
5378 <tgroup cols="2">
5379 <thead>
5380 <row>
5381 <entry>View Name</entry>
5382 <entry>Purpose</entry>
5383 </row>
5384 </thead>
5386 <tbody>
5387 <row>
5388 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5389 <entry>open cursors</entry>
5390 </row>
5392 <row>
5393 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5394 <entry>groups of database users</entry>
5395 </row>
5397 <row>
5398 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5399 <entry>indexes</entry>
5400 </row>
5402 <row>
5403 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5404 <entry>currently held locks</entry>
5405 </row>
5407 <row>
5408 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5409 <entry>prepared statements</entry>
5410 </row>
5412 <row>
5413 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5414 <entry>prepared transactions</entry>
5415 </row>
5417 <row>
5418 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5419 <entry>database roles</entry>
5420 </row>
5422 <row>
5423 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5424 <entry>rules</entry>
5425 </row>
5427 <row>
5428 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5429 <entry>parameter settings</entry>
5430 </row>
5432 <row>
5433 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5434 <entry>database users</entry>
5435 </row>
5437 <row>
5438 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5439 <entry>planner statistics</entry>
5440 </row>
5442 <row>
5443 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5444 <entry>tables</entry>
5445 </row>
5447 <row>
5448 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5449 <entry>time zone abbreviations</entry>
5450 </row>
5452 <row>
5453 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5454 <entry>time zone names</entry>
5455 </row>
5457 <row>
5458 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5459 <entry>database users</entry>
5460 </row>
5462 <row>
5463 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5464 <entry>views</entry>
5465 </row>
5467 </tbody>
5468 </tgroup>
5469 </table>
5470 </sect1>
5472 <sect1 id="view-pg-cursors">
5473 <title><structname>pg_cursors</structname></title>
5475 <indexterm zone="view-pg-cursors">
5476 <primary>pg_cursors</primary>
5477 </indexterm>
5479 <para>
5480 The <structname>pg_cursors</structname> view lists the cursors that
5481 are currently available. Cursors can be defined in several ways:
5482 <itemizedlist>
5483 <listitem>
5484 <para>
5485 via the <xref linkend="sql-declare" endterm="sql-declare-title">
5486 statement in SQL
5487 </para>
5488 </listitem>
5490 <listitem>
5491 <para>
5492 via the Bind message in the frontend/backend protocol, as
5493 described in <xref linkend="protocol-flow-ext-query">
5494 </para>
5495 </listitem>
5497 <listitem>
5498 <para>
5499 via the Server Programming Interface (SPI), as described in
5500 <xref linkend="spi-interface">
5501 </para>
5502 </listitem>
5503 </itemizedlist>
5505 The <structname>pg_cursors</structname> view displays cursors
5506 created by any of these means. Cursors only exist for the duration
5507 of the transaction that defines them, unless they have been
5508 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5509 cursors are only present in the view until the end of their
5510 creating transaction.
5512 <note>
5513 <para>
5514 Cursors are used internally to implement some of the components
5515 of <productname>PostgreSQL</>, such as procedural languages.
5516 Therefore, the <structname>pg_cursors</> view might include cursors
5517 that have not been explicitly created by the user.
5518 </para>
5519 </note>
5520 </para>
5522 <table>
5523 <title><structname>pg_cursors</> Columns</title>
5525 <tgroup cols=3>
5526 <thead>
5527 <row>
5528 <entry>Name</entry>
5529 <entry>Type</entry>
5530 <entry>Description</entry>
5531 </row>
5532 </thead>
5534 <tbody>
5535 <row>
5536 <entry><structfield>name</structfield></entry>
5537 <entry><type>text</type></entry>
5538 <entry>The name of the cursor</entry>
5539 </row>
5541 <row>
5542 <entry><structfield>statement</structfield></entry>
5543 <entry><type>text</type></entry>
5544 <entry>The verbatim query string submitted to declare this cursor</entry>
5545 </row>
5547 <row>
5548 <entry><structfield>is_holdable</structfield></entry>
5549 <entry><type>boolean</type></entry>
5550 <entry>
5551 <literal>true</literal> if the cursor is holdable (that is, it
5552 can be accessed after the transaction that declared the cursor
5553 has committed); <literal>false</literal> otherwise
5554 </entry>
5555 </row>
5557 <row>
5558 <entry><structfield>is_binary</structfield></entry>
5559 <entry><type>boolean</type></entry>
5560 <entry>
5561 <literal>true</literal> if the cursor was declared
5562 <literal>BINARY</literal>; <literal>false</literal>
5563 otherwise
5564 </entry>
5565 </row>
5567 <row>
5568 <entry><structfield>is_scrollable</structfield></entry>
5569 <entry><type>boolean</type></entry>
5570 <entry>
5571 <literal>true</> if the cursor is scrollable (that is, it
5572 allows rows to be retrieved in a nonsequential manner);
5573 <literal>false</literal> otherwise
5574 </entry>
5575 </row>
5577 <row>
5578 <entry><structfield>creation_time</structfield></entry>
5579 <entry><type>timestamptz</type></entry>
5580 <entry>The time at which the cursor was declared</entry>
5581 </row>
5582 </tbody>
5583 </tgroup>
5584 </table>
5586 <para>
5587 The <structname>pg_cursors</structname> view is read only.
5588 </para>
5590 </sect1>
5592 <sect1 id="view-pg-group">
5593 <title><structname>pg_group</structname></title>
5595 <indexterm zone="view-pg-group">
5596 <primary>pg_group</primary>
5597 </indexterm>
5599 <para>
5600 The view <structname>pg_group</structname> exists for backwards
5601 compatibility: it emulates a catalog that existed in
5602 <productname>PostgreSQL</productname> before version 8.1.
5603 It shows the names and members of all roles that are marked as not
5604 <structfield>rolcanlogin</>, which is an approximation to the set
5605 of roles that are being used as groups.
5606 </para>
5608 <table>
5609 <title><structname>pg_group</> Columns</title>
5611 <tgroup cols=4>
5612 <thead>
5613 <row>
5614 <entry>Name</entry>
5615 <entry>Type</entry>
5616 <entry>References</entry>
5617 <entry>Description</entry>
5618 </row>
5619 </thead>
5621 <tbody>
5622 <row>
5623 <entry><structfield>groname</structfield></entry>
5624 <entry><type>name</type></entry>
5625 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5626 <entry>Name of the group</entry>
5627 </row>
5629 <row>
5630 <entry><structfield>grosysid</structfield></entry>
5631 <entry><type>oid</type></entry>
5632 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5633 <entry>ID of this group</entry>
5634 </row>
5636 <row>
5637 <entry><structfield>grolist</structfield></entry>
5638 <entry><type>oid[]</type></entry>
5639 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5640 <entry>An array containing the IDs of the roles in this group</entry>
5641 </row>
5642 </tbody>
5643 </tgroup>
5644 </table>
5646 </sect1>
5648 <sect1 id="view-pg-indexes">
5649 <title><structname>pg_indexes</structname></title>
5651 <indexterm zone="view-pg-indexes">
5652 <primary>pg_indexes</primary>
5653 </indexterm>
5655 <para>
5656 The view <structname>pg_indexes</structname> provides access to
5657 useful information about each index in the database.
5658 </para>
5660 <table>
5661 <title><structname>pg_indexes</> Columns</title>
5663 <tgroup cols=4>
5664 <thead>
5665 <row>
5666 <entry>Name</entry>
5667 <entry>Type</entry>
5668 <entry>References</entry>
5669 <entry>Description</entry>
5670 </row>
5671 </thead>
5672 <tbody>
5673 <row>
5674 <entry><structfield>schemaname</structfield></entry>
5675 <entry><type>name</type></entry>
5676 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5677 <entry>Name of schema containing table and index</entry>
5678 </row>
5679 <row>
5680 <entry><structfield>tablename</structfield></entry>
5681 <entry><type>name</type></entry>
5682 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5683 <entry>Name of table the index is for</entry>
5684 </row>
5685 <row>
5686 <entry><structfield>indexname</structfield></entry>
5687 <entry><type>name</type></entry>
5688 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5689 <entry>Name of index</entry>
5690 </row>
5691 <row>
5692 <entry><structfield>tablespace</structfield></entry>
5693 <entry><type>name</type></entry>
5694 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
5695 <entry>Name of tablespace containing index (NULL if default for database)</entry>
5696 </row>
5697 <row>
5698 <entry><structfield>indexdef</structfield></entry>
5699 <entry><type>text</type></entry>
5700 <entry></entry>
5701 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
5702 command)</entry>
5703 </row>
5704 </tbody>
5705 </tgroup>
5706 </table>
5708 </sect1>
5710 <sect1 id="view-pg-locks">
5711 <title><structname>pg_locks</structname></title>
5713 <indexterm zone="view-pg-locks">
5714 <primary>pg_locks</primary>
5715 </indexterm>
5717 <para>
5718 The view <structname>pg_locks</structname> provides access to
5719 information about the locks held by open transactions within the
5720 database server. See <xref linkend="mvcc"> for more discussion
5721 of locking.
5722 </para>
5724 <para>
5725 <structname>pg_locks</structname> contains one row per active lockable
5726 object, requested lock mode, and relevant transaction. Thus, the same
5727 lockable object might
5728 appear many times, if multiple transactions are holding or waiting
5729 for locks on it. However, an object that currently has no locks on it
5730 will not appear at all.
5731 </para>
5733 <para>
5734 There are several distinct types of lockable objects:
5735 whole relations (e.g., tables), individual pages of relations,
5736 individual tuples of relations,
5737 transaction IDs (both virtual and permanent IDs),
5738 and general database objects (identified by class OID and object OID,
5739 in the same way as in <structname>pg_description</structname> or
5740 <structname>pg_depend</structname>). Also, the right to extend a
5741 relation is represented as a separate lockable object.
5742 </para>
5744 <table>
5745 <title><structname>pg_locks</> Columns</title>
5747 <tgroup cols=4>
5748 <thead>
5749 <row>
5750 <entry>Name</entry>
5751 <entry>Type</entry>
5752 <entry>References</entry>
5753 <entry>Description</entry>
5754 </row>
5755 </thead>
5756 <tbody>
5757 <row>
5758 <entry><structfield>locktype</structfield></entry>
5759 <entry><type>text</type></entry>
5760 <entry></entry>
5761 <entry>
5762 type of the lockable object:
5763 <literal>relation</>,
5764 <literal>extend</>,
5765 <literal>page</>,
5766 <literal>tuple</>,
5767 <literal>transactionid</>,
5768 <literal>virtualxid</>,
5769 <literal>object</>,
5770 <literal>userlock</>, or
5771 <literal>advisory</>
5772 </entry>
5773 </row>
5774 <row>
5775 <entry><structfield>database</structfield></entry>
5776 <entry><type>oid</type></entry>
5777 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5778 <entry>
5779 OID of the database in which the object exists, or
5780 zero if the object is a shared object, or
5781 NULL if the object is a transaction ID
5782 </entry>
5783 </row>
5784 <row>
5785 <entry><structfield>relation</structfield></entry>
5786 <entry><type>oid</type></entry>
5787 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5788 <entry>
5789 OID of the relation, or NULL if the object is not
5790 a relation or part of a relation
5791 </entry>
5792 </row>
5793 <row>
5794 <entry><structfield>page</structfield></entry>
5795 <entry><type>integer</type></entry>
5796 <entry></entry>
5797 <entry>
5798 Page number within the relation, or NULL if the object
5799 is not a tuple or relation page
5800 </entry>
5801 </row>
5802 <row>
5803 <entry><structfield>tuple</structfield></entry>
5804 <entry><type>smallint</type></entry>
5805 <entry></entry>
5806 <entry>
5807 Tuple number within the page, or NULL if the object is not a tuple
5808 </entry>
5809 </row>
5810 <row>
5811 <entry><structfield>virtualxid</structfield></entry>
5812 <entry><type>text</type></entry>
5813 <entry></entry>
5814 <entry>
5815 Virtual ID of a transaction, or NULL if the object is not a
5816 virtual transaction ID
5817 </entry>
5818 </row>
5819 <row>
5820 <entry><structfield>transactionid</structfield></entry>
5821 <entry><type>xid</type></entry>
5822 <entry></entry>
5823 <entry>
5824 ID of a transaction, or NULL if the object is not a transaction ID
5825 </entry>
5826 </row>
5827 <row>
5828 <entry><structfield>classid</structfield></entry>
5829 <entry><type>oid</type></entry>
5830 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5831 <entry>
5832 OID of the system catalog containing the object, or NULL if the
5833 object is not a general database object
5834 </entry>
5835 </row>
5836 <row>
5837 <entry><structfield>objid</structfield></entry>
5838 <entry><type>oid</type></entry>
5839 <entry>any OID column</entry>
5840 <entry>
5841 OID of the object within its system catalog, or NULL if the
5842 object is not a general database object.
5843 For advisory locks it is used to distinguish the two key
5844 spaces (<literal>1</> for an int8 key, <literal>2</> for two
5845 int4 keys).
5846 </entry>
5847 </row>
5848 <row>
5849 <entry><structfield>objsubid</structfield></entry>
5850 <entry><type>smallint</type></entry>
5851 <entry></entry>
5852 <entry>
5853 For a table column, this is the column number (the
5854 <structfield>classid</> and <structfield>objid</> refer to the
5855 table itself). For all other object types, this column is
5856 zero. NULL if the object is not a general database object
5857 </entry>
5858 </row>
5859 <row>
5860 <entry><structfield>virtualtransaction</structfield></entry>
5861 <entry><type>text</type></entry>
5862 <entry></entry>
5863 <entry>
5864 Virtual ID of the transaction that is holding or awaiting this lock
5865 </entry>
5866 </row>
5867 <row>
5868 <entry><structfield>pid</structfield></entry>
5869 <entry><type>integer</type></entry>
5870 <entry></entry>
5871 <entry>
5872 Process ID of the server process holding or awaiting this
5873 lock. NULL if the lock is held by a prepared transaction
5874 </entry>
5875 </row>
5876 <row>
5877 <entry><structfield>mode</structfield></entry>
5878 <entry><type>text</type></entry>
5879 <entry></entry>
5880 <entry>Name of the lock mode held or desired by this process (see <xref
5881 linkend="locking-tables">)</entry>
5882 </row>
5883 <row>
5884 <entry><structfield>granted</structfield></entry>
5885 <entry><type>boolean</type></entry>
5886 <entry></entry>
5887 <entry>True if lock is held, false if lock is awaited</entry>
5888 </row>
5889 </tbody>
5890 </tgroup>
5891 </table>
5893 <para>
5894 <structfield>granted</structfield> is true in a row representing a lock
5895 held by the indicated transaction. False indicates that this transaction is
5896 currently waiting to acquire this lock, which implies that some other
5897 transaction is holding a conflicting lock mode on the same lockable object.
5898 The waiting transaction will sleep until the other lock is released (or a
5899 deadlock situation is detected). A single transaction can be waiting to
5900 acquire at most one lock at a time.
5901 </para>
5903 <para>
5904 Every transaction holds an exclusive lock on its virtual transaction ID for
5905 its entire duration. If a permanent ID is assigned to the transaction
5906 (which normally happens only if the transaction changes the state of the
5907 database), it also holds an exclusive lock on its permanent transaction ID
5908 until it ends. When one transaction finds it necessary to wait specifically
5909 for another transaction, it does so by attempting to acquire share lock on
5910 the other transaction ID (either virtual or permanent ID depending on the
5911 situation). That will succeed only when the other transaction
5912 terminates and releases its locks.
5913 </para>
5915 <para>
5916 Although tuples are a lockable type of object,
5917 information about row-level locks is stored on disk, not in memory,
5918 and therefore row-level locks normally do not appear in this view.
5919 If a transaction is waiting for a
5920 row-level lock, it will usually appear in the view as waiting for the
5921 permanent transaction ID of the current holder of that row lock.
5922 </para>
5924 <para>
5925 Advisory locks can be acquired on keys consisting of either a single
5926 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
5927 high-order half in the <structfield>classid</> column, its low-order half
5928 in the <structfield>objid</> column, and <structfield>objsubid</> equal
5929 to 1. Integer keys are displayed with the first key in the
5930 <structfield>classid</> column, the second key in the <structfield>objid</>
5931 column, and <structfield>objsubid</> equal to 2. The actual meaning of
5932 the keys is up to the user. Advisory locks are local to each database,
5933 so the <structfield>database</> column is meaningful for an advisory lock.
5934 </para>
5936 <para>
5937 When the <structname>pg_locks</structname> view is accessed, the
5938 internal lock manager data structures are momentarily locked, and
5939 a copy is made for the view to display. This ensures that the
5940 view produces a consistent set of results, while not blocking
5941 normal lock manager operations longer than necessary. Nonetheless
5942 there could be some impact on database performance if this view is
5943 frequently accessed.
5944 </para>
5946 <para>
5947 <structname>pg_locks</structname> provides a global view of all locks
5948 in the database cluster, not only those relevant to the current database.
5949 Although its <structfield>relation</structfield> column can be joined
5950 against <structname>pg_class</>.<structfield>oid</> to identify locked
5951 relations, this will only work correctly for relations in the current
5952 database (those for which the <structfield>database</structfield> column
5953 is either the current database's OID or zero).
5954 </para>
5956 <para>
5957 The <structfield>pid</structfield> column can be joined to the
5958 <structfield>procpid</structfield> column of the
5959 <structname>pg_stat_activity</structname> view to get more
5960 information on the session holding or waiting to hold each lock.
5961 Also, if you are using prepared transactions, the
5962 <structfield>transaction</> column can be joined to the
5963 <structfield>transaction</structfield> column of the
5964 <structname>pg_prepared_xacts</structname> view to get more
5965 information on prepared transactions that hold locks.
5966 (A prepared transaction can never be waiting for a lock,
5967 but it continues to hold the locks it acquired while running.)
5968 </para>
5970 </sect1>
5972 <sect1 id="view-pg-prepared-statements">
5973 <title><structname>pg_prepared_statements</structname></title>
5975 <indexterm zone="view-pg-prepared-statements">
5976 <primary>pg_prepared_statements</primary>
5977 </indexterm>
5979 <para>
5980 The <structname>pg_prepared_statements</structname> view displays
5981 all the prepared statements that are available in the current
5982 session. See <xref linkend="sql-prepare"
5983 endterm="sql-prepare-title"> for more information about prepared
5984 statements.
5985 </para>
5987 <para>
5988 <structname>pg_prepared_statements</structname> contains one row
5989 for each prepared statement. Rows are added to the view when a new
5990 prepared statement is created and removed when a prepared statement
5991 is released (for example, via the <xref linkend="sql-deallocate"
5992 endterm="sql-deallocate-title"> command).
5993 </para>
5995 <table>
5996 <title><structname>pg_prepared_statements</> Columns</title>
5998 <tgroup cols=3>
5999 <thead>
6000 <row>
6001 <entry>Name</entry>
6002 <entry>Type</entry>
6003 <entry>Description</entry>
6004 </row>
6005 </thead>
6006 <tbody>
6007 <row>
6008 <entry><structfield>name</structfield></entry>
6009 <entry><type>text</type></entry>
6010 <entry>
6011 The identifier of the prepared statement
6012 </entry>
6013 </row>
6014 <row>
6015 <entry><structfield>statement</structfield></entry>
6016 <entry><type>text</type></entry>
6017 <entry>
6018 The query string submitted by the client to create this
6019 prepared statement. For prepared statements created via SQL,
6020 this is the <command>PREPARE</command> statement submitted by
6021 the client. For prepared statements created via the
6022 frontend/backend protocol, this is the text of the prepared
6023 statement itself
6024 </entry>
6025 </row>
6026 <row>
6027 <entry><structfield>prepare_time</structfield></entry>
6028 <entry><type>timestamptz</type></entry>
6029 <entry>
6030 The time at which the prepared statement was created
6031 </entry>
6032 </row>
6033 <row>
6034 <entry><structfield>parameter_types</structfield></entry>
6035 <entry><type>regtype[]</type></entry>
6036 <entry>
6037 The expected parameter types for the prepared statement in the
6038 form of an array of <type>regtype</type>. The OID corresponding
6039 to an element of this array can be obtained by casting the
6040 <type>regtype</type> value to <type>oid</type>
6041 </entry>
6042 </row>
6043 <row>
6044 <entry><structfield>from_sql</structfield></entry>
6045 <entry><type>boolean</type></entry>
6046 <entry>
6047 <literal>true</literal> if the prepared statement was created
6048 via the <command>PREPARE</command> SQL statement;
6049 <literal>false</literal> if the statement was prepared via the
6050 frontend/backend protocol
6051 </entry>
6052 </row>
6053 </tbody>
6054 </tgroup>
6055 </table>
6057 <para>
6058 The <structname>pg_prepared_statements</structname> view is read only.
6059 </para>
6060 </sect1>
6062 <sect1 id="view-pg-prepared-xacts">
6063 <title><structname>pg_prepared_xacts</structname></title>
6065 <indexterm zone="view-pg-prepared-xacts">
6066 <primary>pg_prepared_xacts</primary>
6067 </indexterm>
6069 <para>
6070 The view <structname>pg_prepared_xacts</structname> displays
6071 information about transactions that are currently prepared for two-phase
6072 commit (see <xref linkend="sql-prepare-transaction"
6073 endterm="sql-prepare-transaction-title"> for details).
6074 </para>
6076 <para>
6077 <structname>pg_prepared_xacts</structname> contains one row per prepared
6078 transaction. An entry is removed when the transaction is committed or
6079 rolled back.
6080 </para>
6082 <table>
6083 <title><structname>pg_prepared_xacts</> Columns</title>
6085 <tgroup cols=4>
6086 <thead>
6087 <row>
6088 <entry>Name</entry>
6089 <entry>Type</entry>
6090 <entry>References</entry>
6091 <entry>Description</entry>
6092 </row>
6093 </thead>
6094 <tbody>
6095 <row>
6096 <entry><structfield>transaction</structfield></entry>
6097 <entry><type>xid</type></entry>
6098 <entry></entry>
6099 <entry>
6100 Numeric transaction identifier of the prepared transaction
6101 </entry>
6102 </row>
6103 <row>
6104 <entry><structfield>gid</structfield></entry>
6105 <entry><type>text</type></entry>
6106 <entry></entry>
6107 <entry>
6108 Global transaction identifier that was assigned to the transaction
6109 </entry>
6110 </row>
6111 <row>
6112 <entry><structfield>prepared</structfield></entry>
6113 <entry><type>timestamp with time zone</type></entry>
6114 <entry></entry>
6115 <entry>
6116 Time at which the transaction was prepared for commit
6117 </entry>
6118 </row>
6119 <row>
6120 <entry><structfield>owner</structfield></entry>
6121 <entry><type>name</type></entry>
6122 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6123 <entry>
6124 Name of the user that executed the transaction
6125 </entry>
6126 </row>
6127 <row>
6128 <entry><structfield>database</structfield></entry>
6129 <entry><type>name</type></entry>
6130 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
6131 <entry>
6132 Name of the database in which the transaction was executed
6133 </entry>
6134 </row>
6135 </tbody>
6136 </tgroup>
6137 </table>
6139 <para>
6140 When the <structname>pg_prepared_xacts</structname> view is accessed, the
6141 internal transaction manager data structures are momentarily locked, and
6142 a copy is made for the view to display. This ensures that the
6143 view produces a consistent set of results, while not blocking
6144 normal operations longer than necessary. Nonetheless
6145 there could be some impact on database performance if this view is
6146 frequently accessed.
6147 </para>
6149 </sect1>
6151 <sect1 id="view-pg-roles">
6152 <title><structname>pg_roles</structname></title>
6154 <indexterm zone="view-pg-roles">
6155 <primary>pg_roles</primary>
6156 </indexterm>
6158 <para>
6159 The view <structname>pg_roles</structname> provides access to
6160 information about database roles. This is simply a publicly
6161 readable view of
6162 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6163 that blanks out the password field.
6164 </para>
6166 <para>
6167 This view explicitly exposes the OID column of the underlying table,
6168 since that is needed to do joins to other catalogs.
6169 </para>
6171 <table>
6172 <title><structname>pg_roles</> Columns</title>
6174 <tgroup cols=4>
6175 <thead>
6176 <row>
6177 <entry>Name</entry>
6178 <entry>Type</entry>
6179 <entry>References</entry>
6180 <entry>Description</entry>
6181 </row>
6182 </thead>
6184 <tbody>
6185 <row>
6186 <entry><structfield>rolname</structfield></entry>
6187 <entry><type>name</type></entry>
6188 <entry></entry>
6189 <entry>Role name</entry>
6190 </row>
6192 <row>
6193 <entry><structfield>rolsuper</structfield></entry>
6194 <entry><type>bool</type></entry>
6195 <entry></entry>
6196 <entry>Role has superuser privileges</entry>
6197 </row>
6199 <row>
6200 <entry><structfield>rolinherit</structfield></entry>
6201 <entry><type>bool</type></entry>
6202 <entry></entry>
6203 <entry>Role automatically inherits privileges of roles it is a
6204 member of</entry>
6205 </row>
6207 <row>
6208 <entry><structfield>rolcreaterole</structfield></entry>
6209 <entry><type>bool</type></entry>
6210 <entry></entry>
6211 <entry>Role can create more roles</entry>
6212 </row>
6214 <row>
6215 <entry><structfield>rolcreatedb</structfield></entry>
6216 <entry><type>bool</type></entry>
6217 <entry></entry>
6218 <entry>Role can create databases</entry>
6219 </row>
6221 <row>
6222 <entry><structfield>rolcatupdate</structfield></entry>
6223 <entry><type>bool</type></entry>
6224 <entry></entry>
6225 <entry>
6226 Role can update system catalogs directly. (Even a superuser cannot do
6227 this unless this column is true.)
6228 </entry>
6229 </row>
6231 <row>
6232 <entry><structfield>rolcanlogin</structfield></entry>
6233 <entry><type>bool</type></entry>
6234 <entry></entry>
6235 <entry>
6236 Role can log in. That is, this role can be given as the initial
6237 session authorization identifier
6238 </entry>
6239 </row>
6241 <row>
6242 <entry><structfield>rolconnlimit</structfield></entry>
6243 <entry><type>int4</type></entry>
6244 <entry></entry>
6245 <entry>
6246 For roles that can log in, this sets maximum number of concurrent
6247 connections this role can make. -1 means no limit
6248 </entry>
6249 </row>
6251 <row>
6252 <entry><structfield>rolpassword</structfield></entry>
6253 <entry><type>text</type></entry>
6254 <entry></entry>
6255 <entry>Not the password (always reads as <literal>********</>)</entry>
6256 </row>
6258 <row>
6259 <entry><structfield>rolvaliduntil</structfield></entry>
6260 <entry><type>timestamptz</type></entry>
6261 <entry></entry>
6262 <entry>Password expiry time (only used for password authentication);
6263 NULL if no expiration</entry>
6264 </row>
6266 <row>
6267 <entry><structfield>rolconfig</structfield></entry>
6268 <entry><type>text[]</type></entry>
6269 <entry></entry>
6270 <entry>Session defaults for run-time configuration variables</entry>
6271 </row>
6273 <row>
6274 <entry><structfield>oid</structfield></entry>
6275 <entry><type>oid</type></entry>
6276 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6277 <entry>ID of role</entry>
6278 </row>
6279 </tbody>
6280 </tgroup>
6281 </table>
6283 </sect1>
6285 <sect1 id="view-pg-rules">
6286 <title><structname>pg_rules</structname></title>
6288 <indexterm zone="view-pg-rules">
6289 <primary>pg_rules</primary>
6290 </indexterm>
6292 <para>
6293 The view <structname>pg_rules</structname> provides access to
6294 useful information about query rewrite rules.
6295 </para>
6297 <table>
6298 <title><structname>pg_rules</> Columns</title>
6300 <tgroup cols=4>
6301 <thead>
6302 <row>
6303 <entry>Name</entry>
6304 <entry>Type</entry>
6305 <entry>References</entry>
6306 <entry>Description</entry>
6307 </row>
6308 </thead>
6309 <tbody>
6310 <row>
6311 <entry><structfield>schemaname</structfield></entry>
6312 <entry><type>name</type></entry>
6313 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6314 <entry>Name of schema containing table</entry>
6315 </row>
6316 <row>
6317 <entry><structfield>tablename</structfield></entry>
6318 <entry><type>name</type></entry>
6319 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6320 <entry>Name of table the rule is for</entry>
6321 </row>
6322 <row>
6323 <entry><structfield>rulename</structfield></entry>
6324 <entry><type>name</type></entry>
6325 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6326 <entry>Name of rule</entry>
6327 </row>
6328 <row>
6329 <entry><structfield>definition</structfield></entry>
6330 <entry><type>text</type></entry>
6331 <entry></entry>
6332 <entry>Rule definition (a reconstructed creation command)</entry>
6333 </row>
6334 </tbody>
6335 </tgroup>
6336 </table>
6338 <para>
6339 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6340 of views; those can be seen in <structname>pg_views</>.
6341 </para>
6343 </sect1>
6345 <sect1 id="view-pg-settings">
6346 <title><structname>pg_settings</structname></title>
6348 <indexterm zone="view-pg-settings">
6349 <primary>pg_settings</primary>
6350 </indexterm>
6352 <para>
6353 The view <structname>pg_settings</structname> provides access to
6354 run-time parameters of the server. It is essentially an alternative
6355 interface to the <command>SHOW</> and <command>SET</> commands.
6356 It also provides access to some facts about each parameter that are
6357 not directly available from <command>SHOW</>, such as minimum and
6358 maximum values.
6359 </para>
6361 <table>
6362 <title><structname>pg_settings</> Columns</title>
6364 <tgroup cols=3>
6365 <thead>
6366 <row>
6367 <entry>Name</entry>
6368 <entry>Type</entry>
6369 <entry>Description</entry>
6370 </row>
6371 </thead>
6372 <tbody>
6373 <row>
6374 <entry><structfield>name</structfield></entry>
6375 <entry><type>text</type></entry>
6376 <entry>Run-time configuration parameter name</entry>
6377 </row>
6378 <row>
6379 <entry><structfield>setting</structfield></entry>
6380 <entry><type>text</type></entry>
6381 <entry>Current value of the parameter</entry>
6382 </row>
6383 <row>
6384 <entry><structfield>unit</structfield></entry>
6385 <entry><type>text</type></entry>
6386 <entry>Implicit unit of the parameter</entry>
6387 </row>
6388 <row>
6389 <entry><structfield>category</structfield></entry>
6390 <entry><type>text</type></entry>
6391 <entry>Logical group of the parameter</entry>
6392 </row>
6393 <row>
6394 <entry><structfield>short_desc</structfield></entry>
6395 <entry><type>text</type></entry>
6396 <entry>A brief description of the parameter</entry>
6397 </row>
6398 <row>
6399 <entry><structfield>extra_desc</structfield></entry>
6400 <entry><type>text</type></entry>
6401 <entry>Additional, more detailed, information about the parameter</entry>
6402 </row>
6403 <row>
6404 <entry><structfield>context</structfield></entry>
6405 <entry><type>text</type></entry>
6406 <entry>Context required to set the parameter's value</entry>
6407 </row>
6408 <row>
6409 <entry><structfield>vartype</structfield></entry>
6410 <entry><type>text</type></entry>
6411 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6412 <literal>integer</>, <literal>real</>, or <literal>string</>)
6413 </entry>
6414 </row>
6415 <row>
6416 <entry><structfield>source</structfield></entry>
6417 <entry><type>text</type></entry>
6418 <entry>Source of the current parameter value</entry>
6419 </row>
6420 <row>
6421 <entry><structfield>min_val</structfield></entry>
6422 <entry><type>text</type></entry>
6423 <entry>Minimum allowed value of the parameter (NULL for non-numeric
6424 values)</entry>
6425 </row>
6426 <row>
6427 <entry><structfield>max_val</structfield></entry>
6428 <entry><type>text</type></entry>
6429 <entry>Maximum allowed value of the parameter (NULL for non-numeric
6430 values)</entry>
6431 </row>
6432 <row>
6433 <entry><structfield>enumvals</structfield></entry>
6434 <entry><type>text</type></entry>
6435 <entry>Allowed values in enum parameters (NULL for non-enum
6436 values)</entry>
6437 </row>
6438 <row>
6439 <entry><structfield>sourcefile</structfield></entry>
6440 <entry><type>text</type></entry>
6441 <entry>Input file the current value was set from (NULL for values set in
6442 sources other than configuration files). Helpful when using
6443 configuration include directives.</entry>
6444 </row>
6445 <row>
6446 <entry><structfield>sourceline</structfield></entry>
6447 <entry><type>text</type></entry>
6448 <entry>Line number within the sourcefile the current value was set
6449 from (NULL for values set in sources other than configuration files)
6450 </entry>
6451 </row>
6452 </tbody>
6453 </tgroup>
6454 </table>
6456 <para>
6457 The <structname>pg_settings</structname> view cannot be inserted into or
6458 deleted from, but it can be updated. An <command>UPDATE</command> applied
6459 to a row of <structname>pg_settings</structname> is equivalent to executing
6460 the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6461 parameter. The change only affects the value used by the current
6462 session. If an <command>UPDATE</command> is issued within a transaction
6463 that is later aborted, the effects of the <command>UPDATE</command> command
6464 disappear when the transaction is rolled back. Once the surrounding
6465 transaction is committed, the effects will persist until the end of the
6466 session, unless overridden by another <command>UPDATE</command> or
6467 <command>SET</command>.
6468 </para>
6470 </sect1>
6472 <sect1 id="view-pg-shadow">
6473 <title><structname>pg_shadow</structname></title>
6475 <indexterm zone="view-pg-shadow">
6476 <primary>pg_shadow</primary>
6477 </indexterm>
6479 <para>
6480 The view <structname>pg_shadow</structname> exists for backwards
6481 compatibility: it emulates a catalog that existed in
6482 <productname>PostgreSQL</productname> before version 8.1.
6483 It shows properties of all roles that are marked as
6484 <structfield>rolcanlogin</>.
6485 </para>
6487 <para>
6488 The name stems from the fact that this table
6489 should not be readable by the public since it contains passwords.
6490 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6491 is a publicly readable view on
6492 <structname>pg_shadow</structname> that blanks out the password field.
6493 </para>
6495 <table>
6496 <title><structname>pg_shadow</> Columns</title>
6498 <tgroup cols=4>
6499 <thead>
6500 <row>
6501 <entry>Name</entry>
6502 <entry>Type</entry>
6503 <entry>References</entry>
6504 <entry>Description</entry>
6505 </row>
6506 </thead>
6508 <tbody>
6509 <row>
6510 <entry><structfield>usename</structfield></entry>
6511 <entry><type>name</type></entry>
6512 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6513 <entry>User name</entry>
6514 </row>
6516 <row>
6517 <entry><structfield>usesysid</structfield></entry>
6518 <entry><type>oid</type></entry>
6519 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6520 <entry>ID of this user</entry>
6521 </row>
6523 <row>
6524 <entry><structfield>usecreatedb</structfield></entry>
6525 <entry><type>bool</type></entry>
6526 <entry></entry>
6527 <entry>User can create databases</entry>
6528 </row>
6530 <row>
6531 <entry><structfield>usesuper</structfield></entry>
6532 <entry><type>bool</type></entry>
6533 <entry></entry>
6534 <entry>User is a superuser</entry>
6535 </row>
6537 <row>
6538 <entry><structfield>usecatupd</structfield></entry>
6539 <entry><type>bool</type></entry>
6540 <entry></entry>
6541 <entry>
6542 User can update system catalogs. (Even a superuser cannot do
6543 this unless this column is true.)
6544 </entry>
6545 </row>
6547 <row>
6548 <entry><structfield>passwd</structfield></entry>
6549 <entry><type>text</type></entry>
6550 <entry></entry>
6551 <entry>Password (possibly encrypted)</entry>
6552 </row>
6554 <row>
6555 <entry><structfield>valuntil</structfield></entry>
6556 <entry><type>abstime</type></entry>
6557 <entry></entry>
6558 <entry>Password expiry time (only used for password authentication)</entry>
6559 </row>
6561 <row>
6562 <entry><structfield>useconfig</structfield></entry>
6563 <entry><type>text[]</type></entry>
6564 <entry></entry>
6565 <entry>Session defaults for run-time configuration variables</entry>
6566 </row>
6567 </tbody>
6568 </tgroup>
6569 </table>
6571 </sect1>
6573 <sect1 id="view-pg-stats">
6574 <title><structname>pg_stats</structname></title>
6576 <indexterm zone="view-pg-stats">
6577 <primary>pg_stats</primary>
6578 </indexterm>
6580 <para>
6581 The view <structname>pg_stats</structname> provides access to
6582 the information stored in the <link
6583 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6584 catalog. This view allows access only to rows of
6585 <structname>pg_statistic</structname> that correspond to tables the
6586 user has permission to read, and therefore it is safe to allow public
6587 read access to this view.
6588 </para>
6590 <para>
6591 <structname>pg_stats</structname> is also designed to present the
6592 information in a more readable format than the underlying catalog
6593 &mdash; at the cost that its schema must be extended whenever new slot types
6594 are defined for <structname>pg_statistic</structname>.
6595 </para>
6597 <table>
6598 <title><structname>pg_stats</> Columns</title>
6600 <tgroup cols=4>
6601 <thead>
6602 <row>
6603 <entry>Name</entry>
6604 <entry>Type</entry>
6605 <entry>References</entry>
6606 <entry>Description</entry>
6607 </row>
6608 </thead>
6609 <tbody>
6610 <row>
6611 <entry><structfield>schemaname</structfield></entry>
6612 <entry><type>name</type></entry>
6613 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6614 <entry>Name of schema containing table</entry>
6615 </row>
6617 <row>
6618 <entry><structfield>tablename</structfield></entry>
6619 <entry><type>name</type></entry>
6620 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6621 <entry>Name of table</entry>
6622 </row>
6624 <row>
6625 <entry><structfield>attname</structfield></entry>
6626 <entry><type>name</type></entry>
6627 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6628 <entry>Name of the column described by this row</entry>
6629 </row>
6631 <row>
6632 <entry><structfield>null_frac</structfield></entry>
6633 <entry><type>real</type></entry>
6634 <entry></entry>
6635 <entry>Fraction of column entries that are null</entry>
6636 </row>
6638 <row>
6639 <entry><structfield>avg_width</structfield></entry>
6640 <entry><type>integer</type></entry>
6641 <entry></entry>
6642 <entry>Average width in bytes of column's entries</entry>
6643 </row>
6645 <row>
6646 <entry><structfield>n_distinct</structfield></entry>
6647 <entry><type>real</type></entry>
6648 <entry></entry>
6649 <entry>
6650 If greater than zero, the estimated number of distinct values in the
6651 column. If less than zero, the negative of the number of distinct
6652 values divided by the number of rows. (The negated form is used when
6653 <command>ANALYZE</> believes that the number of distinct values is
6654 likely to increase as the table grows; the positive form is used when
6655 the column seems to have a fixed number of possible values.) For
6656 example, -1 indicates a unique column in which the number of distinct
6657 values is the same as the number of rows
6658 </entry>
6659 </row>
6661 <row>
6662 <entry><structfield>most_common_vals</structfield></entry>
6663 <entry><type>anyarray</type></entry>
6664 <entry></entry>
6665 <entry>
6666 A list of the most common values in the column. (NULL if
6667 no values seem to be more common than any others.)
6668 For some datatypes such as <type>tsvector</>, this is a list of
6669 the most common element values rather than values of the type itself.
6670 </entry>
6671 </row>
6673 <row>
6674 <entry><structfield>most_common_freqs</structfield></entry>
6675 <entry><type>real[]</type></entry>
6676 <entry></entry>
6677 <entry>
6678 A list of the frequencies of the most common values or elements,
6679 i.e., number of occurrences of each divided by total number of rows.
6680 (NULL when <structfield>most_common_vals</structfield> is.)
6681 For some datatypes such as <type>tsvector</>, it can also store some
6682 additional information, making it longer than the
6683 <structfield>most_common_vals</> array.
6684 </entry>
6685 </row>
6687 <row>
6688 <entry><structfield>histogram_bounds</structfield></entry>
6689 <entry><type>anyarray</type></entry>
6690 <entry></entry>
6691 <entry>
6692 A list of values that divide the column's values into groups of
6693 approximately equal population. The values in
6694 <structfield>most_common_vals</>, if present, are omitted from this
6695 histogram calculation. (This column is NULL if the column data type
6696 does not have a <literal>&lt;</> operator or if the
6697 <structfield>most_common_vals</> list accounts for the entire
6698 population.)
6699 </entry>
6700 </row>
6702 <row>
6703 <entry><structfield>correlation</structfield></entry>
6704 <entry><type>real</type></entry>
6705 <entry></entry>
6706 <entry>
6707 Statistical correlation between physical row ordering and
6708 logical ordering of the column values. This ranges from -1 to +1.
6709 When the value is near -1 or +1, an index scan on the column will
6710 be estimated to be cheaper than when it is near zero, due to reduction
6711 of random access to the disk. (This column is NULL if the column data
6712 type does not have a <literal>&lt;</> operator.)
6713 </entry>
6714 </row>
6715 </tbody>
6716 </tgroup>
6717 </table>
6719 <para>
6720 The maximum number of entries in the <structfield>most_common_vals</>
6721 and <structfield>histogram_bounds</> arrays can be set on a
6722 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
6723 command, or globally by setting the
6724 <xref linkend="guc-default-statistics-target"> run-time parameter.
6725 </para>
6727 </sect1>
6729 <sect1 id="view-pg-tables">
6730 <title><structname>pg_tables</structname></title>
6732 <indexterm zone="view-pg-tables">
6733 <primary>pg_tables</primary>
6734 </indexterm>
6736 <para>
6737 The view <structname>pg_tables</structname> provides access to
6738 useful information about each table in the database.
6739 </para>
6741 <table>
6742 <title><structname>pg_tables</> Columns</title>
6744 <tgroup cols=4>
6745 <thead>
6746 <row>
6747 <entry>Name</entry>
6748 <entry>Type</entry>
6749 <entry>References</entry>
6750 <entry>Description</entry>
6751 </row>
6752 </thead>
6753 <tbody>
6754 <row>
6755 <entry><structfield>schemaname</structfield></entry>
6756 <entry><type>name</type></entry>
6757 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6758 <entry>Name of schema containing table</entry>
6759 </row>
6760 <row>
6761 <entry><structfield>tablename</structfield></entry>
6762 <entry><type>name</type></entry>
6763 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6764 <entry>Name of table</entry>
6765 </row>
6766 <row>
6767 <entry><structfield>tableowner</structfield></entry>
6768 <entry><type>name</type></entry>
6769 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6770 <entry>Name of table's owner</entry>
6771 </row>
6772 <row>
6773 <entry><structfield>tablespace</structfield></entry>
6774 <entry><type>name</type></entry>
6775 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6776 <entry>Name of tablespace containing table (NULL if default for database)</entry>
6777 </row>
6778 <row>
6779 <entry><structfield>hasindexes</structfield></entry>
6780 <entry><type>boolean</type></entry>
6781 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
6782 <entry>true if table has (or recently had) any indexes</entry>
6783 </row>
6784 <row>
6785 <entry><structfield>hasrules</structfield></entry>
6786 <entry><type>boolean</type></entry>
6787 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
6788 <entry>true if table has rules</entry>
6789 </row>
6790 <row>
6791 <entry><structfield>hastriggers</structfield></entry>
6792 <entry><type>boolean</type></entry>
6793 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.reltriggers</literal></entry>
6794 <entry>true if table has triggers</entry>
6795 </row>
6796 </tbody>
6797 </tgroup>
6798 </table>
6800 </sect1>
6802 <sect1 id="view-pg-timezone-abbrevs">
6803 <title><structname>pg_timezone_abbrevs</structname></title>
6805 <indexterm zone="view-pg-timezone-abbrevs">
6806 <primary>pg_timezone_abbrevs</primary>
6807 </indexterm>
6809 <para>
6810 The view <structname>pg_timezone_abbrevs</structname> provides a list
6811 of time zone abbreviations that are currently recognized by the datetime
6812 input routines. The contents of this view change when the
6813 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
6814 </para>
6816 <table>
6817 <title><structname>pg_timezone_abbrevs</> Columns</title>
6819 <tgroup cols=3>
6820 <thead>
6821 <row>
6822 <entry>Name</entry>
6823 <entry>Type</entry>
6824 <entry>Description</entry>
6825 </row>
6826 </thead>
6827 <tbody>
6828 <row>
6829 <entry><structfield>abbrev</structfield></entry>
6830 <entry><type>text</type></entry>
6831 <entry>Time zone abbreviation</entry>
6832 </row>
6833 <row>
6834 <entry><structfield>utc_offset</structfield></entry>
6835 <entry><type>interval</type></entry>
6836 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6837 </row>
6838 <row>
6839 <entry><structfield>is_dst</structfield></entry>
6840 <entry><type>boolean</type></entry>
6841 <entry>True if this is a daylight-savings abbreviation</entry>
6842 </row>
6843 </tbody>
6844 </tgroup>
6845 </table>
6847 </sect1>
6849 <sect1 id="view-pg-timezone-names">
6850 <title><structname>pg_timezone_names</structname></title>
6852 <indexterm zone="view-pg-timezone-names">
6853 <primary>pg_timezone_names</primary>
6854 </indexterm>
6856 <para>
6857 The view <structname>pg_timezone_names</structname> provides a list
6858 of time zone names that are recognized by <command>SET TIMEZONE</>,
6859 along with their associated abbreviations, UTC offsets,
6860 and daylight-savings status.
6861 Unlike the abbreviations shown in <link
6862 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
6863 date rules. Therefore, the associated information changes across local DST
6864 boundaries. The displayed information is computed based on the current
6865 value of <function>CURRENT_TIMESTAMP</>.
6866 </para>
6868 <table>
6869 <title><structname>pg_timezone_names</> Columns</title>
6871 <tgroup cols=3>
6872 <thead>
6873 <row>
6874 <entry>Name</entry>
6875 <entry>Type</entry>
6876 <entry>Description</entry>
6877 </row>
6878 </thead>
6879 <tbody>
6880 <row>
6881 <entry><structfield>name</structfield></entry>
6882 <entry><type>text</type></entry>
6883 <entry>Time zone name</entry>
6884 </row>
6885 <row>
6886 <entry><structfield>abbrev</structfield></entry>
6887 <entry><type>text</type></entry>
6888 <entry>Time zone abbreviation</entry>
6889 </row>
6890 <row>
6891 <entry><structfield>utc_offset</structfield></entry>
6892 <entry><type>interval</type></entry>
6893 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6894 </row>
6895 <row>
6896 <entry><structfield>is_dst</structfield></entry>
6897 <entry><type>boolean</type></entry>
6898 <entry>True if currently observing daylight savings</entry>
6899 </row>
6900 </tbody>
6901 </tgroup>
6902 </table>
6904 </sect1>
6906 <sect1 id="view-pg-user">
6907 <title><structname>pg_user</structname></title>
6909 <indexterm zone="view-pg-user">
6910 <primary>pg_user</primary>
6911 </indexterm>
6913 <para>
6914 The view <structname>pg_user</structname> provides access to
6915 information about database users. This is simply a publicly
6916 readable view of
6917 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
6918 that blanks out the password field.
6919 </para>
6921 <table>
6922 <title><structname>pg_user</> Columns</title>
6924 <tgroup cols=3>
6925 <thead>
6926 <row>
6927 <entry>Name</entry>
6928 <entry>Type</entry>
6929 <entry>Description</entry>
6930 </row>
6931 </thead>
6932 <tbody>
6933 <row>
6934 <entry><structfield>usename</structfield></entry>
6935 <entry><type>name</type></entry>
6936 <entry>User name</entry>
6937 </row>
6939 <row>
6940 <entry><structfield>usesysid</structfield></entry>
6941 <entry><type>int4</type></entry>
6942 <entry>User ID (arbitrary number used to reference this user)</entry>
6943 </row>
6945 <row>
6946 <entry><structfield>usecreatedb</structfield></entry>
6947 <entry><type>bool</type></entry>
6948 <entry>User can create databases</entry>
6949 </row>
6951 <row>
6952 <entry><structfield>usesuper</structfield></entry>
6953 <entry><type>bool</type></entry>
6954 <entry>User is a superuser</entry>
6955 </row>
6957 <row>
6958 <entry><structfield>usecatupd</structfield></entry>
6959 <entry><type>bool</type></entry>
6960 <entry>
6961 User can update system catalogs. (Even a superuser cannot do
6962 this unless this column is true.)
6963 </entry>
6964 </row>
6966 <row>
6967 <entry><structfield>passwd</structfield></entry>
6968 <entry><type>text</type></entry>
6969 <entry>Not the password (always reads as <literal>********</>)</entry>
6970 </row>
6972 <row>
6973 <entry><structfield>valuntil</structfield></entry>
6974 <entry><type>abstime</type></entry>
6975 <entry>Password expiry time (only used for password authentication)</entry>
6976 </row>
6978 <row>
6979 <entry><structfield>useconfig</structfield></entry>
6980 <entry><type>text[]</type></entry>
6981 <entry>Session defaults for run-time configuration variables</entry>
6982 </row>
6983 </tbody>
6984 </tgroup>
6985 </table>
6987 </sect1>
6989 <sect1 id="view-pg-views">
6990 <title><structname>pg_views</structname></title>
6992 <indexterm zone="view-pg-views">
6993 <primary>pg_views</primary>
6994 </indexterm>
6996 <para>
6997 The view <structname>pg_views</structname> provides access to
6998 useful information about each view in the database.
6999 </para>
7001 <table>
7002 <title><structname>pg_views</> Columns</title>
7004 <tgroup cols=4>
7005 <thead>
7006 <row>
7007 <entry>Name</entry>
7008 <entry>Type</entry>
7009 <entry>References</entry>
7010 <entry>Description</entry>
7011 </row>
7012 </thead>
7013 <tbody>
7014 <row>
7015 <entry><structfield>schemaname</structfield></entry>
7016 <entry><type>name</type></entry>
7017 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7018 <entry>Name of schema containing view</entry>
7019 </row>
7020 <row>
7021 <entry><structfield>viewname</structfield></entry>
7022 <entry><type>name</type></entry>
7023 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7024 <entry>Name of view</entry>
7025 </row>
7026 <row>
7027 <entry><structfield>viewowner</structfield></entry>
7028 <entry><type>name</type></entry>
7029 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7030 <entry>Name of view's owner</entry>
7031 </row>
7032 <row>
7033 <entry><structfield>definition</structfield></entry>
7034 <entry><type>text</type></entry>
7035 <entry></entry>
7036 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
7037 </row>
7038 </tbody>
7039 </tgroup>
7040 </table>
7042 </sect1>
7044 </chapter>