Remove tabs from SGML docs.
[PostgreSQL.git] / doc / src / sgml / catalogs.sgml
blob5f5a4bf07fb97f8b458d6654346dcc9ceb8ab983
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-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
138 <entry>foreign-data wrapper definitions</entry>
139 </row>
141 <row>
142 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
143 <entry>foreign server definitions</entry>
144 </row>
146 <row>
147 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
148 <entry>additional index information</entry>
149 </row>
151 <row>
152 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
153 <entry>table inheritance hierarchy</entry>
154 </row>
156 <row>
157 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
158 <entry>languages for writing functions</entry>
159 </row>
161 <row>
162 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
163 <entry>large objects</entry>
164 </row>
166 <row>
167 <entry><link linkend="catalog-pg-listener"><structname>pg_listener</structname></link></entry>
168 <entry>asynchronous notification support</entry>
169 </row>
171 <row>
172 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
173 <entry>schemas</entry>
174 </row>
176 <row>
177 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
178 <entry>access method operator classes</entry>
179 </row>
181 <row>
182 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
183 <entry>operators</entry>
184 </row>
186 <row>
187 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
188 <entry>access method operator families</entry>
189 </row>
191 <row>
192 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
193 <entry>template data for procedural languages</entry>
194 </row>
196 <row>
197 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
198 <entry>functions and procedures</entry>
199 </row>
201 <row>
202 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
203 <entry>query rewrite rules</entry>
204 </row>
206 <row>
207 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
208 <entry>dependencies on shared objects</entry>
209 </row>
211 <row>
212 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
213 <entry>comments on shared objects</entry>
214 </row>
216 <row>
217 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
218 <entry>planner statistics</entry>
219 </row>
221 <row>
222 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
223 <entry>tablespaces within this database cluster</entry>
224 </row>
226 <row>
227 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
228 <entry>triggers</entry>
229 </row>
231 <row>
232 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
233 <entry>text search configurations</entry>
234 </row>
236 <row>
237 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
238 <entry>text search configurations' token mappings</entry>
239 </row>
241 <row>
242 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
243 <entry>text search dictionaries</entry>
244 </row>
246 <row>
247 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
248 <entry>text search parsers</entry>
249 </row>
251 <row>
252 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
253 <entry>text search templates</entry>
254 </row>
256 <row>
257 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
258 <entry>data types</entry>
259 </row>
261 <row>
262 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
263 <entry>mappings of users to foreign servers</entry>
264 </row>
265 </tbody>
266 </tgroup>
267 </table>
268 </sect1>
271 <sect1 id="catalog-pg-aggregate">
272 <title><structname>pg_aggregate</structname></title>
274 <indexterm zone="catalog-pg-aggregate">
275 <primary>pg_aggregate</primary>
276 </indexterm>
278 <para>
279 The catalog <structname>pg_aggregate</structname> stores information about
280 aggregate functions. An aggregate function is a function that
281 operates on a set of values (typically one column from each row
282 that matches a query condition) and returns a single value computed
283 from all these values. Typical aggregate functions are
284 <function>sum</function>, <function>count</function>, and
285 <function>max</function>. Each entry in
286 <structname>pg_aggregate</structname> is an extension of an entry
287 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
288 entry carries the aggregate's name, input and output data types, and
289 other information that is similar to ordinary functions.
290 </para>
292 <table>
293 <title><structname>pg_aggregate</> Columns</title>
295 <tgroup cols=4>
296 <thead>
297 <row>
298 <entry>Name</entry>
299 <entry>Type</entry>
300 <entry>References</entry>
301 <entry>Description</entry>
302 </row>
303 </thead>
304 <tbody>
305 <row>
306 <entry><structfield>aggfnoid</structfield></entry>
307 <entry><type>regproc</type></entry>
308 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
309 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
310 </row>
311 <row>
312 <entry><structfield>aggtransfn</structfield></entry>
313 <entry><type>regproc</type></entry>
314 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
315 <entry>Transition function</entry>
316 </row>
317 <row>
318 <entry><structfield>aggfinalfn</structfield></entry>
319 <entry><type>regproc</type></entry>
320 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
321 <entry>Final function (zero if none)</entry>
322 </row>
323 <row>
324 <entry><structfield>aggsortop</structfield></entry>
325 <entry><type>oid</type></entry>
326 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
327 <entry>Associated sort operator (zero if none)</entry>
328 </row>
329 <row>
330 <entry><structfield>aggtranstype</structfield></entry>
331 <entry><type>oid</type></entry>
332 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
333 <entry>Data type of the aggregate function's internal transition (state) data</entry>
334 </row>
335 <row>
336 <entry><structfield>agginitval</structfield></entry>
337 <entry><type>text</type></entry>
338 <entry></entry>
339 <entry>
340 The initial value of the transition state. This is a text
341 field containing the initial value in its external string
342 representation. If this field is NULL, the transition state
343 value starts out NULL
344 </entry>
345 </row>
346 </tbody>
347 </tgroup>
348 </table>
350 <para>
351 New aggregate functions are registered with the <xref
352 linkend="sql-createaggregate" endterm="sql-createaggregate-title">
353 command. See <xref linkend="xaggr"> for more information about
354 writing aggregate functions and the meaning of the transition
355 functions, etc.
356 </para>
358 </sect1>
361 <sect1 id="catalog-pg-am">
362 <title><structname>pg_am</structname></title>
364 <indexterm zone="catalog-pg-am">
365 <primary>pg_am</primary>
366 </indexterm>
368 <para>
369 The catalog <structname>pg_am</structname> stores information about index
370 access methods. There is one row for each index access method supported by
371 the system. The contents of this catalog are discussed in detail in
372 <xref linkend="indexam">.
373 </para>
375 <table>
376 <title><structname>pg_am</> Columns</title>
378 <tgroup cols=4>
379 <thead>
380 <row>
381 <entry>Name</entry>
382 <entry>Type</entry>
383 <entry>References</entry>
384 <entry>Description</entry>
385 </row>
386 </thead>
387 <tbody>
389 <row>
390 <entry><structfield>amname</structfield></entry>
391 <entry><type>name</type></entry>
392 <entry></entry>
393 <entry>Name of the access method</entry>
394 </row>
396 <row>
397 <entry><structfield>amstrategies</structfield></entry>
398 <entry><type>int2</type></entry>
399 <entry></entry>
400 <entry>Number of operator strategies for this access method,
401 or zero if access method does not have a fixed set of operator
402 strategies</entry>
403 </row>
405 <row>
406 <entry><structfield>amsupport</structfield></entry>
407 <entry><type>int2</type></entry>
408 <entry></entry>
409 <entry>Number of support routines for this access method</entry>
410 </row>
412 <row>
413 <entry><structfield>amcanorder</structfield></entry>
414 <entry><type>bool</type></entry>
415 <entry></entry>
416 <entry>Does the access method support ordered scans?</entry>
417 </row>
419 <row>
420 <entry><structfield>amcanbackward</structfield></entry>
421 <entry><type>bool</type></entry>
422 <entry></entry>
423 <entry>Does the access method support backward scanning?</entry>
424 </row>
426 <row>
427 <entry><structfield>amcanunique</structfield></entry>
428 <entry><type>bool</type></entry>
429 <entry></entry>
430 <entry>Does the access method support unique indexes?</entry>
431 </row>
433 <row>
434 <entry><structfield>amcanmulticol</structfield></entry>
435 <entry><type>bool</type></entry>
436 <entry></entry>
437 <entry>Does the access method support multicolumn indexes?</entry>
438 </row>
440 <row>
441 <entry><structfield>amoptionalkey</structfield></entry>
442 <entry><type>bool</type></entry>
443 <entry></entry>
444 <entry>Does the access method support a scan without any constraint
445 for the first index column?</entry>
446 </row>
448 <row>
449 <entry><structfield>amindexnulls</structfield></entry>
450 <entry><type>bool</type></entry>
451 <entry></entry>
452 <entry>Does the access method support null index entries?</entry>
453 </row>
455 <row>
456 <entry><structfield>amsearchnulls</structfield></entry>
457 <entry><type>bool</type></entry>
458 <entry></entry>
459 <entry>Does the access method support IS NULL searches?</entry>
460 </row>
462 <row>
463 <entry><structfield>amstorage</structfield></entry>
464 <entry><type>bool</type></entry>
465 <entry></entry>
466 <entry>Can index storage data type differ from column data type?</entry>
467 </row>
469 <row>
470 <entry><structfield>amclusterable</structfield></entry>
471 <entry><type>bool</type></entry>
472 <entry></entry>
473 <entry>Can an index of this type be clustered on?</entry>
474 </row>
476 <row>
477 <entry><structfield>amkeytype</structfield></entry>
478 <entry><type>oid</type></entry>
479 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
480 <entry>Type of data stored in index, or zero if not a fixed type</entry>
481 </row>
483 <row>
484 <entry><structfield>aminsert</structfield></entry>
485 <entry><type>regproc</type></entry>
486 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
487 <entry><quote>Insert this tuple</quote> function</entry>
488 </row>
490 <row>
491 <entry><structfield>ambeginscan</structfield></entry>
492 <entry><type>regproc</type></entry>
493 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
494 <entry><quote>Start new scan</quote> function</entry>
495 </row>
497 <row>
498 <entry><structfield>amgettuple</structfield></entry>
499 <entry><type>regproc</type></entry>
500 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
501 <entry><quote>Next valid tuple</quote> function</entry>
502 </row>
504 <row>
505 <entry><structfield>amgetbitmap</structfield></entry>
506 <entry><type>regproc</type></entry>
507 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
508 <entry><quote>Fetch all valid tuples</quote> function</entry>
509 </row>
511 <row>
512 <entry><structfield>amrescan</structfield></entry>
513 <entry><type>regproc</type></entry>
514 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
515 <entry><quote>Restart this scan</quote> function</entry>
516 </row>
518 <row>
519 <entry><structfield>amendscan</structfield></entry>
520 <entry><type>regproc</type></entry>
521 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
522 <entry><quote>End this scan</quote> function</entry>
523 </row>
525 <row>
526 <entry><structfield>ammarkpos</structfield></entry>
527 <entry><type>regproc</type></entry>
528 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
529 <entry><quote>Mark current scan position</quote> function</entry>
530 </row>
532 <row>
533 <entry><structfield>amrestrpos</structfield></entry>
534 <entry><type>regproc</type></entry>
535 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
536 <entry><quote>Restore marked scan position</quote> function</entry>
537 </row>
539 <row>
540 <entry><structfield>ambuild</structfield></entry>
541 <entry><type>regproc</type></entry>
542 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
543 <entry><quote>Build new index</quote> function</entry>
544 </row>
546 <row>
547 <entry><structfield>ambulkdelete</structfield></entry>
548 <entry><type>regproc</type></entry>
549 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
550 <entry>Bulk-delete function</entry>
551 </row>
553 <row>
554 <entry><structfield>amvacuumcleanup</structfield></entry>
555 <entry><type>regproc</type></entry>
556 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
557 <entry>Post-<command>VACUUM</command> cleanup function</entry>
558 </row>
560 <row>
561 <entry><structfield>amcostestimate</structfield></entry>
562 <entry><type>regproc</type></entry>
563 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
564 <entry>Function to estimate cost of an index scan</entry>
565 </row>
567 <row>
568 <entry><structfield>amoptions</structfield></entry>
569 <entry><type>regproc</type></entry>
570 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
571 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
572 </row>
574 </tbody>
575 </tgroup>
576 </table>
578 </sect1>
581 <sect1 id="catalog-pg-amop">
582 <title><structname>pg_amop</structname></title>
584 <indexterm zone="catalog-pg-amop">
585 <primary>pg_amop</primary>
586 </indexterm>
588 <para>
589 The catalog <structname>pg_amop</structname> stores information about
590 operators associated with access method operator families. There is one
591 row for each operator that is a member of an operator family. An operator
592 can appear in more than one family, but cannot appear in more than one
593 position within a family.
594 </para>
596 <table>
597 <title><structname>pg_amop</> Columns</title>
599 <tgroup cols=4>
600 <thead>
601 <row>
602 <entry>Name</entry>
603 <entry>Type</entry>
604 <entry>References</entry>
605 <entry>Description</entry>
606 </row>
607 </thead>
608 <tbody>
610 <row>
611 <entry><structfield>amopfamily</structfield></entry>
612 <entry><type>oid</type></entry>
613 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
614 <entry>The operator family this entry is for</entry>
615 </row>
617 <row>
618 <entry><structfield>amoplefttype</structfield></entry>
619 <entry><type>oid</type></entry>
620 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
621 <entry>Left-hand input data type of operator</entry>
622 </row>
624 <row>
625 <entry><structfield>amoprighttype</structfield></entry>
626 <entry><type>oid</type></entry>
627 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
628 <entry>Right-hand input data type of operator</entry>
629 </row>
631 <row>
632 <entry><structfield>amopstrategy</structfield></entry>
633 <entry><type>int2</type></entry>
634 <entry></entry>
635 <entry>Operator strategy number</entry>
636 </row>
638 <row>
639 <entry><structfield>amopopr</structfield></entry>
640 <entry><type>oid</type></entry>
641 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
642 <entry>OID of the operator</entry>
643 </row>
645 <row>
646 <entry><structfield>amopmethod</structfield></entry>
647 <entry><type>oid</type></entry>
648 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
649 <entry>Index access method operator family is for</entry>
650 </row>
652 </tbody>
653 </tgroup>
654 </table>
656 <para>
657 An entry's <structfield>amopmethod</> must match the
658 <structname>opfmethod</> of its containing operator family (including
659 <structfield>amopmethod</> here is an intentional denormalization of the
660 catalog structure for performance reasons). Also,
661 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
662 the <structfield>oprleft</> and <structfield>oprright</> fields of the
663 referenced <structname>pg_operator</> entry.
664 </para>
666 </sect1>
669 <sect1 id="catalog-pg-amproc">
670 <title><structname>pg_amproc</structname></title>
672 <indexterm zone="catalog-pg-amproc">
673 <primary>pg_amproc</primary>
674 </indexterm>
676 <para>
677 The catalog <structname>pg_amproc</structname> stores information about
678 support procedures associated with access method operator families. There
679 is one row for each support procedure belonging to an operator family.
680 </para>
682 <table>
683 <title><structname>pg_amproc</structname> Columns</title>
685 <tgroup cols=4>
686 <thead>
687 <row>
688 <entry>Name</entry>
689 <entry>Type</entry>
690 <entry>References</entry>
691 <entry>Description</entry>
692 </row>
693 </thead>
694 <tbody>
696 <row>
697 <entry><structfield>amprocfamily</structfield></entry>
698 <entry><type>oid</type></entry>
699 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
700 <entry>The operator family this entry is for</entry>
701 </row>
703 <row>
704 <entry><structfield>amproclefttype</structfield></entry>
705 <entry><type>oid</type></entry>
706 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
707 <entry>Left-hand input data type of associated operator</entry>
708 </row>
710 <row>
711 <entry><structfield>amprocrighttype</structfield></entry>
712 <entry><type>oid</type></entry>
713 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
714 <entry>Right-hand input data type of associated operator</entry>
715 </row>
717 <row>
718 <entry><structfield>amprocnum</structfield></entry>
719 <entry><type>int2</type></entry>
720 <entry></entry>
721 <entry>Support procedure number</entry>
722 </row>
724 <row>
725 <entry><structfield>amproc</structfield></entry>
726 <entry><type>regproc</type></entry>
727 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
728 <entry>OID of the procedure</entry>
729 </row>
731 </tbody>
732 </tgroup>
733 </table>
735 <para>
736 The usual interpretation of the
737 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
738 is that they identify the left and right input types of the operator(s)
739 that a particular support procedure supports. For some access methods
740 these match the input data type(s) of the support procedure itself, for
741 others not. There is a notion of <quote>default</> support procedures for
742 an index, which are those with <structfield>amproclefttype</> and
743 <structfield>amprocrighttype</> both equal to the index opclass's
744 <structfield>opcintype</>.
745 </para>
747 </sect1>
750 <sect1 id="catalog-pg-attrdef">
751 <title><structname>pg_attrdef</structname></title>
753 <indexterm zone="catalog-pg-attrdef">
754 <primary>pg_attrdef</primary>
755 </indexterm>
757 <para>
758 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
759 about columns is stored in <structname>pg_attribute</structname>
760 (see below). Only columns that explicitly specify a default value
761 (when the table is created or the column is added) will have an
762 entry here.
763 </para>
765 <table>
766 <title><structname>pg_attrdef</> Columns</title>
768 <tgroup cols=4>
769 <thead>
770 <row>
771 <entry>Name</entry>
772 <entry>Type</entry>
773 <entry>References</entry>
774 <entry>Description</entry>
775 </row>
776 </thead>
778 <tbody>
779 <row>
780 <entry><structfield>adrelid</structfield></entry>
781 <entry><type>oid</type></entry>
782 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
783 <entry>The table this column belongs to</entry>
784 </row>
786 <row>
787 <entry><structfield>adnum</structfield></entry>
788 <entry><type>int2</type></entry>
789 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
790 <entry>The number of the column</entry>
791 </row>
793 <row>
794 <entry><structfield>adbin</structfield></entry>
795 <entry><type>text</type></entry>
796 <entry></entry>
797 <entry>The internal representation of the column default value</entry>
798 </row>
800 <row>
801 <entry><structfield>adsrc</structfield></entry>
802 <entry><type>text</type></entry>
803 <entry></entry>
804 <entry>A human-readable representation of the default value</entry>
805 </row>
806 </tbody>
807 </tgroup>
808 </table>
810 <para>
811 The <structfield>adsrc</structfield> field is historical, and is best
812 not used, because it does not track outside changes that might affect
813 the representation of the default value. Reverse-compiling the
814 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
815 example) is a better way to display the default value.
816 </para>
818 </sect1>
821 <sect1 id="catalog-pg-attribute">
822 <title><structname>pg_attribute</structname></title>
824 <indexterm zone="catalog-pg-attribute">
825 <primary>pg_attribute</primary>
826 </indexterm>
828 <para>
829 The catalog <structname>pg_attribute</structname> stores information about
830 table columns. There will be exactly one
831 <structname>pg_attribute</structname> row for every column in every
832 table in the database. (There will also be attribute entries for
833 indexes, and indeed all objects that have <structname>pg_class</structname>
834 entries.)
835 </para>
837 <para>
838 The term attribute is equivalent to column and is used for
839 historical reasons.
840 </para>
842 <table>
843 <title><structname>pg_attribute</> Columns</title>
845 <tgroup cols=4>
846 <thead>
847 <row>
848 <entry>Name</entry>
849 <entry>Type</entry>
850 <entry>References</entry>
851 <entry>Description</entry>
852 </row>
853 </thead>
855 <tbody>
856 <row>
857 <entry><structfield>attrelid</structfield></entry>
858 <entry><type>oid</type></entry>
859 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
860 <entry>The table this column belongs to</entry>
861 </row>
863 <row>
864 <entry><structfield>attname</structfield></entry>
865 <entry><type>name</type></entry>
866 <entry></entry>
867 <entry>The column name</entry>
868 </row>
870 <row>
871 <entry><structfield>atttypid</structfield></entry>
872 <entry><type>oid</type></entry>
873 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
874 <entry>The data type of this column</entry>
875 </row>
877 <row>
878 <entry><structfield>attstattarget</structfield></entry>
879 <entry><type>int4</type></entry>
880 <entry></entry>
881 <entry>
882 <structfield>attstattarget</structfield> controls the level of detail
883 of statistics accumulated for this column by
884 <xref linkend="sql-analyze" endterm="sql-analyze-title">.
885 A zero value indicates that no statistics should be collected.
886 A negative value says to use the system default statistics target.
887 The exact meaning of positive values is data type-dependent.
888 For scalar data types, <structfield>attstattarget</structfield>
889 is both the target number of <quote>most common values</quote>
890 to collect, and the target number of histogram bins to create
891 </entry>
892 </row>
894 <row>
895 <entry><structfield>attlen</structfield></entry>
896 <entry><type>int2</type></entry>
897 <entry></entry>
898 <entry>
899 A copy of <literal>pg_type.typlen</literal> of this column's
900 type
901 </entry>
902 </row>
904 <row>
905 <entry><structfield>attnum</structfield></entry>
906 <entry><type>int2</type></entry>
907 <entry></entry>
908 <entry>
909 The number of the column. Ordinary columns are numbered from 1
910 up. System columns, such as <structfield>oid</structfield>,
911 have (arbitrary) negative numbers
912 </entry>
913 </row>
915 <row>
916 <entry><structfield>attndims</structfield></entry>
917 <entry><type>int4</type></entry>
918 <entry></entry>
919 <entry>
920 Number of dimensions, if the column is an array type; otherwise 0.
921 (Presently, the number of dimensions of an array is not enforced,
922 so any nonzero value effectively means <quote>it's an array</>)
923 </entry>
924 </row>
926 <row>
927 <entry><structfield>attcacheoff</structfield></entry>
928 <entry><type>int4</type></entry>
929 <entry></entry>
930 <entry>
931 Always -1 in storage, but when loaded into a row descriptor
932 in memory this might be updated to cache the offset of the attribute
933 within the row
934 </entry>
935 </row>
937 <row>
938 <entry><structfield>atttypmod</structfield></entry>
939 <entry><type>int4</type></entry>
940 <entry></entry>
941 <entry>
942 <structfield>atttypmod</structfield> records type-specific data
943 supplied at table creation time (for example, the maximum
944 length of a <type>varchar</type> column). It is passed to
945 type-specific input functions and length coercion functions.
946 The value will generally be -1 for types that do not need <structfield>atttypmod</>
947 </entry>
948 </row>
950 <row>
951 <entry><structfield>attbyval</structfield></entry>
952 <entry><type>bool</type></entry>
953 <entry></entry>
954 <entry>
955 A copy of <literal>pg_type.typbyval</> of this column's type
956 </entry>
957 </row>
959 <row>
960 <entry><structfield>attstorage</structfield></entry>
961 <entry><type>char</type></entry>
962 <entry></entry>
963 <entry>
964 Normally a copy of <literal>pg_type.typstorage</> of this
965 column's type. For TOAST-able data types, this can be altered
966 after column creation to control storage policy
967 </entry>
968 </row>
970 <row>
971 <entry><structfield>attalign</structfield></entry>
972 <entry><type>char</type></entry>
973 <entry></entry>
974 <entry>
975 A copy of <literal>pg_type.typalign</> of this column's type
976 </entry>
977 </row>
979 <row>
980 <entry><structfield>attnotnull</structfield></entry>
981 <entry><type>bool</type></entry>
982 <entry></entry>
983 <entry>
984 This represents a not-null constraint. It is possible to
985 change this column to enable or disable the constraint
986 </entry>
987 </row>
989 <row>
990 <entry><structfield>atthasdef</structfield></entry>
991 <entry><type>bool</type></entry>
992 <entry></entry>
993 <entry>
994 This column has a default value, in which case there will be a
995 corresponding entry in the <structname>pg_attrdef</structname>
996 catalog that actually defines the value
997 </entry>
998 </row>
1000 <row>
1001 <entry><structfield>attisdropped</structfield></entry>
1002 <entry><type>bool</type></entry>
1003 <entry></entry>
1004 <entry>
1005 This column has been dropped and is no longer valid. A dropped
1006 column is still physically present in the table, but is
1007 ignored by the parser and so cannot be accessed via SQL
1008 </entry>
1009 </row>
1011 <row>
1012 <entry><structfield>attislocal</structfield></entry>
1013 <entry><type>bool</type></entry>
1014 <entry></entry>
1015 <entry>
1016 This column is defined locally in the relation. Note that a column can
1017 be locally defined and inherited simultaneously
1018 </entry>
1019 </row>
1021 <row>
1022 <entry><structfield>attinhcount</structfield></entry>
1023 <entry><type>int4</type></entry>
1024 <entry></entry>
1025 <entry>
1026 The number of direct ancestors this column has. A column with a
1027 nonzero number of ancestors cannot be dropped nor renamed
1028 </entry>
1029 </row>
1031 </tbody>
1032 </tgroup>
1033 </table>
1035 <para>
1036 In a dropped column's <structname>pg_attribute</structname> entry,
1037 <structfield>atttypid</structfield> is reset to zero, but
1038 <structfield>attlen</structfield> and the other fields copied from
1039 <structname>pg_type</> are still valid. This arrangement is needed
1040 to cope with the situation where the dropped column's data type was
1041 later dropped, and so there is no <structname>pg_type</> row anymore.
1042 <structfield>attlen</structfield> and the other fields can be used
1043 to interpret the contents of a row of the table.
1044 </para>
1045 </sect1>
1048 <sect1 id="catalog-pg-authid">
1049 <title><structname>pg_authid</structname></title>
1051 <indexterm zone="catalog-pg-authid">
1052 <primary>pg_authid</primary>
1053 </indexterm>
1055 <para>
1056 The catalog <structname>pg_authid</structname> contains information about
1057 database authorization identifiers (roles). A role subsumes the concepts
1058 of <quote>users</> and <quote>groups</>. A user is essentially just a
1059 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1060 without <structfield>rolcanlogin</>) can have other roles as members; see
1061 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1062 </para>
1064 <para>
1065 Since this catalog contains passwords, it must not be publicly readable.
1066 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1067 is a publicly readable view on
1068 <structname>pg_authid</structname> that blanks out the password field.
1069 </para>
1071 <para>
1072 <xref linkend="user-manag"> contains detailed information about user and
1073 privilege management.
1074 </para>
1076 <para>
1077 Because user identities are cluster-wide,
1078 <structname>pg_authid</structname>
1079 is shared across all databases of a cluster: there is only one
1080 copy of <structname>pg_authid</structname> per cluster, not
1081 one per database.
1082 </para>
1084 <table>
1085 <title><structname>pg_authid</> Columns</title>
1087 <tgroup cols=3>
1088 <thead>
1089 <row>
1090 <entry>Name</entry>
1091 <entry>Type</entry>
1092 <entry>Description</entry>
1093 </row>
1094 </thead>
1096 <tbody>
1097 <row>
1098 <entry><structfield>rolname</structfield></entry>
1099 <entry><type>name</type></entry>
1100 <entry>Role name</entry>
1101 </row>
1103 <row>
1104 <entry><structfield>rolsuper</structfield></entry>
1105 <entry><type>bool</type></entry>
1106 <entry>Role has superuser privileges</entry>
1107 </row>
1109 <row>
1110 <entry><structfield>rolinherit</structfield></entry>
1111 <entry><type>bool</type></entry>
1112 <entry>Role automatically inherits privileges of roles it is a
1113 member of</entry>
1114 </row>
1116 <row>
1117 <entry><structfield>rolcreaterole</structfield></entry>
1118 <entry><type>bool</type></entry>
1119 <entry>Role can create more roles</entry>
1120 </row>
1122 <row>
1123 <entry><structfield>rolcreatedb</structfield></entry>
1124 <entry><type>bool</type></entry>
1125 <entry>Role can create databases</entry>
1126 </row>
1128 <row>
1129 <entry><structfield>rolcatupdate</structfield></entry>
1130 <entry><type>bool</type></entry>
1131 <entry>
1132 Role can update system catalogs directly. (Even a superuser cannot do
1133 this unless this column is true)
1134 </entry>
1135 </row>
1137 <row>
1138 <entry><structfield>rolcanlogin</structfield></entry>
1139 <entry><type>bool</type></entry>
1140 <entry>
1141 Role can log in. That is, this role can be given as the initial
1142 session authorization identifier
1143 </entry>
1144 </row>
1146 <row>
1147 <entry><structfield>rolconnlimit</structfield></entry>
1148 <entry><type>int4</type></entry>
1149 <entry>
1150 For roles that can log in, this sets maximum number of concurrent
1151 connections this role can make. -1 means no limit
1152 </entry>
1153 </row>
1155 <row>
1156 <entry><structfield>rolpassword</structfield></entry>
1157 <entry><type>text</type></entry>
1158 <entry>Password (possibly encrypted); NULL if none</entry>
1159 </row>
1161 <row>
1162 <entry><structfield>rolvaliduntil</structfield></entry>
1163 <entry><type>timestamptz</type></entry>
1164 <entry>Password expiry time (only used for password authentication);
1165 NULL if no expiration</entry>
1166 </row>
1168 <row>
1169 <entry><structfield>rolconfig</structfield></entry>
1170 <entry><type>text[]</type></entry>
1171 <entry>Session defaults for run-time configuration variables</entry>
1172 </row>
1173 </tbody>
1174 </tgroup>
1175 </table>
1177 </sect1>
1180 <sect1 id="catalog-pg-auth-members">
1181 <title><structname>pg_auth_members</structname></title>
1183 <indexterm zone="catalog-pg-auth-members">
1184 <primary>pg_auth_members</primary>
1185 </indexterm>
1187 <para>
1188 The catalog <structname>pg_auth_members</structname> shows the membership
1189 relations between roles. Any non-circular set of relationships is allowed.
1190 </para>
1192 <para>
1193 Because user identities are cluster-wide,
1194 <structname>pg_auth_members</structname>
1195 is shared across all databases of a cluster: there is only one
1196 copy of <structname>pg_auth_members</structname> per cluster, not
1197 one per database.
1198 </para>
1200 <table>
1201 <title><structname>pg_auth_members</> Columns</title>
1203 <tgroup cols=4>
1204 <thead>
1205 <row>
1206 <entry>Name</entry>
1207 <entry>Type</entry>
1208 <entry>References</entry>
1209 <entry>Description</entry>
1210 </row>
1211 </thead>
1213 <tbody>
1214 <row>
1215 <entry><structfield>roleid</structfield></entry>
1216 <entry><type>oid</type></entry>
1217 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1218 <entry>ID of a role that has a member</entry>
1219 </row>
1221 <row>
1222 <entry><structfield>member</structfield></entry>
1223 <entry><type>oid</type></entry>
1224 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1225 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1226 </row>
1228 <row>
1229 <entry><structfield>grantor</structfield></entry>
1230 <entry><type>oid</type></entry>
1231 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1232 <entry>ID of the role that granted this membership</entry>
1233 </row>
1235 <row>
1236 <entry><structfield>admin_option</structfield></entry>
1237 <entry><type>bool</type></entry>
1238 <entry></entry>
1239 <entry>True if <structfield>member</> can grant membership in
1240 <structfield>roleid</> to others</entry>
1241 </row>
1242 </tbody>
1243 </tgroup>
1244 </table>
1246 </sect1>
1249 <sect1 id="catalog-pg-autovacuum">
1250 <title><structname>pg_autovacuum</structname></title>
1252 <indexterm zone="catalog-pg-autovacuum">
1253 <primary>pg_autovacuum</primary>
1254 </indexterm>
1256 <indexterm zone="catalog-pg-autovacuum">
1257 <primary>autovacuum</primary>
1258 <secondary>table-specific configuration</secondary>
1259 </indexterm>
1261 <para>
1262 The catalog <structname>pg_autovacuum</structname> stores optional
1263 per-relation configuration parameters for the autovacuum daemon.
1264 If there is an entry here for a particular relation, the given
1265 parameters will be used for autovacuuming that table. If no entry
1266 is present, the system-wide defaults will be used. For more information
1267 about the autovacuum daemon, see <xref linkend="autovacuum">.
1268 </para>
1270 <note>
1271 <para>
1272 It is likely that <structname>pg_autovacuum</structname> will disappear
1273 in a future release, with the information instead being kept in
1274 <structname>pg_class</>.<structfield>reloptions</> entries.
1275 </para>
1276 </note>
1278 <table>
1279 <title><structname>pg_autovacuum</> Columns</title>
1281 <tgroup cols=4>
1282 <thead>
1283 <row>
1284 <entry>Name</entry>
1285 <entry>Type</entry>
1286 <entry>References</entry>
1287 <entry>Description</entry>
1288 </row>
1289 </thead>
1291 <tbody>
1292 <row>
1293 <entry><structfield>vacrelid</structfield></entry>
1294 <entry><type>oid</type></entry>
1295 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1296 <entry>The table this entry is for</entry>
1297 </row>
1299 <row>
1300 <entry><structfield>enabled</structfield></entry>
1301 <entry><type>bool</type></entry>
1302 <entry></entry>
1303 <entry>If false, this table will not be autovacuumed, except
1304 to prevent transaction ID wraparound</entry>
1305 </row>
1307 <row>
1308 <entry><structfield>vac_base_thresh</structfield></entry>
1309 <entry><type>integer</type></entry>
1310 <entry></entry>
1311 <entry>Minimum number of modified tuples before vacuum</entry>
1312 </row>
1314 <row>
1315 <entry><structfield>vac_scale_factor</structfield></entry>
1316 <entry><type>float4</type></entry>
1317 <entry></entry>
1318 <entry>Multiplier for <structfield>reltuples</> to add to
1319 <structfield>vac_base_thresh</></entry>
1320 </row>
1322 <row>
1323 <entry><structfield>anl_base_thresh</structfield></entry>
1324 <entry><type>integer</type></entry>
1325 <entry></entry>
1326 <entry>Minimum number of modified tuples before analyze</entry>
1327 </row>
1329 <row>
1330 <entry><structfield>anl_scale_factor</structfield></entry>
1331 <entry><type>float4</type></entry>
1332 <entry></entry>
1333 <entry>Multiplier for <structfield>reltuples</> to add to
1334 <structfield>anl_base_thresh</></entry>
1335 </row>
1337 <row>
1338 <entry><structfield>vac_cost_delay</structfield></entry>
1339 <entry><type>integer</type></entry>
1340 <entry></entry>
1341 <entry>Custom <varname>vacuum_cost_delay</> parameter</entry>
1342 </row>
1344 <row>
1345 <entry><structfield>vac_cost_limit</structfield></entry>
1346 <entry><type>integer</type></entry>
1347 <entry></entry>
1348 <entry>Custom <varname>vacuum_cost_limit</> parameter</entry>
1349 </row>
1351 <row>
1352 <entry><structfield>freeze_min_age</structfield></entry>
1353 <entry><type>integer</type></entry>
1354 <entry></entry>
1355 <entry>Custom <varname>vacuum_freeze_min_age</> parameter</entry>
1356 </row>
1358 <row>
1359 <entry><structfield>freeze_max_age</structfield></entry>
1360 <entry><type>integer</type></entry>
1361 <entry></entry>
1362 <entry>Custom <varname>autovacuum_freeze_max_age</> parameter</entry>
1363 </row>
1364 </tbody>
1365 </tgroup>
1366 </table>
1368 <para>
1369 The autovacuum daemon will initiate a <command>VACUUM</> operation
1370 on a particular table when the number of updated or deleted tuples
1371 exceeds <structfield>vac_base_thresh</structfield> plus
1372 <structfield>vac_scale_factor</structfield> times the number of
1373 live tuples currently estimated to be in the relation.
1374 Similarly, it will initiate an <command>ANALYZE</> operation
1375 when the number of inserted, updated or deleted tuples
1376 exceeds <structfield>anl_base_thresh</structfield> plus
1377 <structfield>anl_scale_factor</structfield> times the number of
1378 live tuples currently estimated to be in the relation.
1379 </para>
1381 <para>
1382 Also, the autovacuum daemon will perform a <command>VACUUM</> operation
1383 to prevent transaction ID wraparound if the table's
1384 <structname>pg_class</>.<structfield>relfrozenxid</> field attains an age
1385 of more than <structfield>freeze_max_age</> transactions, whether the table
1386 has been changed or not, even if
1387 <structname>pg_autovacuum</>.<structfield>enabled</> is set to
1388 <literal>false</> for it. The system will launch autovacuum to perform
1389 such <command>VACUUM</>s even if autovacuum is otherwise disabled.
1390 See <xref linkend="vacuum-for-wraparound"> for more about wraparound
1391 prevention.
1392 </para>
1394 <para>
1395 Any of the numerical fields can contain <literal>-1</> (or indeed
1396 any negative value) to indicate that the system-wide default should
1397 be used for this particular value. Observe that the
1398 <structfield>vac_cost_delay</> variable inherits its default value from the
1399 <xref linkend="guc-autovacuum-vacuum-cost-delay"> configuration parameter,
1400 or from <xref linkend="guc-vacuum-cost-delay"> if the former is set to a
1401 negative value. The same applies to <structfield>vac_cost_limit</>.
1402 Also, autovacuum will ignore attempts to set a per-table
1403 <structfield>freeze_max_age</> larger than the system-wide setting (it can
1404 only be set smaller), and the <structfield>freeze_min_age</> value will be
1405 limited to half the system-wide <xref
1406 linkend="guc-autovacuum-freeze-max-age"> setting. Note that while you
1407 can set <structfield>freeze_max_age</> very small, or even zero, this
1408 is usually unwise since it will force frequent vacuuming.
1409 </para>
1411 </sect1>
1414 <sect1 id="catalog-pg-cast">
1415 <title><structname>pg_cast</structname></title>
1417 <indexterm zone="catalog-pg-cast">
1418 <primary>pg_cast</primary>
1419 </indexterm>
1421 <para>
1422 The catalog <structname>pg_cast</structname> stores data type conversion
1423 paths, both built-in paths and those defined with
1424 <xref linkend="sql-createcast" endterm="sql-createcast-title">.
1425 </para>
1427 <para>
1428 It should be noted that <structname>pg_cast</structname> does not represent
1429 every type conversion that the system knows how to perform; only those that
1430 cannot be deduced from some generic rule. For example, casting between a
1431 domain and its base type is not explicitly represented in
1432 <structname>pg_cast</structname>. Another important exception is that
1433 <quote>automatic I/O conversion casts</>, those performed using a data
1434 type's own I/O functions to convert to or from <type>text</> or other
1435 string types, are not explicitly represented in
1436 <structname>pg_cast</structname>.
1437 </para>
1439 <table>
1440 <title><structname>pg_cast</> Columns</title>
1442 <tgroup cols=4>
1443 <thead>
1444 <row>
1445 <entry>Name</entry>
1446 <entry>Type</entry>
1447 <entry>References</entry>
1448 <entry>Description</entry>
1449 </row>
1450 </thead>
1452 <tbody>
1453 <row>
1454 <entry><structfield>castsource</structfield></entry>
1455 <entry><type>oid</type></entry>
1456 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1457 <entry>OID of the source data type</entry>
1458 </row>
1460 <row>
1461 <entry><structfield>casttarget</structfield></entry>
1462 <entry><type>oid</type></entry>
1463 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1464 <entry>OID of the target data type</entry>
1465 </row>
1467 <row>
1468 <entry><structfield>castfunc</structfield></entry>
1469 <entry><type>oid</type></entry>
1470 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1471 <entry>
1472 The OID of the function to use to perform this cast. Zero is
1473 stored if the cast method doesn't require a function.
1474 </entry>
1475 </row>
1477 <row>
1478 <entry><structfield>castcontext</structfield></entry>
1479 <entry><type>char</type></entry>
1480 <entry></entry>
1481 <entry>
1482 Indicates what contexts the cast can be invoked in.
1483 <literal>e</> means only as an explicit cast (using
1484 <literal>CAST</> or <literal>::</> syntax).
1485 <literal>a</> means implicitly in assignment
1486 to a target column, as well as explicitly.
1487 <literal>i</> means implicitly in expressions, as well as the
1488 other cases
1489 </entry>
1490 </row>
1491 <row>
1492 <entry><structfield>castmethod</structfield></entry>
1493 <entry><type>char</type></entry>
1494 <entry></entry>
1495 <entry>
1496 Indicates how the cast is performed.
1497 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1498 <literal>i</> means that the input/output functions are used.
1499 <literal>b</> means that the types are binary-coercible, thus no conversion is required
1500 </entry>
1501 </row>
1502 </tbody>
1503 </tgroup>
1504 </table>
1506 <para>
1507 The cast functions listed in <structname>pg_cast</structname> must
1508 always take the cast source type as their first argument type, and
1509 return the cast destination type as their result type. A cast
1510 function can have up to three arguments. The second argument,
1511 if present, must be type <type>integer</>; it receives the type
1512 modifier associated with the destination type, or <literal>-1</>
1513 if there is none. The third argument,
1514 if present, must be type <type>boolean</>; it receives <literal>true</>
1515 if the cast is an explicit cast, <literal>false</> otherwise.
1516 </para>
1518 <para>
1519 It is legitimate to create a <structname>pg_cast</structname> entry
1520 in which the source and target types are the same, if the associated
1521 function takes more than one argument. Such entries represent
1522 <quote>length coercion functions</> that coerce values of the type
1523 to be legal for a particular type modifier value.
1524 </para>
1526 <para>
1527 When a <structname>pg_cast</structname> entry has different source and
1528 target types and a function that takes more than one argument, it
1529 represents converting from one type to another and applying a length
1530 coercion in a single step. When no such entry is available, coercion
1531 to a type that uses a type modifier involves two steps, one to
1532 convert between data types and a second to apply the modifier.
1533 </para>
1534 </sect1>
1536 <sect1 id="catalog-pg-class">
1537 <title><structname>pg_class</structname></title>
1539 <indexterm zone="catalog-pg-class">
1540 <primary>pg_class</primary>
1541 </indexterm>
1543 <para>
1544 The catalog <structname>pg_class</structname> catalogs tables and most
1545 everything else that has columns or is otherwise similar to a
1546 table. This includes indexes (but see also
1547 <structname>pg_index</structname>), sequences, views, composite types,
1548 and TOAST tables; see <structfield>relkind</>.
1549 Below, when we mean all of these
1550 kinds of objects we speak of <quote>relations</quote>. Not all
1551 columns are meaningful for all relation types.
1552 </para>
1554 <table>
1555 <title><structname>pg_class</> Columns</title>
1557 <tgroup cols=4>
1558 <thead>
1559 <row>
1560 <entry>Name</entry>
1561 <entry>Type</entry>
1562 <entry>References</entry>
1563 <entry>Description</entry>
1564 </row>
1565 </thead>
1567 <tbody>
1568 <row>
1569 <entry><structfield>relname</structfield></entry>
1570 <entry><type>name</type></entry>
1571 <entry></entry>
1572 <entry>Name of the table, index, view, etc.</entry>
1573 </row>
1575 <row>
1576 <entry><structfield>relnamespace</structfield></entry>
1577 <entry><type>oid</type></entry>
1578 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1579 <entry>
1580 The OID of the namespace that contains this relation
1581 </entry>
1582 </row>
1584 <row>
1585 <entry><structfield>reltype</structfield></entry>
1586 <entry><type>oid</type></entry>
1587 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1588 <entry>
1589 The OID of the data type that corresponds to this table's row type,
1590 if any (zero for indexes, which have no <structname>pg_type</> entry)
1591 </entry>
1592 </row>
1594 <row>
1595 <entry><structfield>relowner</structfield></entry>
1596 <entry><type>oid</type></entry>
1597 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1598 <entry>Owner of the relation</entry>
1599 </row>
1601 <row>
1602 <entry><structfield>relam</structfield></entry>
1603 <entry><type>oid</type></entry>
1604 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1605 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1606 </row>
1608 <row>
1609 <entry><structfield>relfilenode</structfield></entry>
1610 <entry><type>oid</type></entry>
1611 <entry></entry>
1612 <entry>Name of the on-disk file of this relation; 0 if none</entry>
1613 </row>
1615 <row>
1616 <entry><structfield>reltablespace</structfield></entry>
1617 <entry><type>oid</type></entry>
1618 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1619 <entry>
1620 The tablespace in which this relation is stored. If zero,
1621 the database's default tablespace is implied. (Not meaningful
1622 if the relation has no on-disk file.)
1623 </entry>
1624 </row>
1626 <row>
1627 <entry><structfield>relpages</structfield></entry>
1628 <entry><type>int4</type></entry>
1629 <entry></entry>
1630 <entry>
1631 Size of the on-disk representation of this table in pages (of size
1632 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1633 planner. It is updated by <command>VACUUM</command>,
1634 <command>ANALYZE</command>, and a few DDL commands such as
1635 <command>CREATE INDEX</command>
1636 </entry>
1637 </row>
1639 <row>
1640 <entry><structfield>reltuples</structfield></entry>
1641 <entry><type>float4</type></entry>
1642 <entry></entry>
1643 <entry>
1644 Number of rows in the table. This is only an estimate used by the
1645 planner. It is updated by <command>VACUUM</command>,
1646 <command>ANALYZE</command>, and a few DDL commands such as
1647 <command>CREATE INDEX</command>
1648 </entry>
1649 </row>
1651 <row>
1652 <entry><structfield>reltoastrelid</structfield></entry>
1653 <entry><type>oid</type></entry>
1654 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1655 <entry>
1656 OID of the TOAST table associated with this table, 0 if none. The
1657 TOAST table stores large attributes <quote>out of line</quote> in a
1658 secondary table
1659 </entry>
1660 </row>
1662 <row>
1663 <entry><structfield>reltoastidxid</structfield></entry>
1664 <entry><type>oid</type></entry>
1665 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1666 <entry>
1667 For a TOAST table, the OID of its index. 0 if not a TOAST table
1668 </entry>
1669 </row>
1671 <row>
1672 <entry><structfield>relhasindex</structfield></entry>
1673 <entry><type>bool</type></entry>
1674 <entry></entry>
1675 <entry>
1676 True if this is a table and it has (or recently had) any
1677 indexes. This is set by <command>CREATE INDEX</command>, but
1678 not cleared immediately by <command>DROP INDEX</command>.
1679 <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the
1680 table has no indexes
1681 </entry>
1682 </row>
1684 <row>
1685 <entry><structfield>relisshared</structfield></entry>
1686 <entry><type>bool</type></entry>
1687 <entry></entry>
1688 <entry>
1689 True if this table is shared across all databases in the cluster. Only
1690 certain system catalogs (such as <structname>pg_database</structname>)
1691 are shared
1692 </entry>
1693 </row>
1695 <row>
1696 <entry><structfield>relkind</structfield></entry>
1697 <entry><type>char</type></entry>
1698 <entry></entry>
1699 <entry>
1700 <literal>r</> = ordinary table, <literal>i</> = index,
1701 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1702 composite type, <literal>t</> = TOAST
1703 table
1704 </entry>
1705 </row>
1707 <row>
1708 <entry><structfield>relnatts</structfield></entry>
1709 <entry><type>int2</type></entry>
1710 <entry></entry>
1711 <entry>
1712 Number of user columns in the relation (system columns not
1713 counted). There must be this many corresponding entries in
1714 <structname>pg_attribute</structname>. See also
1715 <literal>pg_attribute.attnum</literal>
1716 </entry>
1717 </row>
1719 <row>
1720 <entry><structfield>relchecks</structfield></entry>
1721 <entry><type>int2</type></entry>
1722 <entry></entry>
1723 <entry>
1724 Number of check constraints on the table; see
1725 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1726 </entry>
1727 </row>
1729 <row>
1730 <entry><structfield>relhasoids</structfield></entry>
1731 <entry><type>bool</type></entry>
1732 <entry></entry>
1733 <entry>
1734 True if we generate an OID for each row of the relation
1735 </entry>
1736 </row>
1738 <row>
1739 <entry><structfield>relhaspkey</structfield></entry>
1740 <entry><type>bool</type></entry>
1741 <entry></entry>
1742 <entry>
1743 True if the table has (or once had) a primary key
1744 </entry>
1745 </row>
1747 <row>
1748 <entry><structfield>relhasrules</structfield></entry>
1749 <entry><type>bool</type></entry>
1750 <entry></entry>
1751 <entry>
1752 True if table has (or once had) rules; see
1753 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1754 </entry>
1755 </row>
1757 <row>
1758 <entry><structfield>relhastriggers</structfield></entry>
1759 <entry><type>bool</type></entry>
1760 <entry></entry>
1761 <entry>
1762 True if table has (or once had) triggers; see
1763 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1764 </entry>
1765 </row>
1767 <row>
1768 <entry><structfield>relhassubclass</structfield></entry>
1769 <entry><type>bool</type></entry>
1770 <entry></entry>
1771 <entry>True if table has (or once had) any inheritance children</entry>
1772 </row>
1774 <row>
1775 <entry><structfield>relfrozenxid</structfield></entry>
1776 <entry><type>xid</type></entry>
1777 <entry></entry>
1778 <entry>
1779 All transaction IDs before this one have been replaced with a permanent
1780 (<quote>frozen</>) transaction ID in this table. This is used to track
1781 whether the table needs to be vacuumed in order to prevent transaction
1782 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1783 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table
1784 </entry>
1785 </row>
1787 <row>
1788 <entry><structfield>relacl</structfield></entry>
1789 <entry><type>aclitem[]</type></entry>
1790 <entry></entry>
1791 <entry>
1792 Access privileges; see
1793 <xref linkend="sql-grant" endterm="sql-grant-title"> and
1794 <xref linkend="sql-revoke" endterm="sql-revoke-title">
1795 for details
1796 </entry>
1797 </row>
1799 <row>
1800 <entry><structfield>reloptions</structfield></entry>
1801 <entry><type>text[]</type></entry>
1802 <entry></entry>
1803 <entry>
1804 Access-method-specific options, as <quote>keyword=value</> strings
1805 </entry>
1806 </row>
1807 </tbody>
1808 </tgroup>
1809 </table>
1810 </sect1>
1812 <sect1 id="catalog-pg-constraint">
1813 <title><structname>pg_constraint</structname></title>
1815 <indexterm zone="catalog-pg-constraint">
1816 <primary>pg_constraint</primary>
1817 </indexterm>
1819 <para>
1820 The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
1821 key constraints on tables. (Column constraints are not treated
1822 specially. Every column constraint is equivalent to some table
1823 constraint.) Not-null constraints are represented in the
1824 <structname>pg_attribute</> catalog.
1825 </para>
1827 <para>
1828 Check constraints on domains are stored here, too.
1829 </para>
1831 <table>
1832 <title><structname>pg_constraint</> Columns</title>
1834 <tgroup cols=4>
1835 <thead>
1836 <row>
1837 <entry>Name</entry>
1838 <entry>Type</entry>
1839 <entry>References</entry>
1840 <entry>Description</entry>
1841 </row>
1842 </thead>
1844 <tbody>
1845 <row>
1846 <entry><structfield>conname</structfield></entry>
1847 <entry><type>name</type></entry>
1848 <entry></entry>
1849 <entry>Constraint name (not necessarily unique!)</entry>
1850 </row>
1852 <row>
1853 <entry><structfield>connamespace</structfield></entry>
1854 <entry><type>oid</type></entry>
1855 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1856 <entry>
1857 The OID of the namespace that contains this constraint
1858 </entry>
1859 </row>
1861 <row>
1862 <entry><structfield>contype</structfield></entry>
1863 <entry><type>char</type></entry>
1864 <entry></entry>
1865 <entry>
1866 <literal>c</> = check constraint,
1867 <literal>f</> = foreign key constraint,
1868 <literal>p</> = primary key constraint,
1869 <literal>u</> = unique constraint
1870 </entry>
1871 </row>
1873 <row>
1874 <entry><structfield>condeferrable</structfield></entry>
1875 <entry><type>bool</type></entry>
1876 <entry></entry>
1877 <entry>Is the constraint deferrable?</entry>
1878 </row>
1880 <row>
1881 <entry><structfield>condeferred</structfield></entry>
1882 <entry><type>bool</type></entry>
1883 <entry></entry>
1884 <entry>Is the constraint deferred by default?</entry>
1885 </row>
1887 <row>
1888 <entry><structfield>conrelid</structfield></entry>
1889 <entry><type>oid</type></entry>
1890 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1891 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1892 </row>
1894 <row>
1895 <entry><structfield>contypid</structfield></entry>
1896 <entry><type>oid</type></entry>
1897 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1898 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1899 </row>
1901 <row>
1902 <entry><structfield>confrelid</structfield></entry>
1903 <entry><type>oid</type></entry>
1904 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1905 <entry>If a foreign key, the referenced table; else 0</entry>
1906 </row>
1908 <row>
1909 <entry><structfield>confupdtype</structfield></entry>
1910 <entry><type>char</type></entry>
1911 <entry></entry>
1912 <entry>Foreign key update action code:
1913 <literal>a</> = no action,
1914 <literal>r</> = restrict,
1915 <literal>c</> = cascade,
1916 <literal>n</> = set null,
1917 <literal>d</> = set default
1918 </entry>
1919 </row>
1921 <row>
1922 <entry><structfield>confdeltype</structfield></entry>
1923 <entry><type>char</type></entry>
1924 <entry></entry>
1925 <entry>Foreign key deletion action code:
1926 <literal>a</> = no action,
1927 <literal>r</> = restrict,
1928 <literal>c</> = cascade,
1929 <literal>n</> = set null,
1930 <literal>d</> = set default
1931 </entry>
1932 </row>
1934 <row>
1935 <entry><structfield>confmatchtype</structfield></entry>
1936 <entry><type>char</type></entry>
1937 <entry></entry>
1938 <entry>Foreign key match type:
1939 <literal>f</> = full,
1940 <literal>p</> = partial,
1941 <literal>u</> = simple (unspecified)
1942 </entry>
1943 </row>
1945 <row>
1946 <entry><structfield>conislocal</structfield></entry>
1947 <entry><type>bool</type></entry>
1948 <entry></entry>
1949 <entry>
1950 This constraint is defined locally in the relation. Note that a
1951 constraint can be locally defined and inherited simultaneously
1952 </entry>
1953 </row>
1955 <row>
1956 <entry><structfield>coninhcount</structfield></entry>
1957 <entry><type>int4</type></entry>
1958 <entry></entry>
1959 <entry>
1960 The number of direct ancestors this constraint has. A constraint with
1961 a nonzero number of ancestors cannot be dropped nor renamed
1962 </entry>
1963 </row>
1965 <row>
1966 <entry><structfield>conkey</structfield></entry>
1967 <entry><type>int2[]</type></entry>
1968 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1969 <entry>If a table constraint, list of columns which the constraint constrains</entry>
1970 </row>
1972 <row>
1973 <entry><structfield>confkey</structfield></entry>
1974 <entry><type>int2[]</type></entry>
1975 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1976 <entry>If a foreign key, list of the referenced columns</entry>
1977 </row>
1979 <row>
1980 <entry><structfield>conpfeqop</structfield></entry>
1981 <entry><type>oid[]</type></entry>
1982 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1983 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
1984 </row>
1986 <row>
1987 <entry><structfield>conppeqop</structfield></entry>
1988 <entry><type>oid[]</type></entry>
1989 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1990 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
1991 </row>
1993 <row>
1994 <entry><structfield>conffeqop</structfield></entry>
1995 <entry><type>oid[]</type></entry>
1996 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1997 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
1998 </row>
2000 <row>
2001 <entry><structfield>conbin</structfield></entry>
2002 <entry><type>text</type></entry>
2003 <entry></entry>
2004 <entry>If a check constraint, an internal representation of the expression</entry>
2005 </row>
2007 <row>
2008 <entry><structfield>consrc</structfield></entry>
2009 <entry><type>text</type></entry>
2010 <entry></entry>
2011 <entry>If a check constraint, a human-readable representation of the expression</entry>
2012 </row>
2013 </tbody>
2014 </tgroup>
2015 </table>
2017 <note>
2018 <para>
2019 <structfield>consrc</structfield> is not updated when referenced objects
2020 change; for example, it won't track renaming of columns. Rather than
2021 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2022 to extract the definition of a check constraint.
2023 </para>
2024 </note>
2026 <note>
2027 <para>
2028 <literal>pg_class.relchecks</literal> needs to agree with the
2029 number of check-constraint entries found in this table for each
2030 relation.
2031 </para>
2032 </note>
2034 </sect1>
2036 <sect1 id="catalog-pg-conversion">
2037 <title><structname>pg_conversion</structname></title>
2039 <indexterm zone="catalog-pg-conversion">
2040 <primary>pg_conversion</primary>
2041 </indexterm>
2043 <para>
2044 The catalog <structname>pg_conversion</structname> describes the
2045 available encoding conversion procedures. See
2046 <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
2047 for more information.
2048 </para>
2050 <table>
2051 <title><structname>pg_conversion</> Columns</title>
2053 <tgroup cols=4>
2054 <thead>
2055 <row>
2056 <entry>Name</entry>
2057 <entry>Type</entry>
2058 <entry>References</entry>
2059 <entry>Description</entry>
2060 </row>
2061 </thead>
2063 <tbody>
2064 <row>
2065 <entry><structfield>conname</structfield></entry>
2066 <entry><type>name</type></entry>
2067 <entry></entry>
2068 <entry>Conversion name (unique within a namespace)</entry>
2069 </row>
2071 <row>
2072 <entry><structfield>connamespace</structfield></entry>
2073 <entry><type>oid</type></entry>
2074 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2075 <entry>
2076 The OID of the namespace that contains this conversion
2077 </entry>
2078 </row>
2080 <row>
2081 <entry><structfield>conowner</structfield></entry>
2082 <entry><type>oid</type></entry>
2083 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2084 <entry>Owner of the conversion</entry>
2085 </row>
2087 <row>
2088 <entry><structfield>conforencoding</structfield></entry>
2089 <entry><type>int4</type></entry>
2090 <entry></entry>
2091 <entry>Source encoding ID</entry>
2092 </row>
2094 <row>
2095 <entry><structfield>contoencoding</structfield></entry>
2096 <entry><type>int4</type></entry>
2097 <entry></entry>
2098 <entry>Destination encoding ID</entry>
2099 </row>
2101 <row>
2102 <entry><structfield>conproc</structfield></entry>
2103 <entry><type>regproc</type></entry>
2104 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2105 <entry>Conversion procedure</entry>
2106 </row>
2108 <row>
2109 <entry><structfield>condefault</structfield></entry>
2110 <entry><type>bool</type></entry>
2111 <entry></entry>
2112 <entry>True if this is the default conversion</entry>
2113 </row>
2115 </tbody>
2116 </tgroup>
2117 </table>
2119 </sect1>
2121 <sect1 id="catalog-pg-database">
2122 <title><structname>pg_database</structname></title>
2124 <indexterm zone="catalog-pg-database">
2125 <primary>pg_database</primary>
2126 </indexterm>
2128 <para>
2129 The catalog <structname>pg_database</structname> stores information about
2130 the available databases. Databases are created with the <xref
2131 linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
2132 Consult <xref linkend="managing-databases"> for details about the meaning
2133 of some of the parameters.
2134 </para>
2136 <para>
2137 Unlike most system catalogs, <structname>pg_database</structname>
2138 is shared across all databases of a cluster: there is only one
2139 copy of <structname>pg_database</structname> per cluster, not
2140 one per database.
2141 </para>
2143 <table>
2144 <title><structname>pg_database</> Columns</title>
2146 <tgroup cols=4>
2147 <thead>
2148 <row>
2149 <entry>Name</entry>
2150 <entry>Type</entry>
2151 <entry>References</entry>
2152 <entry>Description</entry>
2153 </row>
2154 </thead>
2156 <tbody>
2157 <row>
2158 <entry><structfield>datname</structfield></entry>
2159 <entry><type>name</type></entry>
2160 <entry></entry>
2161 <entry>Database name</entry>
2162 </row>
2164 <row>
2165 <entry><structfield>datdba</structfield></entry>
2166 <entry><type>oid</type></entry>
2167 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2168 <entry>Owner of the database, usually the user who created it</entry>
2169 </row>
2171 <row>
2172 <entry><structfield>encoding</structfield></entry>
2173 <entry><type>int4</type></entry>
2174 <entry></entry>
2175 <entry>Character encoding for this database
2176 (<function>pg_encoding_to_char()</function> can translate
2177 this number to the encoding name)</entry>
2178 </row>
2180 <row>
2181 <entry><structfield>datcollate</structfield></entry>
2182 <entry><type>name</type></entry>
2183 <entry></entry>
2184 <entry>LC_COLLATE for this database</entry>
2185 </row>
2187 <row>
2188 <entry><structfield>datctype</structfield></entry>
2189 <entry><type>name</type></entry>
2190 <entry></entry>
2191 <entry>LC_CTYPE for this database</entry>
2192 </row>
2194 <row>
2195 <entry><structfield>datistemplate</structfield></entry>
2196 <entry><type>bool</type></entry>
2197 <entry></entry>
2198 <entry>
2199 If true then this database can be used in the
2200 <literal>TEMPLATE</literal> clause of <command>CREATE
2201 DATABASE</command> to create a new database as a clone of
2202 this one
2203 </entry>
2204 </row>
2206 <row>
2207 <entry><structfield>datallowconn</structfield></entry>
2208 <entry><type>bool</type></entry>
2209 <entry></entry>
2210 <entry>
2211 If false then no one can connect to this database. This is
2212 used to protect the <literal>template0</> database from being altered
2213 </entry>
2214 </row>
2216 <row>
2217 <entry><structfield>datconnlimit</structfield></entry>
2218 <entry><type>int4</type></entry>
2219 <entry></entry>
2220 <entry>
2221 Sets maximum number of concurrent connections that can be made
2222 to this database. -1 means no limit
2223 </entry>
2224 </row>
2226 <row>
2227 <entry><structfield>datlastsysoid</structfield></entry>
2228 <entry><type>oid</type></entry>
2229 <entry></entry>
2230 <entry>
2231 Last system OID in the database; useful
2232 particularly to <application>pg_dump</application>
2233 </entry>
2234 </row>
2236 <row>
2237 <entry><structfield>datfrozenxid</structfield></entry>
2238 <entry><type>xid</type></entry>
2239 <entry></entry>
2240 <entry>
2241 All transaction IDs before this one have been replaced with a permanent
2242 (<quote>frozen</>) transaction ID in this database. This is used to
2243 track whether the database needs to be vacuumed in order to prevent
2244 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2245 It is the minimum of the per-table
2246 <structname>pg_class</>.<structfield>relfrozenxid</> values
2247 </entry>
2248 </row>
2250 <row>
2251 <entry><structfield>dattablespace</structfield></entry>
2252 <entry><type>oid</type></entry>
2253 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2254 <entry>
2255 The default tablespace for the database.
2256 Within this database, all tables for which
2257 <structname>pg_class</>.<structfield>reltablespace</> is zero
2258 will be stored in this tablespace; in particular, all the non-shared
2259 system catalogs will be there
2260 </entry>
2261 </row>
2263 <row>
2264 <entry><structfield>datconfig</structfield></entry>
2265 <entry><type>text[]</type></entry>
2266 <entry></entry>
2267 <entry>Session defaults for run-time configuration variables</entry>
2268 </row>
2270 <row>
2271 <entry><structfield>datacl</structfield></entry>
2272 <entry><type>aclitem[]</type></entry>
2273 <entry></entry>
2274 <entry>
2275 Access privileges; see
2276 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2277 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2278 for details
2279 </entry>
2280 </row>
2281 </tbody>
2282 </tgroup>
2283 </table>
2284 </sect1>
2287 <sect1 id="catalog-pg-depend">
2288 <title><structname>pg_depend</structname></title>
2290 <indexterm zone="catalog-pg-depend">
2291 <primary>pg_depend</primary>
2292 </indexterm>
2294 <para>
2295 The catalog <structname>pg_depend</structname> records the dependency
2296 relationships between database objects. This information allows
2297 <command>DROP</> commands to find which other objects must be dropped
2298 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2299 RESTRICT</> case.
2300 </para>
2302 <para>
2303 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2304 which performs a similar function for dependencies involving objects
2305 that are shared across a database cluster.
2306 </para>
2308 <table>
2309 <title><structname>pg_depend</> Columns</title>
2311 <tgroup cols=4>
2312 <thead>
2313 <row>
2314 <entry>Name</entry>
2315 <entry>Type</entry>
2316 <entry>References</entry>
2317 <entry>Description</entry>
2318 </row>
2319 </thead>
2321 <tbody>
2322 <row>
2323 <entry><structfield>classid</structfield></entry>
2324 <entry><type>oid</type></entry>
2325 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2326 <entry>The OID of the system catalog the dependent object is in</entry>
2327 </row>
2329 <row>
2330 <entry><structfield>objid</structfield></entry>
2331 <entry><type>oid</type></entry>
2332 <entry>any OID column</entry>
2333 <entry>The OID of the specific dependent object</entry>
2334 </row>
2336 <row>
2337 <entry><structfield>objsubid</structfield></entry>
2338 <entry><type>int4</type></entry>
2339 <entry></entry>
2340 <entry>
2341 For a table column, this is the column number (the
2342 <structfield>objid</> and <structfield>classid</> refer to the
2343 table itself). For all other object types, this column is
2344 zero
2345 </entry>
2346 </row>
2348 <row>
2349 <entry><structfield>refclassid</structfield></entry>
2350 <entry><type>oid</type></entry>
2351 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2352 <entry>The OID of the system catalog the referenced object is in</entry>
2353 </row>
2355 <row>
2356 <entry><structfield>refobjid</structfield></entry>
2357 <entry><type>oid</type></entry>
2358 <entry>any OID column</entry>
2359 <entry>The OID of the specific referenced object</entry>
2360 </row>
2362 <row>
2363 <entry><structfield>refobjsubid</structfield></entry>
2364 <entry><type>int4</type></entry>
2365 <entry></entry>
2366 <entry>
2367 For a table column, this is the column number (the
2368 <structfield>refobjid</> and <structfield>refclassid</> refer
2369 to the table itself). For all other object types, this column
2370 is zero
2371 </entry>
2372 </row>
2374 <row>
2375 <entry><structfield>deptype</structfield></entry>
2376 <entry><type>char</type></entry>
2377 <entry></entry>
2378 <entry>
2379 A code defining the specific semantics of this dependency relationship; see text
2380 </entry>
2381 </row>
2383 </tbody>
2384 </tgroup>
2385 </table>
2387 <para>
2388 In all cases, a <structname>pg_depend</structname> entry indicates that the
2389 referenced object cannot be dropped without also dropping the dependent
2390 object. However, there are several subflavors identified by
2391 <structfield>deptype</>:
2393 <variablelist>
2394 <varlistentry>
2395 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2396 <listitem>
2397 <para>
2398 A normal relationship between separately-created objects. The
2399 dependent object can be dropped without affecting the
2400 referenced object. The referenced object can only be dropped
2401 by specifying <literal>CASCADE</>, in which case the dependent
2402 object is dropped, too. Example: a table column has a normal
2403 dependency on its data type.
2404 </para>
2405 </listitem>
2406 </varlistentry>
2408 <varlistentry>
2409 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2410 <listitem>
2411 <para>
2412 The dependent object can be dropped separately from the
2413 referenced object, and should be automatically dropped
2414 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2415 mode) if the referenced object is dropped. Example: a named
2416 constraint on a table is made autodependent on the table, so
2417 that it will go away if the table is dropped.
2418 </para>
2419 </listitem>
2420 </varlistentry>
2422 <varlistentry>
2423 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2424 <listitem>
2425 <para>
2426 The dependent object was created as part of creation of the
2427 referenced object, and is really just a part of its internal
2428 implementation. A <command>DROP</> of the dependent object
2429 will be disallowed outright (we'll tell the user to issue a
2430 <command>DROP</> against the referenced object, instead). A
2431 <command>DROP</> of the referenced object will be propagated
2432 through to drop the dependent object whether
2433 <command>CASCADE</> is specified or not. Example: a trigger
2434 that's created to enforce a foreign-key constraint is made
2435 internally dependent on the constraint's
2436 <structname>pg_constraint</> entry.
2437 </para>
2438 </listitem>
2439 </varlistentry>
2441 <varlistentry>
2442 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2443 <listitem>
2444 <para>
2445 There is no dependent object; this type of entry is a signal
2446 that the system itself depends on the referenced object, and so
2447 that object must never be deleted. Entries of this type are
2448 created only by <command>initdb</command>. The columns for the
2449 dependent object contain zeroes.
2450 </para>
2451 </listitem>
2452 </varlistentry>
2453 </variablelist>
2455 Other dependency flavors might be needed in future.
2456 </para>
2458 </sect1>
2461 <sect1 id="catalog-pg-description">
2462 <title><structname>pg_description</structname></title>
2464 <indexterm zone="catalog-pg-description">
2465 <primary>pg_description</primary>
2466 </indexterm>
2468 <para>
2469 The catalog <structname>pg_description</> stores optional descriptions
2470 (comments) for each database object. Descriptions can be manipulated
2471 with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2472 <application>psql</application>'s <literal>\d</literal> commands.
2473 Descriptions of many built-in system objects are provided in the initial
2474 contents of <structname>pg_description</structname>.
2475 </para>
2477 <para>
2478 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2479 which performs a similar function for descriptions involving objects that
2480 are shared across a database cluster.
2481 </para>
2483 <table>
2484 <title><structname>pg_description</> Columns</title>
2486 <tgroup cols=4>
2487 <thead>
2488 <row>
2489 <entry>Name</entry>
2490 <entry>Type</entry>
2491 <entry>References</entry>
2492 <entry>Description</entry>
2493 </row>
2494 </thead>
2496 <tbody>
2497 <row>
2498 <entry><structfield>objoid</structfield></entry>
2499 <entry><type>oid</type></entry>
2500 <entry>any OID column</entry>
2501 <entry>The OID of the object this description pertains to</entry>
2502 </row>
2504 <row>
2505 <entry><structfield>classoid</structfield></entry>
2506 <entry><type>oid</type></entry>
2507 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2508 <entry>The OID of the system catalog this object appears in</entry>
2509 </row>
2511 <row>
2512 <entry><structfield>objsubid</structfield></entry>
2513 <entry><type>int4</type></entry>
2514 <entry></entry>
2515 <entry>
2516 For a comment on a table column, this is the column number (the
2517 <structfield>objoid</> and <structfield>classoid</> refer to
2518 the table itself). For all other object types, this column is
2519 zero
2520 </entry>
2521 </row>
2523 <row>
2524 <entry><structfield>description</structfield></entry>
2525 <entry><type>text</type></entry>
2526 <entry></entry>
2527 <entry>Arbitrary text that serves as the description of this object</entry>
2528 </row>
2529 </tbody>
2530 </tgroup>
2531 </table>
2533 </sect1>
2536 <sect1 id="catalog-pg-enum">
2537 <title><structname>pg_enum</structname></title>
2539 <indexterm zone="catalog-pg-enum">
2540 <primary>pg_enum</primary>
2541 </indexterm>
2543 <para>
2544 The <structname>pg_enum</structname> catalog contains entries
2545 matching enum types to their associated values and labels. The
2546 internal representation of a given enum value is actually the OID
2547 of its associated row in <structname>pg_enum</structname>. The
2548 OIDs for a particular enum type are guaranteed to be ordered in
2549 the way the type should sort, but there is no guarantee about the
2550 ordering of OIDs of unrelated enum types.
2551 </para>
2553 <table>
2554 <title><structname>pg_enum</> Columns</title>
2556 <tgroup cols=4>
2557 <thead>
2558 <row>
2559 <entry>Name</entry>
2560 <entry>Type</entry>
2561 <entry>References</entry>
2562 <entry>Description</entry>
2563 </row>
2564 </thead>
2566 <tbody>
2567 <row>
2568 <entry><structfield>enumtypid</structfield></entry>
2569 <entry><type>oid</type></entry>
2570 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2571 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2572 </row>
2574 <row>
2575 <entry><structfield>enumlabel</structfield></entry>
2576 <entry><type>name</type></entry>
2577 <entry></entry>
2578 <entry>The textual label for this enum value</entry>
2579 </row>
2580 </tbody>
2581 </tgroup>
2582 </table>
2583 </sect1>
2586 <sect1 id="catalog-pg-foreign-data-wrapper">
2587 <title><structname>pg_foreign_data_wrapper</structname></title>
2589 <indexterm zone="catalog-pg-foreign-data-wrapper">
2590 <primary>pg_foreign_data_wrapper</primary>
2591 </indexterm>
2593 <para>
2594 The catalog <structname>pg_foreign_data_wrapper</structname> stores
2595 foreign-data wrapper definitions. A foreign-data wrapper is the
2596 mechanism by which external data, residing on foreign servers, is
2597 accessed.
2598 </para>
2600 <table>
2601 <title><structname>pg_foreign_data_wrapper</> Columns</title>
2603 <tgroup cols=4>
2604 <thead>
2605 <row>
2606 <entry>Name</entry>
2607 <entry>Type</entry>
2608 <entry>References</entry>
2609 <entry>Description</entry>
2610 </row>
2611 </thead>
2613 <tbody>
2614 <row>
2615 <entry><structfield>fdwname</structfield></entry>
2616 <entry><type>name</type></entry>
2617 <entry></entry>
2618 <entry>Name of the foreign-data wrapper</entry>
2619 </row>
2621 <row>
2622 <entry><structfield>fdwowner</structfield></entry>
2623 <entry><type>oid</type></entry>
2624 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2625 <entry>Owner of the foreign-data wrapper</entry>
2626 </row>
2628 <row>
2629 <entry><structfield>fdwlibrary</structfield></entry>
2630 <entry><type>text</type></entry>
2631 <entry></entry>
2632 <entry>File name of the library implementing this foreign-data wrapper</entry>
2633 </row>
2635 <row>
2636 <entry><structfield>fdwacl</structfield></entry>
2637 <entry><type>aclitem[]</type></entry>
2638 <entry></entry>
2639 <entry>
2640 Access privileges; see
2641 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2642 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2643 for details
2644 </entry>
2645 </row>
2647 <row>
2648 <entry><structfield>fdwoptions</structfield></entry>
2649 <entry><type>text[]</type></entry>
2650 <entry></entry>
2651 <entry>
2652 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
2653 </entry>
2654 </row>
2655 </tbody>
2656 </tgroup>
2657 </table>
2658 </sect1>
2661 <sect1 id="catalog-pg-foreign-server">
2662 <title><structname>pg_foreign_server</structname></title>
2664 <indexterm zone="catalog-pg-foreign-server">
2665 <primary>pg_foreign_server</primary>
2666 </indexterm>
2668 <para>
2669 The catalog <structname>pg_foreign_server</structname> stores
2670 foreign server definitions. A foreign server describes the
2671 connection to a remote server, managing external data. Foreign
2672 servers are accessed via foreign-data wrappers.
2673 </para>
2675 <table>
2676 <title><structname>pg_foreign_server</> Columns</title>
2678 <tgroup cols=4>
2679 <thead>
2680 <row>
2681 <entry>Name</entry>
2682 <entry>Type</entry>
2683 <entry>References</entry>
2684 <entry>Description</entry>
2685 </row>
2686 </thead>
2688 <tbody>
2689 <row>
2690 <entry><structfield>srvname</structfield></entry>
2691 <entry><type>name</type></entry>
2692 <entry></entry>
2693 <entry>Name of the foreign server</entry>
2694 </row>
2696 <row>
2697 <entry><structfield>srvowner</structfield></entry>
2698 <entry><type>oid</type></entry>
2699 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2700 <entry>Owner of the foreign server</entry>
2701 </row>
2703 <row>
2704 <entry><structfield>srvfdw</structfield></entry>
2705 <entry><type>oid</type></entry>
2706 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
2707 <entry>The OID of the foreign-data wrapper of this foreign server</entry>
2708 </row>
2710 <row>
2711 <entry><structfield>srvtype</structfield></entry>
2712 <entry><type>text</type></entry>
2713 <entry></entry>
2714 <entry>Type of the server (optional)</entry>
2715 </row>
2717 <row>
2718 <entry><structfield>srvversion</structfield></entry>
2719 <entry><type>text</type></entry>
2720 <entry></entry>
2721 <entry>Version of the server (optional)</entry>
2722 </row>
2724 <row>
2725 <entry><structfield>srvacl</structfield></entry>
2726 <entry><type>aclitem[]</type></entry>
2727 <entry></entry>
2728 <entry>
2729 Access privileges; see
2730 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2731 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2732 for details
2733 </entry>
2734 </row>
2736 <row>
2737 <entry><structfield>srvoptions</structfield></entry>
2738 <entry><type>text[]</type></entry>
2739 <entry></entry>
2740 <entry>
2741 Foreign server specific options, as <quote>keyword=value</> strings.
2742 </entry>
2743 </row>
2744 </tbody>
2745 </tgroup>
2746 </table>
2747 </sect1>
2750 <sect1 id="catalog-pg-user-mapping">
2751 <title><structname>pg_user_mapping</structname></title>
2753 <indexterm zone="catalog-pg-user-mapping">
2754 <primary>pg_user_mapping</primary>
2755 </indexterm>
2757 <para>
2758 The catalog <structname>pg_user_mapping</structname> stores
2759 the mappings from local user to remote. Access to this catalog is
2760 restricted from normal users, use the view
2761 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
2762 instead.
2763 </para>
2765 <table>
2766 <title><structname>pg_user_mapping</> Columns</title>
2768 <tgroup cols=4>
2769 <thead>
2770 <row>
2771 <entry>Name</entry>
2772 <entry>Type</entry>
2773 <entry>References</entry>
2774 <entry>Description</entry>
2775 </row>
2776 </thead>
2778 <tbody>
2779 <row>
2780 <entry><structfield>umuser</structfield></entry>
2781 <entry><type>oid</type></entry>
2782 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2783 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
2784 </row>
2786 <row>
2787 <entry><structfield>umserver</structfield></entry>
2788 <entry><type>oid</type></entry>
2789 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
2790 <entry>
2791 The OID of the foreign server that contains this mapping
2792 </entry>
2793 </row>
2795 <row>
2796 <entry><structfield>umoptions</structfield></entry>
2797 <entry><type>text[]</type></entry>
2798 <entry></entry>
2799 <entry>
2800 User mapping specific options, as <quote>keyword=value</> strings.
2801 </entry>
2802 </row>
2803 </tbody>
2804 </tgroup>
2805 </table>
2806 </sect1>
2809 <sect1 id="catalog-pg-index">
2810 <title><structname>pg_index</structname></title>
2812 <indexterm zone="catalog-pg-index">
2813 <primary>pg_index</primary>
2814 </indexterm>
2816 <para>
2817 The catalog <structname>pg_index</structname> contains part of the information
2818 about indexes. The rest is mostly in
2819 <structname>pg_class</structname>.
2820 </para>
2822 <table>
2823 <title><structname>pg_index</> Columns</title>
2825 <tgroup cols=4>
2826 <thead>
2827 <row>
2828 <entry>Name</entry>
2829 <entry>Type</entry>
2830 <entry>References</entry>
2831 <entry>Description</entry>
2832 </row>
2833 </thead>
2835 <tbody>
2836 <row>
2837 <entry><structfield>indexrelid</structfield></entry>
2838 <entry><type>oid</type></entry>
2839 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2840 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2841 </row>
2843 <row>
2844 <entry><structfield>indrelid</structfield></entry>
2845 <entry><type>oid</type></entry>
2846 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2847 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2848 </row>
2850 <row>
2851 <entry><structfield>indnatts</structfield></entry>
2852 <entry><type>int2</type></entry>
2853 <entry></entry>
2854 <entry>The number of columns in the index (duplicates
2855 <literal>pg_class.relnatts</literal>)</entry>
2856 </row>
2858 <row>
2859 <entry><structfield>indisunique</structfield></entry>
2860 <entry><type>bool</type></entry>
2861 <entry></entry>
2862 <entry>If true, this is a unique index</entry>
2863 </row>
2865 <row>
2866 <entry><structfield>indisprimary</structfield></entry>
2867 <entry><type>bool</type></entry>
2868 <entry></entry>
2869 <entry>If true, this index represents the primary key of the table
2870 (<structfield>indisunique</> should always be true when this is true)</entry>
2871 </row>
2873 <row>
2874 <entry><structfield>indisclustered</structfield></entry>
2875 <entry><type>bool</type></entry>
2876 <entry></entry>
2877 <entry>If true, the table was last clustered on this index</entry>
2878 </row>
2880 <row>
2881 <entry><structfield>indisvalid</structfield></entry>
2882 <entry><type>bool</type></entry>
2883 <entry></entry>
2884 <entry>
2885 If true, the index is currently valid for queries. False means the
2886 index is possibly incomplete: it must still be modified by
2887 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2888 be used for queries. If it is unique, the uniqueness property is not
2889 true either
2890 </entry>
2891 </row>
2893 <row>
2894 <entry><structfield>indcheckxmin</structfield></entry>
2895 <entry><type>bool</type></entry>
2896 <entry></entry>
2897 <entry>
2898 If true, queries must not use the index until the <structfield>xmin</>
2899 of this <structname>pg_index</> row is below their TransactionXmin
2900 event horizon, because the table may contain broken HOT chains with
2901 incompatible rows that they can see
2902 </entry>
2903 </row>
2905 <row>
2906 <entry><structfield>indisready</structfield></entry>
2907 <entry><type>bool</type></entry>
2908 <entry></entry>
2909 <entry>
2910 If true, the index is currently ready for inserts. False means the
2911 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2912 operations
2913 </entry>
2914 </row>
2916 <row>
2917 <entry><structfield>indkey</structfield></entry>
2918 <entry><type>int2vector</type></entry>
2919 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2920 <entry>
2921 This is an array of <structfield>indnatts</structfield> values that
2922 indicate which table columns this index indexes. For example a value
2923 of <literal>1 3</literal> would mean that the first and the third table
2924 columns make up the index key. A zero in this array indicates that the
2925 corresponding index attribute is an expression over the table columns,
2926 rather than a simple column reference
2927 </entry>
2928 </row>
2930 <row>
2931 <entry><structfield>indclass</structfield></entry>
2932 <entry><type>oidvector</type></entry>
2933 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2934 <entry>
2935 For each column in the index key, this contains the OID of
2936 the operator class to use. See
2937 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2938 </entry>
2939 </row>
2941 <row>
2942 <entry><structfield>indoption</structfield></entry>
2943 <entry><type>int2vector</type></entry>
2944 <entry></entry>
2945 <entry>
2946 This is an array of <structfield>indnatts</structfield> values that
2947 store per-column flag bits. The meaning of the bits is defined by
2948 the index's access method
2949 </entry>
2950 </row>
2952 <row>
2953 <entry><structfield>indexprs</structfield></entry>
2954 <entry><type>text</type></entry>
2955 <entry></entry>
2956 <entry>Expression trees (in <function>nodeToString()</function> representation)
2957 for index attributes that are not simple column references. This is a
2958 list with one element for each zero entry in <structfield>indkey</>.
2959 NULL if all index attributes are simple references</entry>
2960 </row>
2962 <row>
2963 <entry><structfield>indpred</structfield></entry>
2964 <entry><type>text</type></entry>
2965 <entry></entry>
2966 <entry>Expression tree (in <function>nodeToString()</function> representation)
2967 for partial index predicate. NULL if not a partial index</entry>
2968 </row>
2969 </tbody>
2970 </tgroup>
2971 </table>
2973 </sect1>
2976 <sect1 id="catalog-pg-inherits">
2977 <title><structname>pg_inherits</structname></title>
2979 <indexterm zone="catalog-pg-inherits">
2980 <primary>pg_inherits</primary>
2981 </indexterm>
2983 <para>
2984 The catalog <structname>pg_inherits</> records information about
2985 table inheritance hierarchies. There is one entry for each direct
2986 child table in the database. (Indirect inheritance can be determined
2987 by following chains of entries.)
2988 </para>
2990 <table>
2991 <title><structname>pg_inherits</> Columns</title>
2993 <tgroup cols=4>
2994 <thead>
2995 <row>
2996 <entry>Name</entry>
2997 <entry>Type</entry>
2998 <entry>References</entry>
2999 <entry>Description</entry>
3000 </row>
3001 </thead>
3003 <tbody>
3004 <row>
3005 <entry><structfield>inhrelid</structfield></entry>
3006 <entry><type>oid</type></entry>
3007 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3008 <entry>
3009 The OID of the child table
3010 </entry>
3011 </row>
3013 <row>
3014 <entry><structfield>inhparent</structfield></entry>
3015 <entry><type>oid</type></entry>
3016 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3017 <entry>
3018 The OID of the parent table
3019 </entry>
3020 </row>
3022 <row>
3023 <entry><structfield>inhseqno</structfield></entry>
3024 <entry><type>int4</type></entry>
3025 <entry></entry>
3026 <entry>
3027 If there is more than one direct parent for a child table (multiple
3028 inheritance), this number tells the order in which the
3029 inherited columns are to be arranged. The count starts at 1
3030 </entry>
3031 </row>
3032 </tbody>
3033 </tgroup>
3034 </table>
3036 </sect1>
3039 <sect1 id="catalog-pg-language">
3040 <title><structname>pg_language</structname></title>
3042 <indexterm zone="catalog-pg-language">
3043 <primary>pg_language</primary>
3044 </indexterm>
3046 <para>
3047 The catalog <structname>pg_language</structname> registers
3048 languages in which you can write functions or stored procedures.
3049 See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
3050 and <xref linkend="xplang"> for more information about language handlers.
3051 </para>
3053 <table>
3054 <title><structname>pg_language</> Columns</title>
3056 <tgroup cols=4>
3057 <thead>
3058 <row>
3059 <entry>Name</entry>
3060 <entry>Type</entry>
3061 <entry>References</entry>
3062 <entry>Description</entry>
3063 </row>
3064 </thead>
3066 <tbody>
3067 <row>
3068 <entry><structfield>lanname</structfield></entry>
3069 <entry><type>name</type></entry>
3070 <entry></entry>
3071 <entry>Name of the language</entry>
3072 </row>
3074 <row>
3075 <entry><structfield>lanowner</structfield></entry>
3076 <entry><type>oid</type></entry>
3077 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3078 <entry>Owner of the language</entry>
3079 </row>
3081 <row>
3082 <entry><structfield>lanispl</structfield></entry>
3083 <entry><type>bool</type></entry>
3084 <entry></entry>
3085 <entry>
3086 This is false for internal languages (such as
3087 <acronym>SQL</acronym>) and true for user-defined languages.
3088 Currently, <application>pg_dump</application> still uses this
3089 to determine which languages need to be dumped, but this might be
3090 replaced by a different mechanism in the future
3091 </entry>
3092 </row>
3094 <row>
3095 <entry><structfield>lanpltrusted</structfield></entry>
3096 <entry><type>bool</type></entry>
3097 <entry></entry>
3098 <entry>
3099 True if this is a trusted language, which means that it is believed
3100 not to grant access to anything outside the normal SQL execution
3101 environment. Only superusers can create functions in untrusted
3102 languages
3103 </entry>
3104 </row>
3106 <row>
3107 <entry><structfield>lanplcallfoid</structfield></entry>
3108 <entry><type>oid</type></entry>
3109 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3110 <entry>
3111 For noninternal languages this references the language
3112 handler, which is a special function that is responsible for
3113 executing all functions that are written in the particular
3114 language
3115 </entry>
3116 </row>
3118 <row>
3119 <entry><structfield>lanvalidator</structfield></entry>
3120 <entry><type>oid</type></entry>
3121 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3122 <entry>
3123 This references a language validator function that is responsible
3124 for checking the syntax and validity of new functions when they
3125 are created. Zero if no validator is provided
3126 </entry>
3127 </row>
3129 <row>
3130 <entry><structfield>lanacl</structfield></entry>
3131 <entry><type>aclitem[]</type></entry>
3132 <entry></entry>
3133 <entry>
3134 Access privileges; see
3135 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3136 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3137 for details
3138 </entry>
3139 </row>
3140 </tbody>
3141 </tgroup>
3142 </table>
3144 </sect1>
3147 <sect1 id="catalog-pg-largeobject">
3148 <title><structname>pg_largeobject</structname></title>
3150 <indexterm zone="catalog-pg-largeobject">
3151 <primary>pg_largeobject</primary>
3152 </indexterm>
3154 <para>
3155 The catalog <structname>pg_largeobject</structname> holds the data making up
3156 <quote>large objects</quote>. A large object is identified by an
3157 OID assigned when it is created. Each large object is broken into
3158 segments or <quote>pages</> small enough to be conveniently stored as rows
3159 in <structname>pg_largeobject</structname>.
3160 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
3161 <literal>BLCKSZ/4</>, or typically 2 kB).
3162 </para>
3164 <table>
3165 <title><structname>pg_largeobject</> Columns</title>
3167 <tgroup cols=3>
3168 <thead>
3169 <row>
3170 <entry>Name</entry>
3171 <entry>Type</entry>
3172 <entry>Description</entry>
3173 </row>
3174 </thead>
3176 <tbody>
3177 <row>
3178 <entry><structfield>loid</structfield></entry>
3179 <entry><type>oid</type></entry>
3180 <entry>Identifier of the large object that includes this page</entry>
3181 </row>
3183 <row>
3184 <entry><structfield>pageno</structfield></entry>
3185 <entry><type>int4</type></entry>
3186 <entry>Page number of this page within its large object
3187 (counting from zero)</entry>
3188 </row>
3190 <row>
3191 <entry><structfield>data</structfield></entry>
3192 <entry><type>bytea</type></entry>
3193 <entry>
3194 Actual data stored in the large object.
3195 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
3196 </entry>
3197 </row>
3198 </tbody>
3199 </tgroup>
3200 </table>
3202 <para>
3203 Each row of <structname>pg_largeobject</structname> holds data
3204 for one page of a large object, beginning at
3205 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
3206 allows sparse storage: pages might be missing, and might be shorter than
3207 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
3208 Missing regions within a large object read as zeroes.
3209 </para>
3211 </sect1>
3214 <sect1 id="catalog-pg-listener">
3215 <title><structname>pg_listener</structname></title>
3217 <indexterm zone="catalog-pg-listener">
3218 <primary>pg_listener</primary>
3219 </indexterm>
3221 <para>
3222 The catalog <structname>pg_listener</structname> supports the
3223 <xref linkend="sql-listen" endterm="sql-listen-title"> and
3224 <xref linkend="sql-notify" endterm="sql-notify-title">
3225 commands. A listener creates an entry in
3226 <structname>pg_listener</structname> for each notification name
3227 it is listening for. A notifier scans <structname>pg_listener</structname>
3228 and updates each matching entry to show that a notification has occurred.
3229 The notifier also sends a signal (using the PID recorded in the table)
3230 to awaken the listener from sleep.
3231 </para>
3233 <table>
3234 <title><structname>pg_listener</> Columns</title>
3236 <tgroup cols=4>
3237 <thead>
3238 <row>
3239 <entry>Name</entry>
3240 <entry>Type</entry>
3241 <entry>References</entry>
3242 <entry>Description</entry>
3243 </row>
3244 </thead>
3246 <tbody>
3247 <row>
3248 <entry><structfield>relname</structfield></entry>
3249 <entry><type>name</type></entry>
3250 <entry>
3251 Notify condition name. (The name need not match any actual
3252 relation in the database; the name <structfield>relname</> is historical.)
3253 </entry>
3254 </row>
3256 <row>
3257 <entry><structfield>listenerpid</structfield></entry>
3258 <entry><type>int4</type></entry>
3259 <entry>PID of the server process that created this entry</entry>
3260 </row>
3262 <row>
3263 <entry><structfield>notification</structfield></entry>
3264 <entry><type>int4</type></entry>
3265 <entry>
3266 Zero if no event is pending for this listener. If an event is
3267 pending, the PID of the server process that sent the notification
3268 </entry>
3269 </row>
3270 </tbody>
3271 </tgroup>
3272 </table>
3274 </sect1>
3277 <sect1 id="catalog-pg-namespace">
3278 <title><structname>pg_namespace</structname></title>
3280 <indexterm zone="catalog-pg-namespace">
3281 <primary>pg_namespace</primary>
3282 </indexterm>
3284 <para>
3285 The catalog <structname>pg_namespace</> stores namespaces.
3286 A namespace is the structure underlying SQL schemas: each namespace
3287 can have a separate collection of relations, types, etc. without name
3288 conflicts.
3289 </para>
3291 <table>
3292 <title><structname>pg_namespace</> Columns</title>
3294 <tgroup cols=4>
3295 <thead>
3296 <row>
3297 <entry>Name</entry>
3298 <entry>Type</entry>
3299 <entry>References</entry>
3300 <entry>Description</entry>
3301 </row>
3302 </thead>
3304 <tbody>
3305 <row>
3306 <entry><structfield>nspname</structfield></entry>
3307 <entry><type>name</type></entry>
3308 <entry></entry>
3309 <entry>Name of the namespace</entry>
3310 </row>
3312 <row>
3313 <entry><structfield>nspowner</structfield></entry>
3314 <entry><type>oid</type></entry>
3315 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3316 <entry>Owner of the namespace</entry>
3317 </row>
3319 <row>
3320 <entry><structfield>nspacl</structfield></entry>
3321 <entry><type>aclitem[]</type></entry>
3322 <entry></entry>
3323 <entry>
3324 Access privileges; see
3325 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3326 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3327 for details
3328 </entry>
3329 </row>
3330 </tbody>
3331 </tgroup>
3332 </table>
3334 </sect1>
3337 <sect1 id="catalog-pg-opclass">
3338 <title><structname>pg_opclass</structname></title>
3340 <indexterm zone="catalog-pg-opclass">
3341 <primary>pg_opclass</primary>
3342 </indexterm>
3344 <para>
3345 The catalog <structname>pg_opclass</structname> defines
3346 index access method operator classes. Each operator class defines
3347 semantics for index columns of a particular data type and a particular
3348 index access method. An operator class essentially specifies that a
3349 particular operator family is applicable to a particular indexable column
3350 data type. The set of operators from the family that are actually usable
3351 with the indexed column are whichever ones accept the column's data type
3352 as their lefthand input.
3353 </para>
3355 <para>
3356 Operator classes are described at length in <xref linkend="xindex">.
3357 </para>
3359 <table>
3360 <title><structname>pg_opclass</> Columns</title>
3362 <tgroup cols=4>
3363 <thead>
3364 <row>
3365 <entry>Name</entry>
3366 <entry>Type</entry>
3367 <entry>References</entry>
3368 <entry>Description</entry>
3369 </row>
3370 </thead>
3371 <tbody>
3373 <row>
3374 <entry><structfield>opcmethod</structfield></entry>
3375 <entry><type>oid</type></entry>
3376 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3377 <entry>Index access method operator class is for</entry>
3378 </row>
3380 <row>
3381 <entry><structfield>opcname</structfield></entry>
3382 <entry><type>name</type></entry>
3383 <entry></entry>
3384 <entry>Name of this operator class</entry>
3385 </row>
3387 <row>
3388 <entry><structfield>opcnamespace</structfield></entry>
3389 <entry><type>oid</type></entry>
3390 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3391 <entry>Namespace of this operator class</entry>
3392 </row>
3394 <row>
3395 <entry><structfield>opcowner</structfield></entry>
3396 <entry><type>oid</type></entry>
3397 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3398 <entry>Owner of the operator class</entry>
3399 </row>
3401 <row>
3402 <entry><structfield>opcfamily</structfield></entry>
3403 <entry><type>oid</type></entry>
3404 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3405 <entry>Operator family containing the operator class</entry>
3406 </row>
3408 <row>
3409 <entry><structfield>opcintype</structfield></entry>
3410 <entry><type>oid</type></entry>
3411 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3412 <entry>Data type that the operator class indexes</entry>
3413 </row>
3415 <row>
3416 <entry><structfield>opcdefault</structfield></entry>
3417 <entry><type>bool</type></entry>
3418 <entry></entry>
3419 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3420 </row>
3422 <row>
3423 <entry><structfield>opckeytype</structfield></entry>
3424 <entry><type>oid</type></entry>
3425 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3426 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3427 </row>
3429 </tbody>
3430 </tgroup>
3431 </table>
3433 <para>
3434 An operator class's <structfield>opcmethod</> must match the
3435 <structname>opfmethod</> of its containing operator family.
3436 Also, there must be no more than one <structname>pg_opclass</structname>
3437 row having <structname>opcdefault</> true for any given combination of
3438 <structname>opcmethod</> and <structname>opcintype</>.
3439 </para>
3441 </sect1>
3444 <sect1 id="catalog-pg-operator">
3445 <title><structname>pg_operator</structname></title>
3447 <indexterm zone="catalog-pg-operator">
3448 <primary>pg_operator</primary>
3449 </indexterm>
3451 <para>
3452 The catalog <structname>pg_operator</> stores information about operators.
3453 See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3454 and <xref linkend="xoper"> for more information.
3455 </para>
3457 <table>
3458 <title><structname>pg_operator</> Columns</title>
3460 <tgroup cols=4>
3461 <thead>
3462 <row>
3463 <entry>Name</entry>
3464 <entry>Type</entry>
3465 <entry>References</entry>
3466 <entry>Description</entry>
3467 </row>
3468 </thead>
3470 <tbody>
3471 <row>
3472 <entry><structfield>oprname</structfield></entry>
3473 <entry><type>name</type></entry>
3474 <entry></entry>
3475 <entry>Name of the operator</entry>
3476 </row>
3478 <row>
3479 <entry><structfield>oprnamespace</structfield></entry>
3480 <entry><type>oid</type></entry>
3481 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3482 <entry>
3483 The OID of the namespace that contains this operator
3484 </entry>
3485 </row>
3487 <row>
3488 <entry><structfield>oprowner</structfield></entry>
3489 <entry><type>oid</type></entry>
3490 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3491 <entry>Owner of the operator</entry>
3492 </row>
3494 <row>
3495 <entry><structfield>oprkind</structfield></entry>
3496 <entry><type>char</type></entry>
3497 <entry></entry>
3498 <entry>
3499 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3500 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3501 </entry>
3502 </row>
3504 <row>
3505 <entry><structfield>oprcanmerge</structfield></entry>
3506 <entry><type>bool</type></entry>
3507 <entry></entry>
3508 <entry>This operator supports merge joins</entry>
3509 </row>
3511 <row>
3512 <entry><structfield>oprcanhash</structfield></entry>
3513 <entry><type>bool</type></entry>
3514 <entry></entry>
3515 <entry>This operator supports hash joins</entry>
3516 </row>
3518 <row>
3519 <entry><structfield>oprleft</structfield></entry>
3520 <entry><type>oid</type></entry>
3521 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3522 <entry>Type of the left operand</entry>
3523 </row>
3525 <row>
3526 <entry><structfield>oprright</structfield></entry>
3527 <entry><type>oid</type></entry>
3528 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3529 <entry>Type of the right operand</entry>
3530 </row>
3532 <row>
3533 <entry><structfield>oprresult</structfield></entry>
3534 <entry><type>oid</type></entry>
3535 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3536 <entry>Type of the result</entry>
3537 </row>
3539 <row>
3540 <entry><structfield>oprcom</structfield></entry>
3541 <entry><type>oid</type></entry>
3542 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3543 <entry>Commutator of this operator, if any</entry>
3544 </row>
3546 <row>
3547 <entry><structfield>oprnegate</structfield></entry>
3548 <entry><type>oid</type></entry>
3549 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3550 <entry>Negator of this operator, if any</entry>
3551 </row>
3553 <row>
3554 <entry><structfield>oprcode</structfield></entry>
3555 <entry><type>regproc</type></entry>
3556 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3557 <entry>Function that implements this operator</entry>
3558 </row>
3560 <row>
3561 <entry><structfield>oprrest</structfield></entry>
3562 <entry><type>regproc</type></entry>
3563 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3564 <entry>Restriction selectivity estimation function for this operator</entry>
3565 </row>
3567 <row>
3568 <entry><structfield>oprjoin</structfield></entry>
3569 <entry><type>regproc</type></entry>
3570 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3571 <entry>Join selectivity estimation function for this operator</entry>
3572 </row>
3573 </tbody>
3574 </tgroup>
3575 </table>
3577 <para>
3578 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3579 is zero for a prefix operator.
3580 </para>
3582 </sect1>
3585 <sect1 id="catalog-pg-opfamily">
3586 <title><structname>pg_opfamily</structname></title>
3588 <indexterm zone="catalog-pg-opfamily">
3589 <primary>pg_opfamily</primary>
3590 </indexterm>
3592 <para>
3593 The catalog <structname>pg_opfamily</structname> defines operator families.
3594 Each operator family is a collection of operators and associated
3595 support routines that implement the semantics specified for a particular
3596 index access method. Furthermore, the operators in a family are all
3597 <quote>compatible</>, in a way that is specified by the access method.
3598 The operator family concept allows cross-data-type operators to be used
3599 with indexes and to be reasoned about using knowledge of access method
3600 semantics.
3601 </para>
3603 <para>
3604 Operator families are described at length in <xref linkend="xindex">.
3605 </para>
3607 <table>
3608 <title><structname>pg_opfamily</> Columns</title>
3610 <tgroup cols=4>
3611 <thead>
3612 <row>
3613 <entry>Name</entry>
3614 <entry>Type</entry>
3615 <entry>References</entry>
3616 <entry>Description</entry>
3617 </row>
3618 </thead>
3619 <tbody>
3621 <row>
3622 <entry><structfield>opfmethod</structfield></entry>
3623 <entry><type>oid</type></entry>
3624 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3625 <entry>Index access method operator family is for</entry>
3626 </row>
3628 <row>
3629 <entry><structfield>opfname</structfield></entry>
3630 <entry><type>name</type></entry>
3631 <entry></entry>
3632 <entry>Name of this operator family</entry>
3633 </row>
3635 <row>
3636 <entry><structfield>opfnamespace</structfield></entry>
3637 <entry><type>oid</type></entry>
3638 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3639 <entry>Namespace of this operator family</entry>
3640 </row>
3642 <row>
3643 <entry><structfield>opfowner</structfield></entry>
3644 <entry><type>oid</type></entry>
3645 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3646 <entry>Owner of the operator family</entry>
3647 </row>
3649 </tbody>
3650 </tgroup>
3651 </table>
3653 <para>
3654 The majority of the information defining an operator family is not in its
3655 <structname>pg_opfamily</structname> row, but in the associated rows in
3656 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3657 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3659 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3660 </para>
3662 </sect1>
3665 <sect1 id="catalog-pg-pltemplate">
3666 <title><structname>pg_pltemplate</structname></title>
3668 <indexterm zone="catalog-pg-pltemplate">
3669 <primary>pg_pltemplate</primary>
3670 </indexterm>
3672 <para>
3673 The catalog <structname>pg_pltemplate</structname> stores
3674 <quote>template</> information for procedural languages.
3675 A template for a language allows the language to be created in a
3676 particular database by a simple <command>CREATE LANGUAGE</> command,
3677 with no need to specify implementation details.
3678 </para>
3680 <para>
3681 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3682 is shared across all databases of a cluster: there is only one
3683 copy of <structname>pg_pltemplate</structname> per cluster, not
3684 one per database. This allows the information to be accessible in
3685 each database as it is needed.
3686 </para>
3688 <table>
3689 <title><structname>pg_pltemplate</> Columns</title>
3691 <tgroup cols=3>
3692 <thead>
3693 <row>
3694 <entry>Name</entry>
3695 <entry>Type</entry>
3696 <entry>Description</entry>
3697 </row>
3698 </thead>
3700 <tbody>
3701 <row>
3702 <entry><structfield>tmplname</structfield></entry>
3703 <entry><type>name</type></entry>
3704 <entry>Name of the language this template is for</entry>
3705 </row>
3707 <row>
3708 <entry><structfield>tmpltrusted</structfield></entry>
3709 <entry><type>boolean</type></entry>
3710 <entry>True if language is considered trusted</entry>
3711 </row>
3713 <row>
3714 <entry><structfield>tmpldbacreate</structfield></entry>
3715 <entry><type>boolean</type></entry>
3716 <entry>True if language may be created by a database owner</entry>
3717 </row>
3719 <row>
3720 <entry><structfield>tmplhandler</structfield></entry>
3721 <entry><type>text</type></entry>
3722 <entry>Name of call handler function</entry>
3723 </row>
3725 <row>
3726 <entry><structfield>tmplvalidator</structfield></entry>
3727 <entry><type>text</type></entry>
3728 <entry>Name of validator function, or NULL if none</entry>
3729 </row>
3731 <row>
3732 <entry><structfield>tmpllibrary</structfield></entry>
3733 <entry><type>text</type></entry>
3734 <entry>Path of shared library that implements language</entry>
3735 </row>
3737 <row>
3738 <entry><structfield>tmplacl</structfield></entry>
3739 <entry><type>aclitem[]</type></entry>
3740 <entry>Access privileges for template (not yet used)</entry>
3741 </row>
3743 </tbody>
3744 </tgroup>
3745 </table>
3747 <para>
3748 There are not currently any commands that manipulate procedural language
3749 templates; to change the built-in information, a superuser must modify
3750 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3751 or <command>UPDATE</command> commands. It is likely that a future
3752 release of <productname>PostgreSQL</productname> will offer
3753 commands to change the entries in a cleaner fashion.
3754 </para>
3756 <para>
3757 When implemented, the <structfield>tmplacl</structfield> field will provide
3758 access control for the template itself (i.e., the right to create a
3759 language using it), not for the languages created from the template.
3760 </para>
3762 </sect1>
3765 <sect1 id="catalog-pg-proc">
3766 <title><structname>pg_proc</structname></title>
3768 <indexterm zone="catalog-pg-proc">
3769 <primary>pg_proc</primary>
3770 </indexterm>
3772 <para>
3773 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3774 See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3775 and <xref linkend="xfunc"> for more information.
3776 </para>
3778 <para>
3779 The table contains data for aggregate functions as well as plain functions.
3780 If <structfield>proisagg</structfield> is true, there should be a matching
3781 row in <structfield>pg_aggregate</structfield>.
3782 </para>
3784 <table>
3785 <title><structname>pg_proc</> Columns</title>
3787 <tgroup cols=4>
3788 <thead>
3789 <row>
3790 <entry>Name</entry>
3791 <entry>Type</entry>
3792 <entry>References</entry>
3793 <entry>Description</entry>
3794 </row>
3795 </thead>
3797 <tbody>
3798 <row>
3799 <entry><structfield>proname</structfield></entry>
3800 <entry><type>name</type></entry>
3801 <entry></entry>
3802 <entry>Name of the function</entry>
3803 </row>
3805 <row>
3806 <entry><structfield>pronamespace</structfield></entry>
3807 <entry><type>oid</type></entry>
3808 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3809 <entry>
3810 The OID of the namespace that contains this function
3811 </entry>
3812 </row>
3814 <row>
3815 <entry><structfield>proowner</structfield></entry>
3816 <entry><type>oid</type></entry>
3817 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3818 <entry>Owner of the function</entry>
3819 </row>
3821 <row>
3822 <entry><structfield>prolang</structfield></entry>
3823 <entry><type>oid</type></entry>
3824 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3825 <entry>Implementation language or call interface of this function</entry>
3826 </row>
3828 <row>
3829 <entry><structfield>procost</structfield></entry>
3830 <entry><type>float4</type></entry>
3831 <entry></entry>
3832 <entry>Estimated execution cost (in units of
3833 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3834 this is cost per row returned</entry>
3835 </row>
3837 <row>
3838 <entry><structfield>prorows</structfield></entry>
3839 <entry><type>float4</type></entry>
3840 <entry></entry>
3841 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3842 </row>
3844 <row>
3845 <entry><structfield>provariadic</structfield></entry>
3846 <entry><type>oid</type></entry>
3847 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3848 <entry>Data type of the variadic array parameter's elements,
3849 or zero if the function does not have a variadic parameter</entry>
3850 </row>
3852 <row>
3853 <entry><structfield>proisagg</structfield></entry>
3854 <entry><type>bool</type></entry>
3855 <entry></entry>
3856 <entry>Function is an aggregate function</entry>
3857 </row>
3859 <row>
3860 <entry><structfield>proiswindow</structfield></entry>
3861 <entry><type>bool</type></entry>
3862 <entry></entry>
3863 <entry>Function is a window function</entry>
3864 </row>
3866 <row>
3867 <entry><structfield>prosecdef</structfield></entry>
3868 <entry><type>bool</type></entry>
3869 <entry></entry>
3870 <entry>Function is a security definer (i.e., a <quote>setuid</>
3871 function)</entry>
3872 </row>
3874 <row>
3875 <entry><structfield>proisstrict</structfield></entry>
3876 <entry><type>bool</type></entry>
3877 <entry></entry>
3878 <entry>
3879 Function returns null if any call argument is null. In that
3880 case the function won't actually be called at all. Functions
3881 that are not <quote>strict</quote> must be prepared to handle
3882 null inputs
3883 </entry>
3884 </row>
3886 <row>
3887 <entry><structfield>proretset</structfield></entry>
3888 <entry><type>bool</type></entry>
3889 <entry></entry>
3890 <entry>Function returns a set (i.e., multiple values of the specified
3891 data type)</entry>
3892 </row>
3894 <row>
3895 <entry><structfield>provolatile</structfield></entry>
3896 <entry><type>char</type></entry>
3897 <entry></entry>
3898 <entry>
3899 <structfield>provolatile</structfield> tells whether the function's
3900 result depends only on its input arguments, or is affected by outside
3901 factors.
3902 It is <literal>i</literal> for <quote>immutable</> functions,
3903 which always deliver the same result for the same inputs.
3904 It is <literal>s</literal> for <quote>stable</> functions,
3905 whose results (for fixed inputs) do not change within a scan.
3906 It is <literal>v</literal> for <quote>volatile</> functions,
3907 whose results might change at any time. (Use <literal>v</literal> also
3908 for functions with side-effects, so that calls to them cannot get
3909 optimized away.)
3910 </entry>
3911 </row>
3913 <row>
3914 <entry><structfield>pronargs</structfield></entry>
3915 <entry><type>int2</type></entry>
3916 <entry></entry>
3917 <entry>Number of input arguments</entry>
3918 </row>
3920 <row>
3921 <entry><structfield>pronargdefaults</structfield></entry>
3922 <entry><type>int2</type></entry>
3923 <entry></entry>
3924 <entry>Number of arguments that have defaults</entry>
3925 </row>
3927 <row>
3928 <entry><structfield>prorettype</structfield></entry>
3929 <entry><type>oid</type></entry>
3930 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3931 <entry>Data type of the return value</entry>
3932 </row>
3934 <row>
3935 <entry><structfield>proargtypes</structfield></entry>
3936 <entry><type>oidvector</type></entry>
3937 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3938 <entry>
3939 An array with the data types of the function arguments. This includes
3940 only input arguments (including <literal>INOUT</literal> and
3941 <literal>VARIADIC</> arguments), and thus represents
3942 the call signature of the function
3943 </entry>
3944 </row>
3946 <row>
3947 <entry><structfield>proallargtypes</structfield></entry>
3948 <entry><type>oid[]</type></entry>
3949 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3950 <entry>
3951 An array with the data types of the function arguments. This includes
3952 all arguments (including <literal>OUT</literal> and
3953 <literal>INOUT</literal> arguments); however, if all the
3954 arguments are <literal>IN</literal> arguments, this field will be null.
3955 Note that subscripting is 1-based, whereas for historical reasons
3956 <structfield>proargtypes</> is subscripted from 0
3957 </entry>
3958 </row>
3960 <row>
3961 <entry><structfield>proargmodes</structfield></entry>
3962 <entry><type>char[]</type></entry>
3963 <entry></entry>
3964 <entry>
3965 An array with the modes of the function arguments, encoded as
3966 <literal>i</literal> for <literal>IN</> arguments,
3967 <literal>o</literal> for <literal>OUT</> arguments,
3968 <literal>b</literal> for <literal>INOUT</> arguments,
3969 <literal>v</literal> for <literal>VARIADIC</> arguments,
3970 <literal>t</literal> for <literal>TABLE</> arguments.
3971 If all the arguments are <literal>IN</literal> arguments,
3972 this field will be null.
3973 Note that subscripts correspond to positions of
3974 <structfield>proallargtypes</> not <structfield>proargtypes</>
3975 </entry>
3976 </row>
3978 <row>
3979 <entry><structfield>proargnames</structfield></entry>
3980 <entry><type>text[]</type></entry>
3981 <entry></entry>
3982 <entry>
3983 An array with the names of the function arguments.
3984 Arguments without a name are set to empty strings in the array.
3985 If none of the arguments have a name, this field will be null.
3986 Note that subscripts correspond to positions of
3987 <structfield>proallargtypes</> not <structfield>proargtypes</>
3988 </entry>
3989 </row>
3991 <row>
3992 <entry><structfield>proargdefaults</structfield></entry>
3993 <entry><type>text</type></entry>
3994 <entry></entry>
3995 <entry>
3996 Expression trees (in <function>nodeToString()</function> representation)
3997 for default values. This is a list with
3998 <structfield>pronargdefaults</> elements, corresponding to the last
3999 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
4000 <replaceable>N</> <structfield>proargtypes</> positions).
4001 If none of the arguments have defaults, this field will be null
4002 </entry>
4003 </row>
4005 <row>
4006 <entry><structfield>prosrc</structfield></entry>
4007 <entry><type>text</type></entry>
4008 <entry></entry>
4009 <entry>
4010 This tells the function handler how to invoke the function. It
4011 might be the actual source code of the function for interpreted
4012 languages, a link symbol, a file name, or just about anything
4013 else, depending on the implementation language/call convention
4014 </entry>
4015 </row>
4017 <row>
4018 <entry><structfield>probin</structfield></entry>
4019 <entry><type>bytea</type></entry>
4020 <entry></entry>
4021 <entry>
4022 Additional information about how to invoke the function.
4023 Again, the interpretation is language-specific
4024 </entry>
4025 </row>
4027 <row>
4028 <entry><structfield>proconfig</structfield></entry>
4029 <entry><type>text[]</type></entry>
4030 <entry></entry>
4031 <entry>Function's local settings for run-time configuration variables</entry>
4032 </row>
4034 <row>
4035 <entry><structfield>proacl</structfield></entry>
4036 <entry><type>aclitem[]</type></entry>
4037 <entry></entry>
4038 <entry>
4039 Access privileges; see
4040 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4041 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4042 for details
4043 </entry>
4044 </row>
4045 </tbody>
4046 </tgroup>
4047 </table>
4049 <para>
4050 For compiled functions, both built-in and dynamically loaded,
4051 <structfield>prosrc</structfield> contains the function's C-language
4052 name (link symbol). For all other currently-known language types,
4053 <structfield>prosrc</structfield> contains the function's source
4054 text. <structfield>probin</structfield> is unused except for
4055 dynamically-loaded C functions, for which it gives the name of the
4056 shared library file containing the function.
4057 </para>
4059 </sect1>
4061 <sect1 id="catalog-pg-rewrite">
4062 <title><structname>pg_rewrite</structname></title>
4064 <indexterm zone="catalog-pg-rewrite">
4065 <primary>pg_rewrite</primary>
4066 </indexterm>
4068 <para>
4069 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
4070 </para>
4072 <table>
4073 <title><structname>pg_rewrite</> Columns</title>
4075 <tgroup cols=4>
4076 <thead>
4077 <row>
4078 <entry>Name</entry>
4079 <entry>Type</entry>
4080 <entry>References</entry>
4081 <entry>Description</entry>
4082 </row>
4083 </thead>
4085 <tbody>
4086 <row>
4087 <entry><structfield>rulename</structfield></entry>
4088 <entry><type>name</type></entry>
4089 <entry></entry>
4090 <entry>Rule name</entry>
4091 </row>
4093 <row>
4094 <entry><structfield>ev_class</structfield></entry>
4095 <entry><type>oid</type></entry>
4096 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4097 <entry>The table this rule is for</entry>
4098 </row>
4100 <row>
4101 <entry><structfield>ev_attr</structfield></entry>
4102 <entry><type>int2</type></entry>
4103 <entry></entry>
4104 <entry>The column this rule is for (currently, always zero to
4105 indicate the whole table)</entry>
4106 </row>
4108 <row>
4109 <entry><structfield>ev_type</structfield></entry>
4110 <entry><type>char</type></entry>
4111 <entry></entry>
4112 <entry>
4113 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
4114 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
4115 <command>DELETE</>
4116 </entry>
4117 </row>
4119 <row>
4120 <entry><structfield>ev_enabled</structfield></entry>
4121 <entry><type>char</type></entry>
4122 <entry></entry>
4123 <entry>
4124 Controls in which <xref linkend="guc-session-replication-role"> modes
4125 the rule fires.
4126 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
4127 <literal>D</> = rule is disabled,
4128 <literal>R</> = rule fires in <quote>replica</> mode,
4129 <literal>A</> = rule fires always.
4130 </entry>
4131 </row>
4133 <row>
4134 <entry><structfield>is_instead</structfield></entry>
4135 <entry><type>bool</type></entry>
4136 <entry></entry>
4137 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
4138 </row>
4140 <row>
4141 <entry><structfield>ev_qual</structfield></entry>
4142 <entry><type>text</type></entry>
4143 <entry></entry>
4144 <entry>
4145 Expression tree (in the form of a
4146 <function>nodeToString()</function> representation) for the
4147 rule's qualifying condition
4148 </entry>
4149 </row>
4151 <row>
4152 <entry><structfield>ev_action</structfield></entry>
4153 <entry><type>text</type></entry>
4154 <entry></entry>
4155 <entry>
4156 Query tree (in the form of a
4157 <function>nodeToString()</function> representation) for the
4158 rule's action
4159 </entry>
4160 </row>
4161 </tbody>
4162 </tgroup>
4163 </table>
4165 <note>
4166 <para>
4167 <literal>pg_class.relhasrules</literal>
4168 must be true if a table has any rules in this catalog.
4169 </para>
4170 </note>
4172 </sect1>
4175 <sect1 id="catalog-pg-shdepend">
4176 <title><structname>pg_shdepend</structname></title>
4178 <indexterm zone="catalog-pg-shdepend">
4179 <primary>pg_shdepend</primary>
4180 </indexterm>
4182 <para>
4183 The catalog <structname>pg_shdepend</structname> records the
4184 dependency relationships between database objects and shared objects,
4185 such as roles. This information allows
4186 <productname>PostgreSQL</productname> to ensure that those objects are
4187 unreferenced before attempting to delete them.
4188 </para>
4190 <para>
4191 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
4192 which performs a similar function for dependencies involving objects
4193 within a single database.
4194 </para>
4196 <para>
4197 Unlike most system catalogs, <structname>pg_shdepend</structname>
4198 is shared across all databases of a cluster: there is only one
4199 copy of <structname>pg_shdepend</structname> per cluster, not
4200 one per database.
4201 </para>
4203 <table>
4204 <title><structname>pg_shdepend</> Columns</title>
4206 <tgroup cols=4>
4207 <thead>
4208 <row>
4209 <entry>Name</entry>
4210 <entry>Type</entry>
4211 <entry>References</entry>
4212 <entry>Description</entry>
4213 </row>
4214 </thead>
4216 <tbody>
4217 <row>
4218 <entry><structfield>dbid</structfield></entry>
4219 <entry><type>oid</type></entry>
4220 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4221 <entry>The OID of the database the dependent object is in,
4222 or zero for a shared object</entry>
4223 </row>
4225 <row>
4226 <entry><structfield>classid</structfield></entry>
4227 <entry><type>oid</type></entry>
4228 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4229 <entry>The OID of the system catalog the dependent object is in</entry>
4230 </row>
4232 <row>
4233 <entry><structfield>objid</structfield></entry>
4234 <entry><type>oid</type></entry>
4235 <entry>any OID column</entry>
4236 <entry>The OID of the specific dependent object</entry>
4237 </row>
4239 <row>
4240 <entry><structfield>refclassid</structfield></entry>
4241 <entry><type>oid</type></entry>
4242 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4243 <entry>The OID of the system catalog the referenced object is in
4244 (must be a shared catalog)</entry>
4245 </row>
4247 <row>
4248 <entry><structfield>refobjid</structfield></entry>
4249 <entry><type>oid</type></entry>
4250 <entry>any OID column</entry>
4251 <entry>The OID of the specific referenced object</entry>
4252 </row>
4254 <row>
4255 <entry><structfield>deptype</structfield></entry>
4256 <entry><type>char</type></entry>
4257 <entry></entry>
4258 <entry>
4259 A code defining the specific semantics of this dependency relationship; see text
4260 </entry>
4261 </row>
4263 </tbody>
4264 </tgroup>
4265 </table>
4267 <para>
4268 In all cases, a <structname>pg_shdepend</structname> entry indicates that
4269 the referenced object cannot be dropped without also dropping the dependent
4270 object. However, there are several subflavors identified by
4271 <structfield>deptype</>:
4273 <variablelist>
4274 <varlistentry>
4275 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4276 <listitem>
4277 <para>
4278 The referenced object (which must be a role) is the owner of the
4279 dependent object.
4280 </para>
4281 </listitem>
4282 </varlistentry>
4284 <varlistentry>
4285 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4286 <listitem>
4287 <para>
4288 The referenced object (which must be a role) is mentioned in the
4289 ACL (access control list, i.e., privileges list) of the
4290 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4291 not made for the owner of the object, since the owner will have
4292 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4293 </para>
4294 </listitem>
4295 </varlistentry>
4297 <varlistentry>
4298 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4299 <listitem>
4300 <para>
4301 There is no dependent object; this type of entry is a signal
4302 that the system itself depends on the referenced object, and so
4303 that object must never be deleted. Entries of this type are
4304 created only by <command>initdb</command>. The columns for the
4305 dependent object contain zeroes.
4306 </para>
4307 </listitem>
4308 </varlistentry>
4309 </variablelist>
4311 Other dependency flavors might be needed in future. Note in particular
4312 that the current definition only supports roles as referenced objects.
4313 </para>
4315 </sect1>
4317 <sect1 id="catalog-pg-shdescription">
4318 <title><structname>pg_shdescription</structname></title>
4320 <indexterm zone="catalog-pg-shdescription">
4321 <primary>pg_shdescription</primary>
4322 </indexterm>
4324 <para>
4325 The catalog <structname>pg_shdescription</structname> stores optional
4326 descriptions (comments) for shared database objects. Descriptions can be
4327 manipulated with the <xref linkend="sql-comment"
4328 endterm="sql-comment-title"> command and viewed with
4329 <application>psql</application>'s <literal>\d</literal> commands.
4330 </para>
4332 <para>
4333 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4334 which performs a similar function for descriptions involving objects
4335 within a single database.
4336 </para>
4338 <para>
4339 Unlike most system catalogs, <structname>pg_shdescription</structname>
4340 is shared across all databases of a cluster: there is only one
4341 copy of <structname>pg_shdescription</structname> per cluster, not
4342 one per database.
4343 </para>
4345 <table>
4346 <title><structname>pg_shdescription</> Columns</title>
4348 <tgroup cols=4>
4349 <thead>
4350 <row>
4351 <entry>Name</entry>
4352 <entry>Type</entry>
4353 <entry>References</entry>
4354 <entry>Description</entry>
4355 </row>
4356 </thead>
4358 <tbody>
4359 <row>
4360 <entry><structfield>objoid</structfield></entry>
4361 <entry><type>oid</type></entry>
4362 <entry>any OID column</entry>
4363 <entry>The OID of the object this description pertains to</entry>
4364 </row>
4366 <row>
4367 <entry><structfield>classoid</structfield></entry>
4368 <entry><type>oid</type></entry>
4369 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4370 <entry>The OID of the system catalog this object appears in</entry>
4371 </row>
4373 <row>
4374 <entry><structfield>description</structfield></entry>
4375 <entry><type>text</type></entry>
4376 <entry></entry>
4377 <entry>Arbitrary text that serves as the description of this object</entry>
4378 </row>
4379 </tbody>
4380 </tgroup>
4381 </table>
4383 </sect1>
4386 <sect1 id="catalog-pg-statistic">
4387 <title><structname>pg_statistic</structname></title>
4389 <indexterm zone="catalog-pg-statistic">
4390 <primary>pg_statistic</primary>
4391 </indexterm>
4393 <para>
4394 The catalog <structname>pg_statistic</structname> stores
4395 statistical data about the contents of the database. Entries are
4396 created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4397 and subsequently used by the query planner. There is one entry for
4398 each table column that has been analyzed. Note that all the
4399 statistical data is inherently approximate, even assuming that it
4400 is up-to-date.
4401 </para>
4403 <para>
4404 <structname>pg_statistic</structname> also stores statistical data about
4405 the values of index expressions. These are described as if they were
4406 actual data columns; in particular, <structfield>starelid</structfield>
4407 references the index. No entry is made for an ordinary non-expression
4408 index column, however, since it would be redundant with the entry
4409 for the underlying table column.
4410 </para>
4412 <para>
4413 Since different kinds of statistics might be appropriate for different
4414 kinds of data, <structname>pg_statistic</structname> is designed not
4415 to assume very much about what sort of statistics it stores. Only
4416 extremely general statistics (such as nullness) are given dedicated
4417 columns in <structname>pg_statistic</structname>. Everything else
4418 is stored in <quote>slots</quote>, which are groups of associated columns
4419 whose content is identified by a code number in one of the slot's columns.
4420 For more information see
4421 <filename>src/include/catalog/pg_statistic.h</filename>.
4422 </para>
4424 <para>
4425 <structname>pg_statistic</structname> should not be readable by the
4426 public, since even statistical information about a table's contents
4427 might be considered sensitive. (Example: minimum and maximum values
4428 of a salary column might be quite interesting.)
4429 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4430 is a publicly readable view on
4431 <structname>pg_statistic</structname> that only exposes information
4432 about those tables that are readable by the current user.
4433 </para>
4435 <table>
4436 <title><structname>pg_statistic</> Columns</title>
4438 <tgroup cols=4>
4439 <thead>
4440 <row>
4441 <entry>Name</entry>
4442 <entry>Type</entry>
4443 <entry>References</entry>
4444 <entry>Description</entry>
4445 </row>
4446 </thead>
4448 <tbody>
4449 <row>
4450 <entry><structfield>starelid</structfield></entry>
4451 <entry><type>oid</type></entry>
4452 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4453 <entry>The table or index that the described column belongs to</entry>
4454 </row>
4456 <row>
4457 <entry><structfield>staattnum</structfield></entry>
4458 <entry><type>int2</type></entry>
4459 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4460 <entry>The number of the described column</entry>
4461 </row>
4463 <row>
4464 <entry><structfield>stanullfrac</structfield></entry>
4465 <entry><type>float4</type></entry>
4466 <entry></entry>
4467 <entry>The fraction of the column's entries that are null</entry>
4468 </row>
4470 <row>
4471 <entry><structfield>stawidth</structfield></entry>
4472 <entry><type>int4</type></entry>
4473 <entry></entry>
4474 <entry>The average stored width, in bytes, of nonnull entries</entry>
4475 </row>
4477 <row>
4478 <entry><structfield>stadistinct</structfield></entry>
4479 <entry><type>float4</type></entry>
4480 <entry></entry>
4481 <entry>The number of distinct nonnull data values in the column.
4482 A value greater than zero is the actual number of distinct values.
4483 A value less than zero is the negative of a fraction of the number
4484 of rows in the table (for example, a column in which values appear about
4485 twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4486 A zero value means the number of distinct values is unknown
4487 </entry>
4488 </row>
4490 <row>
4491 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4492 <entry><type>int2</type></entry>
4493 <entry></entry>
4494 <entry>
4495 A code number indicating the kind of statistics stored in the
4496 <replaceable>N</>th <quote>slot</quote> of the
4497 <structname>pg_statistic</structname> row
4498 </entry>
4499 </row>
4501 <row>
4502 <entry><structfield>staop<replaceable>N</></structfield></entry>
4503 <entry><type>oid</type></entry>
4504 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4505 <entry>
4506 An operator used to derive the statistics stored in the
4507 <replaceable>N</>th <quote>slot</quote>. For example, a
4508 histogram slot would show the <literal>&lt;</literal> operator
4509 that defines the sort order of the data
4510 </entry>
4511 </row>
4513 <row>
4514 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4515 <entry><type>float4[]</type></entry>
4516 <entry></entry>
4517 <entry>
4518 Numerical statistics of the appropriate kind for the
4519 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4520 kind does not involve numerical values
4521 </entry>
4522 </row>
4524 <row>
4525 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4526 <entry><type>anyarray</type></entry>
4527 <entry></entry>
4528 <entry>
4529 Column data values of the appropriate kind for the
4530 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4531 kind does not store any data values. Each array's element
4532 values are actually of the specific column's data type, so there
4533 is no way to define these columns' type more specifically than
4534 <type>anyarray</>
4535 </entry>
4536 </row>
4537 </tbody>
4538 </tgroup>
4539 </table>
4541 </sect1>
4544 <sect1 id="catalog-pg-tablespace">
4545 <title><structname>pg_tablespace</structname></title>
4547 <indexterm zone="catalog-pg-tablespace">
4548 <primary>pg_tablespace</primary>
4549 </indexterm>
4551 <para>
4552 The catalog <structname>pg_tablespace</structname> stores information
4553 about the available tablespaces. Tables can be placed in particular
4554 tablespaces to aid administration of disk layout.
4555 </para>
4557 <para>
4558 Unlike most system catalogs, <structname>pg_tablespace</structname>
4559 is shared across all databases of a cluster: there is only one
4560 copy of <structname>pg_tablespace</structname> per cluster, not
4561 one per database.
4562 </para>
4564 <table>
4565 <title><structname>pg_tablespace</> Columns</title>
4567 <tgroup cols=4>
4568 <thead>
4569 <row>
4570 <entry>Name</entry>
4571 <entry>Type</entry>
4572 <entry>References</entry>
4573 <entry>Description</entry>
4574 </row>
4575 </thead>
4577 <tbody>
4578 <row>
4579 <entry><structfield>spcname</structfield></entry>
4580 <entry><type>name</type></entry>
4581 <entry></entry>
4582 <entry>Tablespace name</entry>
4583 </row>
4585 <row>
4586 <entry><structfield>spcowner</structfield></entry>
4587 <entry><type>oid</type></entry>
4588 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4589 <entry>Owner of the tablespace, usually the user who created it</entry>
4590 </row>
4592 <row>
4593 <entry><structfield>spclocation</structfield></entry>
4594 <entry><type>text</type></entry>
4595 <entry></entry>
4596 <entry>Location (directory path) of the tablespace</entry>
4597 </row>
4599 <row>
4600 <entry><structfield>spcacl</structfield></entry>
4601 <entry><type>aclitem[]</type></entry>
4602 <entry></entry>
4603 <entry>
4604 Access privileges; see
4605 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4606 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4607 for details
4608 </entry>
4609 </row>
4610 </tbody>
4611 </tgroup>
4612 </table>
4613 </sect1>
4616 <sect1 id="catalog-pg-trigger">
4617 <title><structname>pg_trigger</structname></title>
4619 <indexterm zone="catalog-pg-trigger">
4620 <primary>pg_trigger</primary>
4621 </indexterm>
4623 <para>
4624 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4625 See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4626 for more information.
4627 </para>
4629 <table>
4630 <title><structname>pg_trigger</> Columns</title>
4632 <tgroup cols=4>
4633 <thead>
4634 <row>
4635 <entry>Name</entry>
4636 <entry>Type</entry>
4637 <entry>References</entry>
4638 <entry>Description</entry>
4639 </row>
4640 </thead>
4642 <tbody>
4643 <row>
4644 <entry><structfield>tgrelid</structfield></entry>
4645 <entry><type>oid</type></entry>
4646 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4647 <entry>The table this trigger is on</entry>
4648 </row>
4650 <row>
4651 <entry><structfield>tgname</structfield></entry>
4652 <entry><type>name</type></entry>
4653 <entry></entry>
4654 <entry>Trigger name (must be unique among triggers of same table)</entry>
4655 </row>
4657 <row>
4658 <entry><structfield>tgfoid</structfield></entry>
4659 <entry><type>oid</type></entry>
4660 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4661 <entry>The function to be called</entry>
4662 </row>
4664 <row>
4665 <entry><structfield>tgtype</structfield></entry>
4666 <entry><type>int2</type></entry>
4667 <entry></entry>
4668 <entry>Bit mask identifying trigger conditions</entry>
4669 </row>
4671 <row>
4672 <entry><structfield>tgenabled</structfield></entry>
4673 <entry><type>char</type></entry>
4674 <entry></entry>
4675 <entry>
4676 Controls in which <xref linkend="guc-session-replication-role"> modes
4677 the trigger fires.
4678 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4679 <literal>D</> = trigger is disabled,
4680 <literal>R</> = trigger fires in <quote>replica</> mode,
4681 <literal>A</> = trigger fires always.
4682 </entry>
4683 </row>
4685 <row>
4686 <entry><structfield>tgisconstraint</structfield></entry>
4687 <entry><type>bool</type></entry>
4688 <entry></entry>
4689 <entry>True if trigger is a <quote>constraint trigger</></entry>
4690 </row>
4692 <row>
4693 <entry><structfield>tgconstrname</structfield></entry>
4694 <entry><type>name</type></entry>
4695 <entry></entry>
4696 <entry>Constraint name, if a constraint trigger</entry>
4697 </row>
4699 <row>
4700 <entry><structfield>tgconstrrelid</structfield></entry>
4701 <entry><type>oid</type></entry>
4702 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4703 <entry>The table referenced by a referential integrity constraint</entry>
4704 </row>
4706 <row>
4707 <entry><structfield>tgconstraint</structfield></entry>
4708 <entry><type>oid</type></entry>
4709 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4710 <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4711 </row>
4713 <row>
4714 <entry><structfield>tgdeferrable</structfield></entry>
4715 <entry><type>bool</type></entry>
4716 <entry></entry>
4717 <entry>True if constraint trigger is deferrable</entry>
4718 </row>
4720 <row>
4721 <entry><structfield>tginitdeferred</structfield></entry>
4722 <entry><type>bool</type></entry>
4723 <entry></entry>
4724 <entry>True if constraint trigger is initially deferred</entry>
4725 </row>
4727 <row>
4728 <entry><structfield>tgnargs</structfield></entry>
4729 <entry><type>int2</type></entry>
4730 <entry></entry>
4731 <entry>Number of argument strings passed to trigger function</entry>
4732 </row>
4734 <row>
4735 <entry><structfield>tgattr</structfield></entry>
4736 <entry><type>int2vector</type></entry>
4737 <entry></entry>
4738 <entry>Currently unused</entry>
4739 </row>
4741 <row>
4742 <entry><structfield>tgargs</structfield></entry>
4743 <entry><type>bytea</type></entry>
4744 <entry></entry>
4745 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4746 </row>
4747 </tbody>
4748 </tgroup>
4749 </table>
4751 <note>
4752 <para>
4753 When <structfield>tgconstraint</> is nonzero,
4754 <structfield>tgisconstraint</> must be true, and
4755 <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4756 <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4757 with the referenced <structname>pg_constraint</> entry. The reason we
4758 keep these fields is that we support <quote>stand-alone</> constraint
4759 triggers with no corresponding <structname>pg_constraint</> entry.
4760 </para>
4761 </note>
4763 <note>
4764 <para>
4765 <literal>pg_class.relhastriggers</literal>
4766 must be true if a table has any triggers in this catalog.
4767 </para>
4768 </note>
4770 </sect1>
4773 <sect1 id="catalog-pg-ts-config">
4774 <title><structname>pg_ts_config</structname></title>
4776 <indexterm zone="catalog-pg-ts-config">
4777 <primary>pg_ts_config</primary>
4778 </indexterm>
4780 <para>
4781 The <structname>pg_ts_config</structname> catalog contains entries
4782 representing text search configurations. A configuration specifies
4783 a particular text search parser and a list of dictionaries to use
4784 for each of the parser's output token types. The parser is shown
4785 in the <structname>pg_ts_config</structname> entry, but the
4786 token-to-dictionary mapping is defined by subsidiary entries in <link
4787 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4788 </para>
4790 <para>
4791 <productname>PostgreSQL</productname>'s text search features are
4792 described at length in <xref linkend="textsearch">.
4793 </para>
4795 <table>
4796 <title><structname>pg_ts_config</> Columns</title>
4798 <tgroup cols=4>
4799 <thead>
4800 <row>
4801 <entry>Name</entry>
4802 <entry>Type</entry>
4803 <entry>References</entry>
4804 <entry>Description</entry>
4805 </row>
4806 </thead>
4808 <tbody>
4809 <row>
4810 <entry><structfield>cfgname</structfield></entry>
4811 <entry><type>name</type></entry>
4812 <entry></entry>
4813 <entry>Text search configuration name</entry>
4814 </row>
4816 <row>
4817 <entry><structfield>cfgnamespace</structfield></entry>
4818 <entry><type>oid</type></entry>
4819 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4820 <entry>
4821 The OID of the namespace that contains this configuration
4822 </entry>
4823 </row>
4825 <row>
4826 <entry><structfield>cfgowner</structfield></entry>
4827 <entry><type>oid</type></entry>
4828 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4829 <entry>Owner of the configuration</entry>
4830 </row>
4832 <row>
4833 <entry><structfield>cfgparser</structfield></entry>
4834 <entry><type>oid</type></entry>
4835 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4836 <entry>The OID of the text search parser for this configuration</entry>
4837 </row>
4838 </tbody>
4839 </tgroup>
4840 </table>
4841 </sect1>
4844 <sect1 id="catalog-pg-ts-config-map">
4845 <title><structname>pg_ts_config_map</structname></title>
4847 <indexterm zone="catalog-pg-ts-config-map">
4848 <primary>pg_ts_config_map</primary>
4849 </indexterm>
4851 <para>
4852 The <structname>pg_ts_config_map</structname> catalog contains entries
4853 showing which text search dictionaries should be consulted, and in
4854 what order, for each output token type of each text search configuration's
4855 parser.
4856 </para>
4858 <para>
4859 <productname>PostgreSQL</productname>'s text search features are
4860 described at length in <xref linkend="textsearch">.
4861 </para>
4863 <table>
4864 <title><structname>pg_ts_config_map</> Columns</title>
4866 <tgroup cols=4>
4867 <thead>
4868 <row>
4869 <entry>Name</entry>
4870 <entry>Type</entry>
4871 <entry>References</entry>
4872 <entry>Description</entry>
4873 </row>
4874 </thead>
4876 <tbody>
4877 <row>
4878 <entry><structfield>mapcfg</structfield></entry>
4879 <entry><type>oid</type></entry>
4880 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4881 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4882 </row>
4884 <row>
4885 <entry><structfield>maptokentype</structfield></entry>
4886 <entry><type>integer</type></entry>
4887 <entry></entry>
4888 <entry>A token type emitted by the configuration's parser</entry>
4889 </row>
4891 <row>
4892 <entry><structfield>mapseqno</structfield></entry>
4893 <entry><type>integer</type></entry>
4894 <entry></entry>
4895 <entry>Order in which to consult this entry (lower
4896 <structfield>mapseqno</>s first)</entry>
4897 </row>
4899 <row>
4900 <entry><structfield>mapdict</structfield></entry>
4901 <entry><type>oid</type></entry>
4902 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4903 <entry>The OID of the text search dictionary to consult</entry>
4904 </row>
4905 </tbody>
4906 </tgroup>
4907 </table>
4908 </sect1>
4911 <sect1 id="catalog-pg-ts-dict">
4912 <title><structname>pg_ts_dict</structname></title>
4914 <indexterm zone="catalog-pg-ts-dict">
4915 <primary>pg_ts_dict</primary>
4916 </indexterm>
4918 <para>
4919 The <structname>pg_ts_dict</structname> catalog contains entries
4920 defining text search dictionaries. A dictionary depends on a text
4921 search template, which specifies all the implementation functions
4922 needed; the dictionary itself provides values for the user-settable
4923 parameters supported by the template. This division of labor allows
4924 dictionaries to be created by unprivileged users. The parameters
4925 are specified by a text string <structfield>dictinitoption</>,
4926 whose format and meaning vary depending on the template.
4927 </para>
4929 <para>
4930 <productname>PostgreSQL</productname>'s text search features are
4931 described at length in <xref linkend="textsearch">.
4932 </para>
4934 <table>
4935 <title><structname>pg_ts_dict</> Columns</title>
4937 <tgroup cols=4>
4938 <thead>
4939 <row>
4940 <entry>Name</entry>
4941 <entry>Type</entry>
4942 <entry>References</entry>
4943 <entry>Description</entry>
4944 </row>
4945 </thead>
4947 <tbody>
4948 <row>
4949 <entry><structfield>dictname</structfield></entry>
4950 <entry><type>name</type></entry>
4951 <entry></entry>
4952 <entry>Text search dictionary name</entry>
4953 </row>
4955 <row>
4956 <entry><structfield>dictnamespace</structfield></entry>
4957 <entry><type>oid</type></entry>
4958 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4959 <entry>
4960 The OID of the namespace that contains this dictionary
4961 </entry>
4962 </row>
4964 <row>
4965 <entry><structfield>dictowner</structfield></entry>
4966 <entry><type>oid</type></entry>
4967 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4968 <entry>Owner of the dictionary</entry>
4969 </row>
4971 <row>
4972 <entry><structfield>dicttemplate</structfield></entry>
4973 <entry><type>oid</type></entry>
4974 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4975 <entry>The OID of the text search template for this dictionary</entry>
4976 </row>
4978 <row>
4979 <entry><structfield>dictinitoption</structfield></entry>
4980 <entry><type>text</type></entry>
4981 <entry></entry>
4982 <entry>Initialization option string for the template</entry>
4983 </row>
4984 </tbody>
4985 </tgroup>
4986 </table>
4987 </sect1>
4990 <sect1 id="catalog-pg-ts-parser">
4991 <title><structname>pg_ts_parser</structname></title>
4993 <indexterm zone="catalog-pg-ts-parser">
4994 <primary>pg_ts_parser</primary>
4995 </indexterm>
4997 <para>
4998 The <structname>pg_ts_parser</structname> catalog contains entries
4999 defining text search parsers. A parser is responsible for splitting
5000 input text into lexemes and assigning a token type to each lexeme.
5001 Since a parser must be implemented by C-language-level functions,
5002 creation of new parsers is restricted to database superusers.
5003 </para>
5005 <para>
5006 <productname>PostgreSQL</productname>'s text search features are
5007 described at length in <xref linkend="textsearch">.
5008 </para>
5010 <table>
5011 <title><structname>pg_ts_parser</> Columns</title>
5013 <tgroup cols=4>
5014 <thead>
5015 <row>
5016 <entry>Name</entry>
5017 <entry>Type</entry>
5018 <entry>References</entry>
5019 <entry>Description</entry>
5020 </row>
5021 </thead>
5023 <tbody>
5024 <row>
5025 <entry><structfield>prsname</structfield></entry>
5026 <entry><type>name</type></entry>
5027 <entry></entry>
5028 <entry>Text search parser name</entry>
5029 </row>
5031 <row>
5032 <entry><structfield>prsnamespace</structfield></entry>
5033 <entry><type>oid</type></entry>
5034 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5035 <entry>
5036 The OID of the namespace that contains this parser
5037 </entry>
5038 </row>
5040 <row>
5041 <entry><structfield>prsstart</structfield></entry>
5042 <entry><type>regproc</type></entry>
5043 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5044 <entry>OID of the parser's startup function</entry>
5045 </row>
5047 <row>
5048 <entry><structfield>prstoken</structfield></entry>
5049 <entry><type>regproc</type></entry>
5050 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5051 <entry>OID of the parser's next-token function</entry>
5052 </row>
5054 <row>
5055 <entry><structfield>prsend</structfield></entry>
5056 <entry><type>regproc</type></entry>
5057 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5058 <entry>OID of the parser's shutdown function</entry>
5059 </row>
5061 <row>
5062 <entry><structfield>prsheadline</structfield></entry>
5063 <entry><type>regproc</type></entry>
5064 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5065 <entry>OID of the parser's headline function</entry>
5066 </row>
5068 <row>
5069 <entry><structfield>prslextype</structfield></entry>
5070 <entry><type>regproc</type></entry>
5071 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5072 <entry>OID of the parser's lextype function</entry>
5073 </row>
5074 </tbody>
5075 </tgroup>
5076 </table>
5077 </sect1>
5080 <sect1 id="catalog-pg-ts-template">
5081 <title><structname>pg_ts_template</structname></title>
5083 <indexterm zone="catalog-pg-ts-template">
5084 <primary>pg_ts_template</primary>
5085 </indexterm>
5087 <para>
5088 The <structname>pg_ts_template</structname> catalog contains entries
5089 defining text search templates. A template is the implementation
5090 skeleton for a class of text search dictionaries.
5091 Since a template must be implemented by C-language-level functions,
5092 creation of new templates is restricted to database superusers.
5093 </para>
5095 <para>
5096 <productname>PostgreSQL</productname>'s text search features are
5097 described at length in <xref linkend="textsearch">.
5098 </para>
5100 <table>
5101 <title><structname>pg_ts_template</> Columns</title>
5103 <tgroup cols=4>
5104 <thead>
5105 <row>
5106 <entry>Name</entry>
5107 <entry>Type</entry>
5108 <entry>References</entry>
5109 <entry>Description</entry>
5110 </row>
5111 </thead>
5113 <tbody>
5114 <row>
5115 <entry><structfield>tmplname</structfield></entry>
5116 <entry><type>name</type></entry>
5117 <entry></entry>
5118 <entry>Text search template name</entry>
5119 </row>
5121 <row>
5122 <entry><structfield>tmplnamespace</structfield></entry>
5123 <entry><type>oid</type></entry>
5124 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5125 <entry>
5126 The OID of the namespace that contains this template
5127 </entry>
5128 </row>
5130 <row>
5131 <entry><structfield>tmplinit</structfield></entry>
5132 <entry><type>regproc</type></entry>
5133 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5134 <entry>OID of the template's initialization function</entry>
5135 </row>
5137 <row>
5138 <entry><structfield>tmpllexize</structfield></entry>
5139 <entry><type>regproc</type></entry>
5140 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5141 <entry>OID of the template's lexize function</entry>
5142 </row>
5143 </tbody>
5144 </tgroup>
5145 </table>
5146 </sect1>
5149 <sect1 id="catalog-pg-type">
5150 <title><structname>pg_type</structname></title>
5152 <indexterm zone="catalog-pg-type">
5153 <primary>pg_type</primary>
5154 </indexterm>
5156 <para>
5157 The catalog <structname>pg_type</structname> stores information about data
5158 types. Base types and enum types (scalar types) are created with
5159 <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
5160 domains with
5161 <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
5162 A composite type is automatically created for each table in the database, to
5163 represent the row structure of the table. It is also possible to create
5164 composite types with <command>CREATE TYPE AS</command>.
5165 </para>
5167 <table>
5168 <title><structname>pg_type</> Columns</title>
5170 <tgroup cols=4>
5171 <thead>
5172 <row>
5173 <entry>Name</entry>
5174 <entry>Type</entry>
5175 <entry>References</entry>
5176 <entry>Description</entry>
5177 </row>
5178 </thead>
5180 <tbody>
5181 <row>
5182 <entry><structfield>typname</structfield></entry>
5183 <entry><type>name</type></entry>
5184 <entry></entry>
5185 <entry>Data type name</entry>
5186 </row>
5188 <row>
5189 <entry><structfield>typnamespace</structfield></entry>
5190 <entry><type>oid</type></entry>
5191 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5192 <entry>
5193 The OID of the namespace that contains this type
5194 </entry>
5195 </row>
5197 <row>
5198 <entry><structfield>typowner</structfield></entry>
5199 <entry><type>oid</type></entry>
5200 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5201 <entry>Owner of the type</entry>
5202 </row>
5204 <row>
5205 <entry><structfield>typlen</structfield></entry>
5206 <entry><type>int2</type></entry>
5207 <entry></entry>
5208 <entry>
5209 For a fixed-size type, <structfield>typlen</structfield> is the number
5210 of bytes in the internal representation of the type. But for a
5211 variable-length type, <structfield>typlen</structfield> is negative.
5212 -1 indicates a <quote>varlena</> type (one that has a length word),
5213 -2 indicates a null-terminated C string.
5214 </entry>
5215 </row>
5217 <row>
5218 <entry><structfield>typbyval</structfield></entry>
5219 <entry><type>bool</type></entry>
5220 <entry></entry>
5221 <entry>
5222 <structfield>typbyval</structfield> determines whether internal
5223 routines pass a value of this type by value or by reference.
5224 <structfield>typbyval</structfield> had better be false if
5225 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
5226 where Datum is 8 bytes).
5227 Variable-length types are always passed by reference. Note that
5228 <structfield>typbyval</structfield> can be false even if the
5229 length would allow pass-by-value
5230 </entry>
5231 </row>
5233 <row>
5234 <entry><structfield>typtype</structfield></entry>
5235 <entry><type>char</type></entry>
5236 <entry></entry>
5237 <entry>
5238 <structfield>typtype</structfield> is
5239 <literal>b</literal> for a base type,
5240 <literal>c</literal> for a composite type (e.g., a table's row type),
5241 <literal>d</literal> for a domain,
5242 <literal>e</literal> for an enum type,
5243 or <literal>p</literal> for a pseudo-type.
5244 See also <structfield>typrelid</structfield> and
5245 <structfield>typbasetype</structfield>
5246 </entry>
5247 </row>
5249 <row>
5250 <entry><structfield>typcategory</structfield></entry>
5251 <entry><type>char</type></entry>
5252 <entry></entry>
5253 <entry>
5254 <structfield>typcategory</structfield> is an arbitrary classification
5255 of data types that is used by the parser to determine which implicit
5256 casts should be <quote>preferred</>.
5257 See <xref linkend="catalog-typcategory-table">
5258 </entry>
5259 </row>
5261 <row>
5262 <entry><structfield>typispreferred</structfield></entry>
5263 <entry><type>bool</type></entry>
5264 <entry></entry>
5265 <entry>
5266 True if the type is a preferred cast target within its
5267 <structfield>typcategory</structfield>
5268 </entry>
5269 </row>
5271 <row>
5272 <entry><structfield>typisdefined</structfield></entry>
5273 <entry><type>bool</type></entry>
5274 <entry></entry>
5275 <entry>
5276 True if the type is defined, false if this is a placeholder
5277 entry for a not-yet-defined type. When
5278 <structfield>typisdefined</structfield> is false, nothing
5279 except the type name, namespace, and OID can be relied on
5280 </entry>
5281 </row>
5283 <row>
5284 <entry><structfield>typdelim</structfield></entry>
5285 <entry><type>char</type></entry>
5286 <entry></entry>
5287 <entry>
5288 Character that separates two values of this type when parsing
5289 array input. Note that the delimiter is associated with the array
5290 element data type, not the array data type
5291 </entry>
5292 </row>
5294 <row>
5295 <entry><structfield>typrelid</structfield></entry>
5296 <entry><type>oid</type></entry>
5297 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5298 <entry>
5299 If this is a composite type (see
5300 <structfield>typtype</structfield>), then this column points to
5301 the <structname>pg_class</structname> entry that defines the
5302 corresponding table. (For a free-standing composite type, the
5303 <structname>pg_class</structname> entry doesn't really represent
5304 a table, but it is needed anyway for the type's
5305 <structname>pg_attribute</structname> entries to link to.)
5306 Zero for non-composite types
5307 </entry>
5308 </row>
5310 <row>
5311 <entry><structfield>typelem</structfield></entry>
5312 <entry><type>oid</type></entry>
5313 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5314 <entry>
5315 If <structfield>typelem</structfield> is not 0 then it
5316 identifies another row in <structname>pg_type</structname>.
5317 The current type can then be subscripted like an array yielding
5318 values of type <structfield>typelem</structfield>. A
5319 <quote>true</quote> array type is variable length
5320 (<structfield>typlen</structfield> = -1),
5321 but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
5322 also have nonzero <structfield>typelem</structfield>, for example
5323 <type>name</type> and <type>point</type>.
5324 If a fixed-length type has a <structfield>typelem</structfield> then
5325 its internal representation must be some number of values of the
5326 <structfield>typelem</structfield> data type with no other data.
5327 Variable-length array types have a header defined by the array
5328 subroutines
5329 </entry>
5330 </row>
5332 <row>
5333 <entry><structfield>typarray</structfield></entry>
5334 <entry><type>oid</type></entry>
5335 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5336 <entry>
5337 If <structfield>typarray</structfield> is not 0 then it
5338 identifies another row in <structname>pg_type</structname>, which
5339 is the <quote>true</quote> array type having this type as element
5340 </entry>
5341 </row>
5343 <row>
5344 <entry><structfield>typinput</structfield></entry>
5345 <entry><type>regproc</type></entry>
5346 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5347 <entry>Input conversion function (text format)</entry>
5348 </row>
5350 <row>
5351 <entry><structfield>typoutput</structfield></entry>
5352 <entry><type>regproc</type></entry>
5353 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5354 <entry>Output conversion function (text format)</entry>
5355 </row>
5357 <row>
5358 <entry><structfield>typreceive</structfield></entry>
5359 <entry><type>regproc</type></entry>
5360 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5361 <entry>Input conversion function (binary format), or 0 if none</entry>
5362 </row>
5364 <row>
5365 <entry><structfield>typsend</structfield></entry>
5366 <entry><type>regproc</type></entry>
5367 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5368 <entry>Output conversion function (binary format), or 0 if none</entry>
5369 </row>
5371 <row>
5372 <entry><structfield>typmodin</structfield></entry>
5373 <entry><type>regproc</type></entry>
5374 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5375 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5376 </row>
5378 <row>
5379 <entry><structfield>typmodout</structfield></entry>
5380 <entry><type>regproc</type></entry>
5381 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5382 <entry>Type modifier output function, or 0 to use the standard format</entry>
5383 </row>
5385 <row>
5386 <entry><structfield>typanalyze</structfield></entry>
5387 <entry><type>regproc</type></entry>
5388 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5389 <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5390 </row>
5392 <row>
5393 <entry><structfield>typalign</structfield></entry>
5394 <entry><type>char</type></entry>
5395 <entry></entry>
5396 <entry><para>
5398 <structfield>typalign</structfield> is the alignment required
5399 when storing a value of this type. It applies to storage on
5400 disk as well as most representations of the value inside
5401 <productname>PostgreSQL</>.
5402 When multiple values are stored consecutively, such
5403 as in the representation of a complete row on disk, padding is
5404 inserted before a datum of this type so that it begins on the
5405 specified boundary. The alignment reference is the beginning
5406 of the first datum in the sequence.
5407 </para><para>
5408 Possible values are:
5409 <itemizedlist>
5410 <listitem>
5411 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5412 </listitem>
5413 <listitem>
5414 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5415 </listitem>
5416 <listitem>
5417 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5418 </listitem>
5419 <listitem>
5420 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5421 </listitem>
5422 </itemizedlist>
5423 </para><note>
5424 <para>
5425 For types used in system tables, it is critical that the size
5426 and alignment defined in <structname>pg_type</structname>
5427 agree with the way that the compiler will lay out the column in
5428 a structure representing a table row.
5429 </para>
5430 </note></entry>
5431 </row>
5433 <row>
5434 <entry><structfield>typstorage</structfield></entry>
5435 <entry><type>char</type></entry>
5436 <entry></entry>
5437 <entry><para>
5438 <structfield>typstorage</structfield> tells for varlena
5439 types (those with <structfield>typlen</structfield> = -1) if
5440 the type is prepared for toasting and what the default strategy
5441 for attributes of this type should be.
5442 Possible values are
5443 <itemizedlist>
5444 <listitem>
5445 <para><literal>p</>: Value must always be stored plain.</para>
5446 </listitem>
5447 <listitem>
5448 <para>
5449 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5450 relation (if relation has one, see
5451 <literal>pg_class.reltoastrelid</literal>).
5452 </para>
5453 </listitem>
5454 <listitem>
5455 <para><literal>m</>: Value can be stored compressed inline.</para>
5456 </listitem>
5457 <listitem>
5458 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5459 </listitem>
5460 </itemizedlist>
5461 Note that <literal>m</> columns can also be moved out to secondary
5462 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5463 moved first).
5464 </para></entry>
5465 </row>
5467 <row>
5468 <entry><structfield>typnotnull</structfield></entry>
5469 <entry><type>bool</type></entry>
5470 <entry></entry>
5471 <entry><para>
5472 <structfield>typnotnull</structfield> represents a not-null
5473 constraint on a type. Used for domains only
5474 </para></entry>
5475 </row>
5477 <row>
5478 <entry><structfield>typbasetype</structfield></entry>
5479 <entry><type>oid</type></entry>
5480 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5481 <entry><para>
5482 If this is a domain (see <structfield>typtype</structfield>), then
5483 <structfield>typbasetype</structfield> identifies the type that this
5484 one is based on. Zero if this type is not a domain
5485 </para></entry>
5486 </row>
5488 <row>
5489 <entry><structfield>typtypmod</structfield></entry>
5490 <entry><type>int4</type></entry>
5491 <entry></entry>
5492 <entry><para>
5493 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5494 to be applied to their base type (-1 if base type does not use a
5495 <literal>typmod</>). -1 if this type is not a domain
5496 </para></entry>
5497 </row>
5499 <row>
5500 <entry><structfield>typndims</structfield></entry>
5501 <entry><type>int4</type></entry>
5502 <entry></entry>
5503 <entry><para>
5504 <structfield>typndims</structfield> is the number of array dimensions
5505 for a domain that is an array (that is, <structfield>typbasetype</> is
5506 an array type; the domain's <structfield>typelem</> will match the base
5507 type's <structfield>typelem</structfield>).
5508 Zero for types other than domains over array types
5509 </para></entry>
5510 </row>
5512 <row>
5513 <entry><structfield>typdefaultbin</structfield></entry>
5514 <entry><type>text</type></entry>
5515 <entry></entry>
5516 <entry><para>
5517 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5518 representation of a default expression for the type. This is
5519 only used for domains
5520 </para></entry>
5521 </row>
5523 <row>
5524 <entry><structfield>typdefault</structfield></entry>
5525 <entry><type>text</type></entry>
5526 <entry></entry>
5527 <entry><para>
5528 <structfield>typdefault</> is null if the type has no associated
5529 default value. If <structfield>typdefaultbin</> is not null,
5530 <structfield>typdefault</> must contain a human-readable version of the
5531 default expression represented by <structfield>typdefaultbin</>. If
5532 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5533 not, then <structfield>typdefault</> is the external representation of
5534 the type's default value, which might be fed to the type's input
5535 converter to produce a constant
5536 </para></entry>
5537 </row>
5538 </tbody>
5539 </tgroup>
5540 </table>
5542 <para>
5543 <xref linkend="catalog-typcategory-table"> lists the system-defined values
5544 of <structfield>typcategory</>. Any future additions to this list will
5545 also be upper-case ASCII letters. All other ASCII characters are reserved
5546 for user-defined categories.
5547 </para>
5549 <table id="catalog-typcategory-table">
5550 <title><structfield>typcategory</> Codes</title>
5552 <tgroup cols=2>
5553 <thead>
5554 <row>
5555 <entry>Code</entry>
5556 <entry>Category</entry>
5557 </row>
5558 </thead>
5560 <tbody>
5561 <row>
5562 <entry><literal>A</literal></entry>
5563 <entry>Array types</entry>
5564 </row>
5565 <row>
5566 <entry><literal>B</literal></entry>
5567 <entry>Boolean types</entry>
5568 </row>
5569 <row>
5570 <entry><literal>C</literal></entry>
5571 <entry>Composite types</entry>
5572 </row>
5573 <row>
5574 <entry><literal>D</literal></entry>
5575 <entry>Date/time types</entry>
5576 </row>
5577 <row>
5578 <entry><literal>E</literal></entry>
5579 <entry>Enum types</entry>
5580 </row>
5581 <row>
5582 <entry><literal>G</literal></entry>
5583 <entry>Geometric types</entry>
5584 </row>
5585 <row>
5586 <entry><literal>I</literal></entry>
5587 <entry>Network address types</entry>
5588 </row>
5589 <row>
5590 <entry><literal>N</literal></entry>
5591 <entry>Numeric types</entry>
5592 </row>
5593 <row>
5594 <entry><literal>P</literal></entry>
5595 <entry>Pseudo-types</entry>
5596 </row>
5597 <row>
5598 <entry><literal>S</literal></entry>
5599 <entry>String types</entry>
5600 </row>
5601 <row>
5602 <entry><literal>T</literal></entry>
5603 <entry>Timespan types</entry>
5604 </row>
5605 <row>
5606 <entry><literal>U</literal></entry>
5607 <entry>User-defined types</entry>
5608 </row>
5609 <row>
5610 <entry><literal>V</literal></entry>
5611 <entry>Bit-string types</entry>
5612 </row>
5613 <row>
5614 <entry><literal>X</literal></entry>
5615 <entry><type>unknown</> type</entry>
5616 </row>
5617 </tbody>
5618 </tgroup>
5619 </table>
5621 </sect1>
5623 <sect1 id="views-overview">
5624 <title>System Views</title>
5626 <para>
5627 In addition to the system catalogs, <productname>PostgreSQL</productname>
5628 provides a number of built-in views. Some system views provide convenient
5629 access to some commonly used queries on the system catalogs. Other views
5630 provide access to internal server state.
5631 </para>
5633 <para>
5634 The information schema (<xref linkend="information-schema">) provides
5635 an alternative set of views which overlap the functionality of the system
5636 views. Since the information schema is SQL-standard whereas the views
5637 described here are <productname>PostgreSQL</productname>-specific,
5638 it's usually better to use the information schema if it provides all
5639 the information you need.
5640 </para>
5642 <para>
5643 <xref linkend="view-table"> lists the system views described here.
5644 More detailed documentation of each view follows below.
5645 There are some additional views that provide access to the results of
5646 the statistics collector; they are described in <xref
5647 linkend="monitoring-stats-views-table">.
5648 </para>
5650 <para>
5651 Except where noted, all the views described here are read-only.
5652 </para>
5654 <table id="view-table">
5655 <title>System Views</title>
5657 <tgroup cols="2">
5658 <thead>
5659 <row>
5660 <entry>View Name</entry>
5661 <entry>Purpose</entry>
5662 </row>
5663 </thead>
5665 <tbody>
5666 <row>
5667 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5668 <entry>open cursors</entry>
5669 </row>
5671 <row>
5672 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5673 <entry>groups of database users</entry>
5674 </row>
5676 <row>
5677 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5678 <entry>indexes</entry>
5679 </row>
5681 <row>
5682 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5683 <entry>currently held locks</entry>
5684 </row>
5686 <row>
5687 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5688 <entry>prepared statements</entry>
5689 </row>
5691 <row>
5692 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5693 <entry>prepared transactions</entry>
5694 </row>
5696 <row>
5697 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5698 <entry>database roles</entry>
5699 </row>
5701 <row>
5702 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5703 <entry>rules</entry>
5704 </row>
5706 <row>
5707 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5708 <entry>parameter settings</entry>
5709 </row>
5711 <row>
5712 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5713 <entry>database users</entry>
5714 </row>
5716 <row>
5717 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5718 <entry>planner statistics</entry>
5719 </row>
5721 <row>
5722 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5723 <entry>tables</entry>
5724 </row>
5726 <row>
5727 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5728 <entry>time zone abbreviations</entry>
5729 </row>
5731 <row>
5732 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5733 <entry>time zone names</entry>
5734 </row>
5736 <row>
5737 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5738 <entry>database users</entry>
5739 </row>
5741 <row>
5742 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5743 <entry>views</entry>
5744 </row>
5746 </tbody>
5747 </tgroup>
5748 </table>
5749 </sect1>
5751 <sect1 id="view-pg-cursors">
5752 <title><structname>pg_cursors</structname></title>
5754 <indexterm zone="view-pg-cursors">
5755 <primary>pg_cursors</primary>
5756 </indexterm>
5758 <para>
5759 The <structname>pg_cursors</structname> view lists the cursors that
5760 are currently available. Cursors can be defined in several ways:
5761 <itemizedlist>
5762 <listitem>
5763 <para>
5764 via the <xref linkend="sql-declare" endterm="sql-declare-title">
5765 statement in SQL
5766 </para>
5767 </listitem>
5769 <listitem>
5770 <para>
5771 via the Bind message in the frontend/backend protocol, as
5772 described in <xref linkend="protocol-flow-ext-query">
5773 </para>
5774 </listitem>
5776 <listitem>
5777 <para>
5778 via the Server Programming Interface (SPI), as described in
5779 <xref linkend="spi-interface">
5780 </para>
5781 </listitem>
5782 </itemizedlist>
5784 The <structname>pg_cursors</structname> view displays cursors
5785 created by any of these means. Cursors only exist for the duration
5786 of the transaction that defines them, unless they have been
5787 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5788 cursors are only present in the view until the end of their
5789 creating transaction.
5791 <note>
5792 <para>
5793 Cursors are used internally to implement some of the components
5794 of <productname>PostgreSQL</>, such as procedural languages.
5795 Therefore, the <structname>pg_cursors</> view might include cursors
5796 that have not been explicitly created by the user.
5797 </para>
5798 </note>
5799 </para>
5801 <table>
5802 <title><structname>pg_cursors</> Columns</title>
5804 <tgroup cols=3>
5805 <thead>
5806 <row>
5807 <entry>Name</entry>
5808 <entry>Type</entry>
5809 <entry>Description</entry>
5810 </row>
5811 </thead>
5813 <tbody>
5814 <row>
5815 <entry><structfield>name</structfield></entry>
5816 <entry><type>text</type></entry>
5817 <entry>The name of the cursor</entry>
5818 </row>
5820 <row>
5821 <entry><structfield>statement</structfield></entry>
5822 <entry><type>text</type></entry>
5823 <entry>The verbatim query string submitted to declare this cursor</entry>
5824 </row>
5826 <row>
5827 <entry><structfield>is_holdable</structfield></entry>
5828 <entry><type>boolean</type></entry>
5829 <entry>
5830 <literal>true</literal> if the cursor is holdable (that is, it
5831 can be accessed after the transaction that declared the cursor
5832 has committed); <literal>false</literal> otherwise
5833 </entry>
5834 </row>
5836 <row>
5837 <entry><structfield>is_binary</structfield></entry>
5838 <entry><type>boolean</type></entry>
5839 <entry>
5840 <literal>true</literal> if the cursor was declared
5841 <literal>BINARY</literal>; <literal>false</literal>
5842 otherwise
5843 </entry>
5844 </row>
5846 <row>
5847 <entry><structfield>is_scrollable</structfield></entry>
5848 <entry><type>boolean</type></entry>
5849 <entry>
5850 <literal>true</> if the cursor is scrollable (that is, it
5851 allows rows to be retrieved in a nonsequential manner);
5852 <literal>false</literal> otherwise
5853 </entry>
5854 </row>
5856 <row>
5857 <entry><structfield>creation_time</structfield></entry>
5858 <entry><type>timestamptz</type></entry>
5859 <entry>The time at which the cursor was declared</entry>
5860 </row>
5861 </tbody>
5862 </tgroup>
5863 </table>
5865 <para>
5866 The <structname>pg_cursors</structname> view is read only.
5867 </para>
5869 </sect1>
5871 <sect1 id="view-pg-group">
5872 <title><structname>pg_group</structname></title>
5874 <indexterm zone="view-pg-group">
5875 <primary>pg_group</primary>
5876 </indexterm>
5878 <para>
5879 The view <structname>pg_group</structname> exists for backwards
5880 compatibility: it emulates a catalog that existed in
5881 <productname>PostgreSQL</productname> before version 8.1.
5882 It shows the names and members of all roles that are marked as not
5883 <structfield>rolcanlogin</>, which is an approximation to the set
5884 of roles that are being used as groups.
5885 </para>
5887 <table>
5888 <title><structname>pg_group</> Columns</title>
5890 <tgroup cols=4>
5891 <thead>
5892 <row>
5893 <entry>Name</entry>
5894 <entry>Type</entry>
5895 <entry>References</entry>
5896 <entry>Description</entry>
5897 </row>
5898 </thead>
5900 <tbody>
5901 <row>
5902 <entry><structfield>groname</structfield></entry>
5903 <entry><type>name</type></entry>
5904 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5905 <entry>Name of the group</entry>
5906 </row>
5908 <row>
5909 <entry><structfield>grosysid</structfield></entry>
5910 <entry><type>oid</type></entry>
5911 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5912 <entry>ID of this group</entry>
5913 </row>
5915 <row>
5916 <entry><structfield>grolist</structfield></entry>
5917 <entry><type>oid[]</type></entry>
5918 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5919 <entry>An array containing the IDs of the roles in this group</entry>
5920 </row>
5921 </tbody>
5922 </tgroup>
5923 </table>
5925 </sect1>
5927 <sect1 id="view-pg-indexes">
5928 <title><structname>pg_indexes</structname></title>
5930 <indexterm zone="view-pg-indexes">
5931 <primary>pg_indexes</primary>
5932 </indexterm>
5934 <para>
5935 The view <structname>pg_indexes</structname> provides access to
5936 useful information about each index in the database.
5937 </para>
5939 <table>
5940 <title><structname>pg_indexes</> Columns</title>
5942 <tgroup cols=4>
5943 <thead>
5944 <row>
5945 <entry>Name</entry>
5946 <entry>Type</entry>
5947 <entry>References</entry>
5948 <entry>Description</entry>
5949 </row>
5950 </thead>
5951 <tbody>
5952 <row>
5953 <entry><structfield>schemaname</structfield></entry>
5954 <entry><type>name</type></entry>
5955 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5956 <entry>Name of schema containing table and index</entry>
5957 </row>
5958 <row>
5959 <entry><structfield>tablename</structfield></entry>
5960 <entry><type>name</type></entry>
5961 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5962 <entry>Name of table the index is for</entry>
5963 </row>
5964 <row>
5965 <entry><structfield>indexname</structfield></entry>
5966 <entry><type>name</type></entry>
5967 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5968 <entry>Name of index</entry>
5969 </row>
5970 <row>
5971 <entry><structfield>tablespace</structfield></entry>
5972 <entry><type>name</type></entry>
5973 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
5974 <entry>Name of tablespace containing index (NULL if default for database)</entry>
5975 </row>
5976 <row>
5977 <entry><structfield>indexdef</structfield></entry>
5978 <entry><type>text</type></entry>
5979 <entry></entry>
5980 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
5981 command)</entry>
5982 </row>
5983 </tbody>
5984 </tgroup>
5985 </table>
5987 </sect1>
5989 <sect1 id="view-pg-locks">
5990 <title><structname>pg_locks</structname></title>
5992 <indexterm zone="view-pg-locks">
5993 <primary>pg_locks</primary>
5994 </indexterm>
5996 <para>
5997 The view <structname>pg_locks</structname> provides access to
5998 information about the locks held by open transactions within the
5999 database server. See <xref linkend="mvcc"> for more discussion
6000 of locking.
6001 </para>
6003 <para>
6004 <structname>pg_locks</structname> contains one row per active lockable
6005 object, requested lock mode, and relevant transaction. Thus, the same
6006 lockable object might
6007 appear many times, if multiple transactions are holding or waiting
6008 for locks on it. However, an object that currently has no locks on it
6009 will not appear at all.
6010 </para>
6012 <para>
6013 There are several distinct types of lockable objects:
6014 whole relations (e.g., tables), individual pages of relations,
6015 individual tuples of relations,
6016 transaction IDs (both virtual and permanent IDs),
6017 and general database objects (identified by class OID and object OID,
6018 in the same way as in <structname>pg_description</structname> or
6019 <structname>pg_depend</structname>). Also, the right to extend a
6020 relation is represented as a separate lockable object.
6021 </para>
6023 <table>
6024 <title><structname>pg_locks</> Columns</title>
6026 <tgroup cols=4>
6027 <thead>
6028 <row>
6029 <entry>Name</entry>
6030 <entry>Type</entry>
6031 <entry>References</entry>
6032 <entry>Description</entry>
6033 </row>
6034 </thead>
6035 <tbody>
6036 <row>
6037 <entry><structfield>locktype</structfield></entry>
6038 <entry><type>text</type></entry>
6039 <entry></entry>
6040 <entry>
6041 type of the lockable object:
6042 <literal>relation</>,
6043 <literal>extend</>,
6044 <literal>page</>,
6045 <literal>tuple</>,
6046 <literal>transactionid</>,
6047 <literal>virtualxid</>,
6048 <literal>object</>,
6049 <literal>userlock</>, or
6050 <literal>advisory</>
6051 </entry>
6052 </row>
6053 <row>
6054 <entry><structfield>database</structfield></entry>
6055 <entry><type>oid</type></entry>
6056 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6057 <entry>
6058 OID of the database in which the object exists, or
6059 zero if the object is a shared object, or
6060 NULL if the object is a transaction ID
6061 </entry>
6062 </row>
6063 <row>
6064 <entry><structfield>relation</structfield></entry>
6065 <entry><type>oid</type></entry>
6066 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6067 <entry>
6068 OID of the relation, or NULL if the object is not
6069 a relation or part of a relation
6070 </entry>
6071 </row>
6072 <row>
6073 <entry><structfield>page</structfield></entry>
6074 <entry><type>integer</type></entry>
6075 <entry></entry>
6076 <entry>
6077 Page number within the relation, or NULL if the object
6078 is not a tuple or relation page
6079 </entry>
6080 </row>
6081 <row>
6082 <entry><structfield>tuple</structfield></entry>
6083 <entry><type>smallint</type></entry>
6084 <entry></entry>
6085 <entry>
6086 Tuple number within the page, or NULL if the object is not a tuple
6087 </entry>
6088 </row>
6089 <row>
6090 <entry><structfield>virtualxid</structfield></entry>
6091 <entry><type>text</type></entry>
6092 <entry></entry>
6093 <entry>
6094 Virtual ID of a transaction, or NULL if the object is not a
6095 virtual transaction ID
6096 </entry>
6097 </row>
6098 <row>
6099 <entry><structfield>transactionid</structfield></entry>
6100 <entry><type>xid</type></entry>
6101 <entry></entry>
6102 <entry>
6103 ID of a transaction, or NULL if the object is not a transaction ID
6104 </entry>
6105 </row>
6106 <row>
6107 <entry><structfield>classid</structfield></entry>
6108 <entry><type>oid</type></entry>
6109 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6110 <entry>
6111 OID of the system catalog containing the object, or NULL if the
6112 object is not a general database object
6113 </entry>
6114 </row>
6115 <row>
6116 <entry><structfield>objid</structfield></entry>
6117 <entry><type>oid</type></entry>
6118 <entry>any OID column</entry>
6119 <entry>
6120 OID of the object within its system catalog, or NULL if the
6121 object is not a general database object.
6122 For advisory locks it is used to distinguish the two key
6123 spaces (<literal>1</> for an int8 key, <literal>2</> for two
6124 int4 keys).
6125 </entry>
6126 </row>
6127 <row>
6128 <entry><structfield>objsubid</structfield></entry>
6129 <entry><type>smallint</type></entry>
6130 <entry></entry>
6131 <entry>
6132 For a table column, this is the column number (the
6133 <structfield>classid</> and <structfield>objid</> refer to the
6134 table itself). For all other object types, this column is
6135 zero. NULL if the object is not a general database object
6136 </entry>
6137 </row>
6138 <row>
6139 <entry><structfield>virtualtransaction</structfield></entry>
6140 <entry><type>text</type></entry>
6141 <entry></entry>
6142 <entry>
6143 Virtual ID of the transaction that is holding or awaiting this lock
6144 </entry>
6145 </row>
6146 <row>
6147 <entry><structfield>pid</structfield></entry>
6148 <entry><type>integer</type></entry>
6149 <entry></entry>
6150 <entry>
6151 Process ID of the server process holding or awaiting this
6152 lock. NULL if the lock is held by a prepared transaction
6153 </entry>
6154 </row>
6155 <row>
6156 <entry><structfield>mode</structfield></entry>
6157 <entry><type>text</type></entry>
6158 <entry></entry>
6159 <entry>Name of the lock mode held or desired by this process (see <xref
6160 linkend="locking-tables">)</entry>
6161 </row>
6162 <row>
6163 <entry><structfield>granted</structfield></entry>
6164 <entry><type>boolean</type></entry>
6165 <entry></entry>
6166 <entry>True if lock is held, false if lock is awaited</entry>
6167 </row>
6168 </tbody>
6169 </tgroup>
6170 </table>
6172 <para>
6173 <structfield>granted</structfield> is true in a row representing a lock
6174 held by the indicated transaction. False indicates that this transaction is
6175 currently waiting to acquire this lock, which implies that some other
6176 transaction is holding a conflicting lock mode on the same lockable object.
6177 The waiting transaction will sleep until the other lock is released (or a
6178 deadlock situation is detected). A single transaction can be waiting to
6179 acquire at most one lock at a time.
6180 </para>
6182 <para>
6183 Every transaction holds an exclusive lock on its virtual transaction ID for
6184 its entire duration. If a permanent ID is assigned to the transaction
6185 (which normally happens only if the transaction changes the state of the
6186 database), it also holds an exclusive lock on its permanent transaction ID
6187 until it ends. When one transaction finds it necessary to wait specifically
6188 for another transaction, it does so by attempting to acquire share lock on
6189 the other transaction ID (either virtual or permanent ID depending on the
6190 situation). That will succeed only when the other transaction
6191 terminates and releases its locks.
6192 </para>
6194 <para>
6195 Although tuples are a lockable type of object,
6196 information about row-level locks is stored on disk, not in memory,
6197 and therefore row-level locks normally do not appear in this view.
6198 If a transaction is waiting for a
6199 row-level lock, it will usually appear in the view as waiting for the
6200 permanent transaction ID of the current holder of that row lock.
6201 </para>
6203 <para>
6204 Advisory locks can be acquired on keys consisting of either a single
6205 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
6206 high-order half in the <structfield>classid</> column, its low-order half
6207 in the <structfield>objid</> column, and <structfield>objsubid</> equal
6208 to 1. Integer keys are displayed with the first key in the
6209 <structfield>classid</> column, the second key in the <structfield>objid</>
6210 column, and <structfield>objsubid</> equal to 2. The actual meaning of
6211 the keys is up to the user. Advisory locks are local to each database,
6212 so the <structfield>database</> column is meaningful for an advisory lock.
6213 </para>
6215 <para>
6216 When the <structname>pg_locks</structname> view is accessed, the
6217 internal lock manager data structures are momentarily locked, and
6218 a copy is made for the view to display. This ensures that the
6219 view produces a consistent set of results, while not blocking
6220 normal lock manager operations longer than necessary. Nonetheless
6221 there could be some impact on database performance if this view is
6222 frequently accessed.
6223 </para>
6225 <para>
6226 <structname>pg_locks</structname> provides a global view of all locks
6227 in the database cluster, not only those relevant to the current database.
6228 Although its <structfield>relation</structfield> column can be joined
6229 against <structname>pg_class</>.<structfield>oid</> to identify locked
6230 relations, this will only work correctly for relations in the current
6231 database (those for which the <structfield>database</structfield> column
6232 is either the current database's OID or zero).
6233 </para>
6235 <para>
6236 The <structfield>pid</structfield> column can be joined to the
6237 <structfield>procpid</structfield> column of the
6238 <structname>pg_stat_activity</structname> view to get more
6239 information on the session holding or waiting to hold each lock.
6240 Also, if you are using prepared transactions, the
6241 <structfield>transaction</> column can be joined to the
6242 <structfield>transaction</structfield> column of the
6243 <structname>pg_prepared_xacts</structname> view to get more
6244 information on prepared transactions that hold locks.
6245 (A prepared transaction can never be waiting for a lock,
6246 but it continues to hold the locks it acquired while running.)
6247 </para>
6249 </sect1>
6251 <sect1 id="view-pg-prepared-statements">
6252 <title><structname>pg_prepared_statements</structname></title>
6254 <indexterm zone="view-pg-prepared-statements">
6255 <primary>pg_prepared_statements</primary>
6256 </indexterm>
6258 <para>
6259 The <structname>pg_prepared_statements</structname> view displays
6260 all the prepared statements that are available in the current
6261 session. See <xref linkend="sql-prepare"
6262 endterm="sql-prepare-title"> for more information about prepared
6263 statements.
6264 </para>
6266 <para>
6267 <structname>pg_prepared_statements</structname> contains one row
6268 for each prepared statement. Rows are added to the view when a new
6269 prepared statement is created and removed when a prepared statement
6270 is released (for example, via the <xref linkend="sql-deallocate"
6271 endterm="sql-deallocate-title"> command).
6272 </para>
6274 <table>
6275 <title><structname>pg_prepared_statements</> Columns</title>
6277 <tgroup cols=3>
6278 <thead>
6279 <row>
6280 <entry>Name</entry>
6281 <entry>Type</entry>
6282 <entry>Description</entry>
6283 </row>
6284 </thead>
6285 <tbody>
6286 <row>
6287 <entry><structfield>name</structfield></entry>
6288 <entry><type>text</type></entry>
6289 <entry>
6290 The identifier of the prepared statement
6291 </entry>
6292 </row>
6293 <row>
6294 <entry><structfield>statement</structfield></entry>
6295 <entry><type>text</type></entry>
6296 <entry>
6297 The query string submitted by the client to create this
6298 prepared statement. For prepared statements created via SQL,
6299 this is the <command>PREPARE</command> statement submitted by
6300 the client. For prepared statements created via the
6301 frontend/backend protocol, this is the text of the prepared
6302 statement itself
6303 </entry>
6304 </row>
6305 <row>
6306 <entry><structfield>prepare_time</structfield></entry>
6307 <entry><type>timestamptz</type></entry>
6308 <entry>
6309 The time at which the prepared statement was created
6310 </entry>
6311 </row>
6312 <row>
6313 <entry><structfield>parameter_types</structfield></entry>
6314 <entry><type>regtype[]</type></entry>
6315 <entry>
6316 The expected parameter types for the prepared statement in the
6317 form of an array of <type>regtype</type>. The OID corresponding
6318 to an element of this array can be obtained by casting the
6319 <type>regtype</type> value to <type>oid</type>
6320 </entry>
6321 </row>
6322 <row>
6323 <entry><structfield>from_sql</structfield></entry>
6324 <entry><type>boolean</type></entry>
6325 <entry>
6326 <literal>true</literal> if the prepared statement was created
6327 via the <command>PREPARE</command> SQL statement;
6328 <literal>false</literal> if the statement was prepared via the
6329 frontend/backend protocol
6330 </entry>
6331 </row>
6332 </tbody>
6333 </tgroup>
6334 </table>
6336 <para>
6337 The <structname>pg_prepared_statements</structname> view is read only.
6338 </para>
6339 </sect1>
6341 <sect1 id="view-pg-prepared-xacts">
6342 <title><structname>pg_prepared_xacts</structname></title>
6344 <indexterm zone="view-pg-prepared-xacts">
6345 <primary>pg_prepared_xacts</primary>
6346 </indexterm>
6348 <para>
6349 The view <structname>pg_prepared_xacts</structname> displays
6350 information about transactions that are currently prepared for two-phase
6351 commit (see <xref linkend="sql-prepare-transaction"
6352 endterm="sql-prepare-transaction-title"> for details).
6353 </para>
6355 <para>
6356 <structname>pg_prepared_xacts</structname> contains one row per prepared
6357 transaction. An entry is removed when the transaction is committed or
6358 rolled back.
6359 </para>
6361 <table>
6362 <title><structname>pg_prepared_xacts</> Columns</title>
6364 <tgroup cols=4>
6365 <thead>
6366 <row>
6367 <entry>Name</entry>
6368 <entry>Type</entry>
6369 <entry>References</entry>
6370 <entry>Description</entry>
6371 </row>
6372 </thead>
6373 <tbody>
6374 <row>
6375 <entry><structfield>transaction</structfield></entry>
6376 <entry><type>xid</type></entry>
6377 <entry></entry>
6378 <entry>
6379 Numeric transaction identifier of the prepared transaction
6380 </entry>
6381 </row>
6382 <row>
6383 <entry><structfield>gid</structfield></entry>
6384 <entry><type>text</type></entry>
6385 <entry></entry>
6386 <entry>
6387 Global transaction identifier that was assigned to the transaction
6388 </entry>
6389 </row>
6390 <row>
6391 <entry><structfield>prepared</structfield></entry>
6392 <entry><type>timestamp with time zone</type></entry>
6393 <entry></entry>
6394 <entry>
6395 Time at which the transaction was prepared for commit
6396 </entry>
6397 </row>
6398 <row>
6399 <entry><structfield>owner</structfield></entry>
6400 <entry><type>name</type></entry>
6401 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6402 <entry>
6403 Name of the user that executed the transaction
6404 </entry>
6405 </row>
6406 <row>
6407 <entry><structfield>database</structfield></entry>
6408 <entry><type>name</type></entry>
6409 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
6410 <entry>
6411 Name of the database in which the transaction was executed
6412 </entry>
6413 </row>
6414 </tbody>
6415 </tgroup>
6416 </table>
6418 <para>
6419 When the <structname>pg_prepared_xacts</structname> view is accessed, the
6420 internal transaction manager data structures are momentarily locked, and
6421 a copy is made for the view to display. This ensures that the
6422 view produces a consistent set of results, while not blocking
6423 normal operations longer than necessary. Nonetheless
6424 there could be some impact on database performance if this view is
6425 frequently accessed.
6426 </para>
6428 </sect1>
6430 <sect1 id="view-pg-roles">
6431 <title><structname>pg_roles</structname></title>
6433 <indexterm zone="view-pg-roles">
6434 <primary>pg_roles</primary>
6435 </indexterm>
6437 <para>
6438 The view <structname>pg_roles</structname> provides access to
6439 information about database roles. This is simply a publicly
6440 readable view of
6441 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6442 that blanks out the password field.
6443 </para>
6445 <para>
6446 This view explicitly exposes the OID column of the underlying table,
6447 since that is needed to do joins to other catalogs.
6448 </para>
6450 <table>
6451 <title><structname>pg_roles</> Columns</title>
6453 <tgroup cols=4>
6454 <thead>
6455 <row>
6456 <entry>Name</entry>
6457 <entry>Type</entry>
6458 <entry>References</entry>
6459 <entry>Description</entry>
6460 </row>
6461 </thead>
6463 <tbody>
6464 <row>
6465 <entry><structfield>rolname</structfield></entry>
6466 <entry><type>name</type></entry>
6467 <entry></entry>
6468 <entry>Role name</entry>
6469 </row>
6471 <row>
6472 <entry><structfield>rolsuper</structfield></entry>
6473 <entry><type>bool</type></entry>
6474 <entry></entry>
6475 <entry>Role has superuser privileges</entry>
6476 </row>
6478 <row>
6479 <entry><structfield>rolinherit</structfield></entry>
6480 <entry><type>bool</type></entry>
6481 <entry></entry>
6482 <entry>Role automatically inherits privileges of roles it is a
6483 member of</entry>
6484 </row>
6486 <row>
6487 <entry><structfield>rolcreaterole</structfield></entry>
6488 <entry><type>bool</type></entry>
6489 <entry></entry>
6490 <entry>Role can create more roles</entry>
6491 </row>
6493 <row>
6494 <entry><structfield>rolcreatedb</structfield></entry>
6495 <entry><type>bool</type></entry>
6496 <entry></entry>
6497 <entry>Role can create databases</entry>
6498 </row>
6500 <row>
6501 <entry><structfield>rolcatupdate</structfield></entry>
6502 <entry><type>bool</type></entry>
6503 <entry></entry>
6504 <entry>
6505 Role can update system catalogs directly. (Even a superuser cannot do
6506 this unless this column is true.)
6507 </entry>
6508 </row>
6510 <row>
6511 <entry><structfield>rolcanlogin</structfield></entry>
6512 <entry><type>bool</type></entry>
6513 <entry></entry>
6514 <entry>
6515 Role can log in. That is, this role can be given as the initial
6516 session authorization identifier
6517 </entry>
6518 </row>
6520 <row>
6521 <entry><structfield>rolconnlimit</structfield></entry>
6522 <entry><type>int4</type></entry>
6523 <entry></entry>
6524 <entry>
6525 For roles that can log in, this sets maximum number of concurrent
6526 connections this role can make. -1 means no limit
6527 </entry>
6528 </row>
6530 <row>
6531 <entry><structfield>rolpassword</structfield></entry>
6532 <entry><type>text</type></entry>
6533 <entry></entry>
6534 <entry>Not the password (always reads as <literal>********</>)</entry>
6535 </row>
6537 <row>
6538 <entry><structfield>rolvaliduntil</structfield></entry>
6539 <entry><type>timestamptz</type></entry>
6540 <entry></entry>
6541 <entry>Password expiry time (only used for password authentication);
6542 NULL if no expiration</entry>
6543 </row>
6545 <row>
6546 <entry><structfield>rolconfig</structfield></entry>
6547 <entry><type>text[]</type></entry>
6548 <entry></entry>
6549 <entry>Session defaults for run-time configuration variables</entry>
6550 </row>
6552 <row>
6553 <entry><structfield>oid</structfield></entry>
6554 <entry><type>oid</type></entry>
6555 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6556 <entry>ID of role</entry>
6557 </row>
6558 </tbody>
6559 </tgroup>
6560 </table>
6562 </sect1>
6564 <sect1 id="view-pg-rules">
6565 <title><structname>pg_rules</structname></title>
6567 <indexterm zone="view-pg-rules">
6568 <primary>pg_rules</primary>
6569 </indexterm>
6571 <para>
6572 The view <structname>pg_rules</structname> provides access to
6573 useful information about query rewrite rules.
6574 </para>
6576 <table>
6577 <title><structname>pg_rules</> Columns</title>
6579 <tgroup cols=4>
6580 <thead>
6581 <row>
6582 <entry>Name</entry>
6583 <entry>Type</entry>
6584 <entry>References</entry>
6585 <entry>Description</entry>
6586 </row>
6587 </thead>
6588 <tbody>
6589 <row>
6590 <entry><structfield>schemaname</structfield></entry>
6591 <entry><type>name</type></entry>
6592 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6593 <entry>Name of schema containing table</entry>
6594 </row>
6595 <row>
6596 <entry><structfield>tablename</structfield></entry>
6597 <entry><type>name</type></entry>
6598 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6599 <entry>Name of table the rule is for</entry>
6600 </row>
6601 <row>
6602 <entry><structfield>rulename</structfield></entry>
6603 <entry><type>name</type></entry>
6604 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6605 <entry>Name of rule</entry>
6606 </row>
6607 <row>
6608 <entry><structfield>definition</structfield></entry>
6609 <entry><type>text</type></entry>
6610 <entry></entry>
6611 <entry>Rule definition (a reconstructed creation command)</entry>
6612 </row>
6613 </tbody>
6614 </tgroup>
6615 </table>
6617 <para>
6618 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6619 of views; those can be seen in <structname>pg_views</>.
6620 </para>
6622 </sect1>
6624 <sect1 id="view-pg-settings">
6625 <title><structname>pg_settings</structname></title>
6627 <indexterm zone="view-pg-settings">
6628 <primary>pg_settings</primary>
6629 </indexterm>
6631 <para>
6632 The view <structname>pg_settings</structname> provides access to
6633 run-time parameters of the server. It is essentially an alternative
6634 interface to the <xref linkend="sql-show" endterm="sql-show-title">
6635 and <xref linkend="sql-set" endterm="sql-set-title"> commands.
6636 It also provides access to some facts about each parameter that are
6637 not directly available from <command>SHOW</>, such as minimum and
6638 maximum values.
6639 </para>
6641 <table>
6642 <title><structname>pg_settings</> Columns</title>
6644 <tgroup cols=3>
6645 <thead>
6646 <row>
6647 <entry>Name</entry>
6648 <entry>Type</entry>
6649 <entry>Description</entry>
6650 </row>
6651 </thead>
6652 <tbody>
6653 <row>
6654 <entry><structfield>name</structfield></entry>
6655 <entry><type>text</type></entry>
6656 <entry>Run-time configuration parameter name</entry>
6657 </row>
6658 <row>
6659 <entry><structfield>setting</structfield></entry>
6660 <entry><type>text</type></entry>
6661 <entry>Current value of the parameter</entry>
6662 </row>
6663 <row>
6664 <entry><structfield>unit</structfield></entry>
6665 <entry><type>text</type></entry>
6666 <entry>Implicit unit of the parameter</entry>
6667 </row>
6668 <row>
6669 <entry><structfield>category</structfield></entry>
6670 <entry><type>text</type></entry>
6671 <entry>Logical group of the parameter</entry>
6672 </row>
6673 <row>
6674 <entry><structfield>short_desc</structfield></entry>
6675 <entry><type>text</type></entry>
6676 <entry>A brief description of the parameter</entry>
6677 </row>
6678 <row>
6679 <entry><structfield>extra_desc</structfield></entry>
6680 <entry><type>text</type></entry>
6681 <entry>Additional, more detailed, description of the parameter</entry>
6682 </row>
6683 <row>
6684 <entry><structfield>context</structfield></entry>
6685 <entry><type>text</type></entry>
6686 <entry>Context required to set the parameter's value</entry>
6687 </row>
6688 <row>
6689 <entry><structfield>vartype</structfield></entry>
6690 <entry><type>text</type></entry>
6691 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6692 <literal>integer</>, <literal>real</>, or <literal>string</>)
6693 </entry>
6694 </row>
6695 <row>
6696 <entry><structfield>source</structfield></entry>
6697 <entry><type>text</type></entry>
6698 <entry>Source of the current parameter value</entry>
6699 </row>
6700 <row>
6701 <entry><structfield>min_val</structfield></entry>
6702 <entry><type>text</type></entry>
6703 <entry>Minimum allowed value of the parameter (NULL for non-numeric
6704 values)</entry>
6705 </row>
6706 <row>
6707 <entry><structfield>max_val</structfield></entry>
6708 <entry><type>text</type></entry>
6709 <entry>Maximum allowed value of the parameter (NULL for non-numeric
6710 values)</entry>
6711 </row>
6712 <row>
6713 <entry><structfield>enumvals</structfield></entry>
6714 <entry><type>text[]</type></entry>
6715 <entry>Allowed values of an enum parameter (NULL for non-enum
6716 values)</entry>
6717 </row>
6718 <row>
6719 <entry><structfield>boot_val</structfield></entry>
6720 <entry><type>text</type></entry>
6721 <entry>Parameter value assumed at server startup if the parameter is
6722 not otherwise set</entry>
6723 </row>
6724 <row>
6725 <entry><structfield>reset_val</structfield></entry>
6726 <entry><type>text</type></entry>
6727 <entry>Value that <command>RESET</command> would reset the parameter to
6728 in the current session</entry>
6729 </row>
6730 <row>
6731 <entry><structfield>sourcefile</structfield></entry>
6732 <entry><type>text</type></entry>
6733 <entry>Configuration file the current value was set in (NULL for
6734 values set from sources other than configuration files, or when
6735 examined by a non-superuser).
6736 Helpful when using configuration include directives</entry>
6737 </row>
6738 <row>
6739 <entry><structfield>sourceline</structfield></entry>
6740 <entry><type>integer</type></entry>
6741 <entry>Line number within the configuration file the current value was
6742 set at (NULL for values set from sources other than configuration files,
6743 or when examined by a non-superuser)
6744 </entry>
6745 </row>
6746 </tbody>
6747 </tgroup>
6748 </table>
6750 <para>
6751 The <structname>pg_settings</structname> view cannot be inserted into or
6752 deleted from, but it can be updated. An <command>UPDATE</command> applied
6753 to a row of <structname>pg_settings</structname> is equivalent to executing
6754 the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6755 parameter. The change only affects the value used by the current
6756 session. If an <command>UPDATE</command> is issued within a transaction
6757 that is later aborted, the effects of the <command>UPDATE</command> command
6758 disappear when the transaction is rolled back. Once the surrounding
6759 transaction is committed, the effects will persist until the end of the
6760 session, unless overridden by another <command>UPDATE</command> or
6761 <command>SET</command>.
6762 </para>
6764 </sect1>
6766 <sect1 id="view-pg-shadow">
6767 <title><structname>pg_shadow</structname></title>
6769 <indexterm zone="view-pg-shadow">
6770 <primary>pg_shadow</primary>
6771 </indexterm>
6773 <para>
6774 The view <structname>pg_shadow</structname> exists for backwards
6775 compatibility: it emulates a catalog that existed in
6776 <productname>PostgreSQL</productname> before version 8.1.
6777 It shows properties of all roles that are marked as
6778 <structfield>rolcanlogin</>.
6779 </para>
6781 <para>
6782 The name stems from the fact that this table
6783 should not be readable by the public since it contains passwords.
6784 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6785 is a publicly readable view on
6786 <structname>pg_shadow</structname> that blanks out the password field.
6787 </para>
6789 <table>
6790 <title><structname>pg_shadow</> Columns</title>
6792 <tgroup cols=4>
6793 <thead>
6794 <row>
6795 <entry>Name</entry>
6796 <entry>Type</entry>
6797 <entry>References</entry>
6798 <entry>Description</entry>
6799 </row>
6800 </thead>
6802 <tbody>
6803 <row>
6804 <entry><structfield>usename</structfield></entry>
6805 <entry><type>name</type></entry>
6806 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6807 <entry>User name</entry>
6808 </row>
6810 <row>
6811 <entry><structfield>usesysid</structfield></entry>
6812 <entry><type>oid</type></entry>
6813 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6814 <entry>ID of this user</entry>
6815 </row>
6817 <row>
6818 <entry><structfield>usecreatedb</structfield></entry>
6819 <entry><type>bool</type></entry>
6820 <entry></entry>
6821 <entry>User can create databases</entry>
6822 </row>
6824 <row>
6825 <entry><structfield>usesuper</structfield></entry>
6826 <entry><type>bool</type></entry>
6827 <entry></entry>
6828 <entry>User is a superuser</entry>
6829 </row>
6831 <row>
6832 <entry><structfield>usecatupd</structfield></entry>
6833 <entry><type>bool</type></entry>
6834 <entry></entry>
6835 <entry>
6836 User can update system catalogs. (Even a superuser cannot do
6837 this unless this column is true.)
6838 </entry>
6839 </row>
6841 <row>
6842 <entry><structfield>passwd</structfield></entry>
6843 <entry><type>text</type></entry>
6844 <entry></entry>
6845 <entry>Password (possibly encrypted)</entry>
6846 </row>
6848 <row>
6849 <entry><structfield>valuntil</structfield></entry>
6850 <entry><type>abstime</type></entry>
6851 <entry></entry>
6852 <entry>Password expiry time (only used for password authentication)</entry>
6853 </row>
6855 <row>
6856 <entry><structfield>useconfig</structfield></entry>
6857 <entry><type>text[]</type></entry>
6858 <entry></entry>
6859 <entry>Session defaults for run-time configuration variables</entry>
6860 </row>
6861 </tbody>
6862 </tgroup>
6863 </table>
6865 </sect1>
6867 <sect1 id="view-pg-stats">
6868 <title><structname>pg_stats</structname></title>
6870 <indexterm zone="view-pg-stats">
6871 <primary>pg_stats</primary>
6872 </indexterm>
6874 <para>
6875 The view <structname>pg_stats</structname> provides access to
6876 the information stored in the <link
6877 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6878 catalog. This view allows access only to rows of
6879 <structname>pg_statistic</structname> that correspond to tables the
6880 user has permission to read, and therefore it is safe to allow public
6881 read access to this view.
6882 </para>
6884 <para>
6885 <structname>pg_stats</structname> is also designed to present the
6886 information in a more readable format than the underlying catalog
6887 &mdash; at the cost that its schema must be extended whenever new slot types
6888 are defined for <structname>pg_statistic</structname>.
6889 </para>
6891 <table>
6892 <title><structname>pg_stats</> Columns</title>
6894 <tgroup cols=4>
6895 <thead>
6896 <row>
6897 <entry>Name</entry>
6898 <entry>Type</entry>
6899 <entry>References</entry>
6900 <entry>Description</entry>
6901 </row>
6902 </thead>
6903 <tbody>
6904 <row>
6905 <entry><structfield>schemaname</structfield></entry>
6906 <entry><type>name</type></entry>
6907 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6908 <entry>Name of schema containing table</entry>
6909 </row>
6911 <row>
6912 <entry><structfield>tablename</structfield></entry>
6913 <entry><type>name</type></entry>
6914 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6915 <entry>Name of table</entry>
6916 </row>
6918 <row>
6919 <entry><structfield>attname</structfield></entry>
6920 <entry><type>name</type></entry>
6921 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6922 <entry>Name of the column described by this row</entry>
6923 </row>
6925 <row>
6926 <entry><structfield>null_frac</structfield></entry>
6927 <entry><type>real</type></entry>
6928 <entry></entry>
6929 <entry>Fraction of column entries that are null</entry>
6930 </row>
6932 <row>
6933 <entry><structfield>avg_width</structfield></entry>
6934 <entry><type>integer</type></entry>
6935 <entry></entry>
6936 <entry>Average width in bytes of column's entries</entry>
6937 </row>
6939 <row>
6940 <entry><structfield>n_distinct</structfield></entry>
6941 <entry><type>real</type></entry>
6942 <entry></entry>
6943 <entry>
6944 If greater than zero, the estimated number of distinct values in the
6945 column. If less than zero, the negative of the number of distinct
6946 values divided by the number of rows. (The negated form is used when
6947 <command>ANALYZE</> believes that the number of distinct values is
6948 likely to increase as the table grows; the positive form is used when
6949 the column seems to have a fixed number of possible values.) For
6950 example, -1 indicates a unique column in which the number of distinct
6951 values is the same as the number of rows
6952 </entry>
6953 </row>
6955 <row>
6956 <entry><structfield>most_common_vals</structfield></entry>
6957 <entry><type>anyarray</type></entry>
6958 <entry></entry>
6959 <entry>
6960 A list of the most common values in the column. (NULL if
6961 no values seem to be more common than any others.)
6962 For some datatypes such as <type>tsvector</>, this is a list of
6963 the most common element values rather than values of the type itself.
6964 </entry>
6965 </row>
6967 <row>
6968 <entry><structfield>most_common_freqs</structfield></entry>
6969 <entry><type>real[]</type></entry>
6970 <entry></entry>
6971 <entry>
6972 A list of the frequencies of the most common values or elements,
6973 i.e., number of occurrences of each divided by total number of rows.
6974 (NULL when <structfield>most_common_vals</structfield> is.)
6975 For some datatypes such as <type>tsvector</>, it can also store some
6976 additional information, making it longer than the
6977 <structfield>most_common_vals</> array.
6978 </entry>
6979 </row>
6981 <row>
6982 <entry><structfield>histogram_bounds</structfield></entry>
6983 <entry><type>anyarray</type></entry>
6984 <entry></entry>
6985 <entry>
6986 A list of values that divide the column's values into groups of
6987 approximately equal population. The values in
6988 <structfield>most_common_vals</>, if present, are omitted from this
6989 histogram calculation. (This column is NULL if the column data type
6990 does not have a <literal>&lt;</> operator or if the
6991 <structfield>most_common_vals</> list accounts for the entire
6992 population.)
6993 </entry>
6994 </row>
6996 <row>
6997 <entry><structfield>correlation</structfield></entry>
6998 <entry><type>real</type></entry>
6999 <entry></entry>
7000 <entry>
7001 Statistical correlation between physical row ordering and
7002 logical ordering of the column values. This ranges from -1 to +1.
7003 When the value is near -1 or +1, an index scan on the column will
7004 be estimated to be cheaper than when it is near zero, due to reduction
7005 of random access to the disk. (This column is NULL if the column data
7006 type does not have a <literal>&lt;</> operator.)
7007 </entry>
7008 </row>
7009 </tbody>
7010 </tgroup>
7011 </table>
7013 <para>
7014 The maximum number of entries in the <structfield>most_common_vals</>
7015 and <structfield>histogram_bounds</> arrays can be set on a
7016 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
7017 command, or globally by setting the
7018 <xref linkend="guc-default-statistics-target"> run-time parameter.
7019 </para>
7021 </sect1>
7023 <sect1 id="view-pg-tables">
7024 <title><structname>pg_tables</structname></title>
7026 <indexterm zone="view-pg-tables">
7027 <primary>pg_tables</primary>
7028 </indexterm>
7030 <para>
7031 The view <structname>pg_tables</structname> provides access to
7032 useful information about each table in the database.
7033 </para>
7035 <table>
7036 <title><structname>pg_tables</> Columns</title>
7038 <tgroup cols=4>
7039 <thead>
7040 <row>
7041 <entry>Name</entry>
7042 <entry>Type</entry>
7043 <entry>References</entry>
7044 <entry>Description</entry>
7045 </row>
7046 </thead>
7047 <tbody>
7048 <row>
7049 <entry><structfield>schemaname</structfield></entry>
7050 <entry><type>name</type></entry>
7051 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7052 <entry>Name of schema containing table</entry>
7053 </row>
7054 <row>
7055 <entry><structfield>tablename</structfield></entry>
7056 <entry><type>name</type></entry>
7057 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7058 <entry>Name of table</entry>
7059 </row>
7060 <row>
7061 <entry><structfield>tableowner</structfield></entry>
7062 <entry><type>name</type></entry>
7063 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7064 <entry>Name of table's owner</entry>
7065 </row>
7066 <row>
7067 <entry><structfield>tablespace</structfield></entry>
7068 <entry><type>name</type></entry>
7069 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7070 <entry>Name of tablespace containing table (NULL if default for database)</entry>
7071 </row>
7072 <row>
7073 <entry><structfield>hasindexes</structfield></entry>
7074 <entry><type>boolean</type></entry>
7075 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
7076 <entry>true if table has (or recently had) any indexes</entry>
7077 </row>
7078 <row>
7079 <entry><structfield>hasrules</structfield></entry>
7080 <entry><type>boolean</type></entry>
7081 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
7082 <entry>true if table has (or once had) rules</entry>
7083 </row>
7084 <row>
7085 <entry><structfield>hastriggers</structfield></entry>
7086 <entry><type>boolean</type></entry>
7087 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
7088 <entry>true if table has (or once had) triggers</entry>
7089 </row>
7090 </tbody>
7091 </tgroup>
7092 </table>
7094 </sect1>
7096 <sect1 id="view-pg-timezone-abbrevs">
7097 <title><structname>pg_timezone_abbrevs</structname></title>
7099 <indexterm zone="view-pg-timezone-abbrevs">
7100 <primary>pg_timezone_abbrevs</primary>
7101 </indexterm>
7103 <para>
7104 The view <structname>pg_timezone_abbrevs</structname> provides a list
7105 of time zone abbreviations that are currently recognized by the datetime
7106 input routines. The contents of this view change when the
7107 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
7108 </para>
7110 <table>
7111 <title><structname>pg_timezone_abbrevs</> Columns</title>
7113 <tgroup cols=3>
7114 <thead>
7115 <row>
7116 <entry>Name</entry>
7117 <entry>Type</entry>
7118 <entry>Description</entry>
7119 </row>
7120 </thead>
7121 <tbody>
7122 <row>
7123 <entry><structfield>abbrev</structfield></entry>
7124 <entry><type>text</type></entry>
7125 <entry>Time zone abbreviation</entry>
7126 </row>
7127 <row>
7128 <entry><structfield>utc_offset</structfield></entry>
7129 <entry><type>interval</type></entry>
7130 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7131 </row>
7132 <row>
7133 <entry><structfield>is_dst</structfield></entry>
7134 <entry><type>boolean</type></entry>
7135 <entry>True if this is a daylight-savings abbreviation</entry>
7136 </row>
7137 </tbody>
7138 </tgroup>
7139 </table>
7141 </sect1>
7143 <sect1 id="view-pg-timezone-names">
7144 <title><structname>pg_timezone_names</structname></title>
7146 <indexterm zone="view-pg-timezone-names">
7147 <primary>pg_timezone_names</primary>
7148 </indexterm>
7150 <para>
7151 The view <structname>pg_timezone_names</structname> provides a list
7152 of time zone names that are recognized by <command>SET TIMEZONE</>,
7153 along with their associated abbreviations, UTC offsets,
7154 and daylight-savings status.
7155 Unlike the abbreviations shown in <link
7156 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
7157 date rules. Therefore, the associated information changes across local DST
7158 boundaries. The displayed information is computed based on the current
7159 value of <function>CURRENT_TIMESTAMP</>.
7160 </para>
7162 <table>
7163 <title><structname>pg_timezone_names</> Columns</title>
7165 <tgroup cols=3>
7166 <thead>
7167 <row>
7168 <entry>Name</entry>
7169 <entry>Type</entry>
7170 <entry>Description</entry>
7171 </row>
7172 </thead>
7173 <tbody>
7174 <row>
7175 <entry><structfield>name</structfield></entry>
7176 <entry><type>text</type></entry>
7177 <entry>Time zone name</entry>
7178 </row>
7179 <row>
7180 <entry><structfield>abbrev</structfield></entry>
7181 <entry><type>text</type></entry>
7182 <entry>Time zone abbreviation</entry>
7183 </row>
7184 <row>
7185 <entry><structfield>utc_offset</structfield></entry>
7186 <entry><type>interval</type></entry>
7187 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7188 </row>
7189 <row>
7190 <entry><structfield>is_dst</structfield></entry>
7191 <entry><type>boolean</type></entry>
7192 <entry>True if currently observing daylight savings</entry>
7193 </row>
7194 </tbody>
7195 </tgroup>
7196 </table>
7198 </sect1>
7200 <sect1 id="view-pg-user">
7201 <title><structname>pg_user</structname></title>
7203 <indexterm zone="view-pg-user">
7204 <primary>pg_user</primary>
7205 </indexterm>
7207 <para>
7208 The view <structname>pg_user</structname> provides access to
7209 information about database users. This is simply a publicly
7210 readable view of
7211 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
7212 that blanks out the password field.
7213 </para>
7215 <table>
7216 <title><structname>pg_user</> Columns</title>
7218 <tgroup cols=3>
7219 <thead>
7220 <row>
7221 <entry>Name</entry>
7222 <entry>Type</entry>
7223 <entry>Description</entry>
7224 </row>
7225 </thead>
7226 <tbody>
7227 <row>
7228 <entry><structfield>usename</structfield></entry>
7229 <entry><type>name</type></entry>
7230 <entry>User name</entry>
7231 </row>
7233 <row>
7234 <entry><structfield>usesysid</structfield></entry>
7235 <entry><type>int4</type></entry>
7236 <entry>User ID (arbitrary number used to reference this user)</entry>
7237 </row>
7239 <row>
7240 <entry><structfield>usecreatedb</structfield></entry>
7241 <entry><type>bool</type></entry>
7242 <entry>User can create databases</entry>
7243 </row>
7245 <row>
7246 <entry><structfield>usesuper</structfield></entry>
7247 <entry><type>bool</type></entry>
7248 <entry>User is a superuser</entry>
7249 </row>
7251 <row>
7252 <entry><structfield>usecatupd</structfield></entry>
7253 <entry><type>bool</type></entry>
7254 <entry>
7255 User can update system catalogs. (Even a superuser cannot do
7256 this unless this column is true.)
7257 </entry>
7258 </row>
7260 <row>
7261 <entry><structfield>passwd</structfield></entry>
7262 <entry><type>text</type></entry>
7263 <entry>Not the password (always reads as <literal>********</>)</entry>
7264 </row>
7266 <row>
7267 <entry><structfield>valuntil</structfield></entry>
7268 <entry><type>abstime</type></entry>
7269 <entry>Password expiry time (only used for password authentication)</entry>
7270 </row>
7272 <row>
7273 <entry><structfield>useconfig</structfield></entry>
7274 <entry><type>text[]</type></entry>
7275 <entry>Session defaults for run-time configuration variables</entry>
7276 </row>
7277 </tbody>
7278 </tgroup>
7279 </table>
7281 </sect1>
7283 <sect1 id="view-pg-user-mappings">
7284 <title><structname>pg_user_mappings</structname></title>
7286 <indexterm zone="view-pg-user-mappings">
7287 <primary>pg_user_mappings</primary>
7288 </indexterm>
7290 <para>
7291 The view <structname>pg_user_mappings</structname> provides access
7292 to information about user mappings. This is essentially a publicly
7293 readable view of
7294 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
7295 that leaves out the options field if the user has no rights to use
7297 </para>
7299 <table>
7300 <title><structname>pg_user_mappings</> Columns</title>
7302 <tgroup cols=3>
7303 <thead>
7304 <row>
7305 <entry>Name</entry>
7306 <entry>Type</entry>
7307 <entry>References</entry>
7308 <entry>Description</entry>
7309 </row>
7310 </thead>
7312 <tbody>
7313 <row>
7314 <entry><structfield>umid</structfield></entry>
7315 <entry><type>oid</type></entry>
7316 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
7317 <entry>OID of the user mapping</entry>
7318 </row>
7320 <row>
7321 <entry><structfield>srvid</structfield></entry>
7322 <entry><type>oid</type></entry>
7323 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7324 <entry>
7325 The OID of the foreign server that contains this mapping
7326 </entry>
7327 </row>
7329 <row>
7330 <entry><structfield>srvname</structfield></entry>
7331 <entry><type>text</type></entry>
7332 <entry></entry>
7333 <entry>
7334 Name of the foreign server
7335 </entry>
7336 </row>
7338 <row>
7339 <entry><structfield>umuser</structfield></entry>
7340 <entry><type>oid</type></entry>
7341 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7342 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7343 </row>
7345 <row>
7346 <entry><structfield>usename</structfield></entry>
7347 <entry><type>name</type></entry>
7348 <entry></entry>
7349 <entry>Name of the local user to be mapped</entry>
7350 </row>
7352 <row>
7353 <entry><structfield>umoptions</structfield></entry>
7354 <entry><type>text[]</type></entry>
7355 <entry></entry>
7356 <entry>
7357 User mapping specific options, as <quote>keyword=value</>
7358 strings, if the current user is the owner of the foreign
7359 server, else null.
7360 </entry>
7361 </row>
7362 </tbody>
7363 </tgroup>
7364 </table>
7365 </sect1>
7368 <sect1 id="view-pg-views">
7369 <title><structname>pg_views</structname></title>
7371 <indexterm zone="view-pg-views">
7372 <primary>pg_views</primary>
7373 </indexterm>
7375 <para>
7376 The view <structname>pg_views</structname> provides access to
7377 useful information about each view in the database.
7378 </para>
7380 <table>
7381 <title><structname>pg_views</> Columns</title>
7383 <tgroup cols=4>
7384 <thead>
7385 <row>
7386 <entry>Name</entry>
7387 <entry>Type</entry>
7388 <entry>References</entry>
7389 <entry>Description</entry>
7390 </row>
7391 </thead>
7392 <tbody>
7393 <row>
7394 <entry><structfield>schemaname</structfield></entry>
7395 <entry><type>name</type></entry>
7396 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7397 <entry>Name of schema containing view</entry>
7398 </row>
7399 <row>
7400 <entry><structfield>viewname</structfield></entry>
7401 <entry><type>name</type></entry>
7402 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7403 <entry>Name of view</entry>
7404 </row>
7405 <row>
7406 <entry><structfield>viewowner</structfield></entry>
7407 <entry><type>name</type></entry>
7408 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7409 <entry>Name of view's owner</entry>
7410 </row>
7411 <row>
7412 <entry><structfield>definition</structfield></entry>
7413 <entry><type>text</type></entry>
7414 <entry></entry>
7415 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
7416 </row>
7417 </tbody>
7418 </tgroup>
7419 </table>
7421 </sect1>
7423 </chapter>