doc: Document pg_encoding_to_char() and pg_char_to_encoding().
[pgsql.git] / doc / src / sgml / catalogs.sgml
blobfd6910ddbea1e94ab8e42d95580be2524b33f896
1 <!-- doc/src/sgml/catalogs.sgml -->
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 normally 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, but many of those have been made
22 available as SQL commands over time, and so the need for direct manipulation
23 of the system catalogs is ever decreasing.
24 </para>
26 <sect1 id="catalogs-overview">
27 <title>Overview</title>
29 <para>
30 <xref linkend="catalog-table"/> lists the system catalogs.
31 More detailed documentation of each catalog follows below.
32 </para>
34 <para>
35 Most system catalogs are copied from the template database during
36 database creation and are thereafter database-specific. A few
37 catalogs are physically shared across all databases in a cluster;
38 these are noted in the descriptions of the individual catalogs.
39 </para>
41 <table id="catalog-table">
42 <title>System Catalogs</title>
44 <tgroup cols="2">
45 <thead>
46 <row>
47 <entry>Catalog Name</entry>
48 <entry>Purpose</entry>
49 </row>
50 </thead>
52 <tbody>
53 <row>
54 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
55 <entry>aggregate functions</entry>
56 </row>
58 <row>
59 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
60 <entry>relation access methods</entry>
61 </row>
63 <row>
64 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
65 <entry>access method operators</entry>
66 </row>
68 <row>
69 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
70 <entry>access method support functions</entry>
71 </row>
73 <row>
74 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75 <entry>column default values</entry>
76 </row>
78 <row>
79 <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
80 <entry>table columns (<quote>attributes</quote>)</entry>
81 </row>
83 <row>
84 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85 <entry>authorization identifiers (roles)</entry>
86 </row>
88 <row>
89 <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
90 <entry>authorization identifier membership relationships</entry>
91 </row>
93 <row>
94 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95 <entry>casts (data type conversions)</entry>
96 </row>
98 <row>
99 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
100 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
101 </row>
103 <row>
104 <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105 <entry>collations (locale information)</entry>
106 </row>
108 <row>
109 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
110 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
111 </row>
113 <row>
114 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115 <entry>encoding conversion information</entry>
116 </row>
118 <row>
119 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
120 <entry>databases within this database cluster</entry>
121 </row>
123 <row>
124 <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
125 <entry>per-role and per-database settings</entry>
126 </row>
128 <row>
129 <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
130 <entry>default privileges for object types</entry>
131 </row>
133 <row>
134 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135 <entry>dependencies between database objects</entry>
136 </row>
138 <row>
139 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
140 <entry>descriptions or comments on database objects</entry>
141 </row>
143 <row>
144 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
145 <entry>enum label and value definitions</entry>
146 </row>
148 <row>
149 <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150 <entry>event triggers</entry>
151 </row>
153 <row>
154 <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155 <entry>installed extensions</entry>
156 </row>
158 <row>
159 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
160 <entry>foreign-data wrapper definitions</entry>
161 </row>
163 <row>
164 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
165 <entry>foreign server definitions</entry>
166 </row>
168 <row>
169 <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
170 <entry>additional foreign table information</entry>
171 </row>
173 <row>
174 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175 <entry>additional index information</entry>
176 </row>
178 <row>
179 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180 <entry>table inheritance hierarchy</entry>
181 </row>
183 <row>
184 <entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
185 <entry>object initial privileges</entry>
186 </row>
188 <row>
189 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190 <entry>languages for writing functions</entry>
191 </row>
193 <row>
194 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
195 <entry>data pages for large objects</entry>
196 </row>
198 <row>
199 <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
200 <entry>metadata for large objects</entry>
201 </row>
203 <row>
204 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205 <entry>schemas</entry>
206 </row>
208 <row>
209 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210 <entry>access method operator classes</entry>
211 </row>
213 <row>
214 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215 <entry>operators</entry>
216 </row>
218 <row>
219 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220 <entry>access method operator families</entry>
221 </row>
223 <row>
224 <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
225 <entry>information about partition key of tables</entry>
226 </row>
228 <row>
229 <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
230 <entry>row-security policies</entry>
231 </row>
233 <row>
234 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
235 <entry>functions and procedures</entry>
236 </row>
238 <row>
239 <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
240 <entry>publications for logical replication</entry>
241 </row>
243 <row>
244 <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
245 <entry>relation to publication mapping</entry>
246 </row>
248 <row>
249 <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
250 <entry>information about range types</entry>
251 </row>
253 <row>
254 <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
255 <entry>registered replication origins</entry>
256 </row>
258 <row>
259 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
260 <entry>query rewrite rules</entry>
261 </row>
263 <row>
264 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
265 <entry>security labels on database objects</entry>
266 </row>
268 <row>
269 <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
270 <entry>information about sequences</entry>
271 </row>
273 <row>
274 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
275 <entry>dependencies on shared objects</entry>
276 </row>
278 <row>
279 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
280 <entry>comments on shared objects</entry>
281 </row>
283 <row>
284 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
285 <entry>security labels on shared database objects</entry>
286 </row>
288 <row>
289 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
290 <entry>planner statistics</entry>
291 </row>
293 <row>
294 <entry><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link></entry>
295 <entry>extended planner statistics (definition)</entry>
296 </row>
298 <row>
299 <entry><link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link></entry>
300 <entry>extended planner statistics (built statistics)</entry>
301 </row>
303 <row>
304 <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
305 <entry>logical replication subscriptions</entry>
306 </row>
308 <row>
309 <entry><link linkend="catalog-pg-subscription-rel"><structname>pg_subscription_rel</structname></link></entry>
310 <entry>relation state for subscriptions</entry>
311 </row>
313 <row>
314 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
315 <entry>tablespaces within this database cluster</entry>
316 </row>
318 <row>
319 <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
320 <entry>transforms (data type to procedural language conversions)</entry>
321 </row>
323 <row>
324 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
325 <entry>triggers</entry>
326 </row>
328 <row>
329 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
330 <entry>text search configurations</entry>
331 </row>
333 <row>
334 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
335 <entry>text search configurations' token mappings</entry>
336 </row>
338 <row>
339 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
340 <entry>text search dictionaries</entry>
341 </row>
343 <row>
344 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
345 <entry>text search parsers</entry>
346 </row>
348 <row>
349 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
350 <entry>text search templates</entry>
351 </row>
353 <row>
354 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
355 <entry>data types</entry>
356 </row>
358 <row>
359 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
360 <entry>mappings of users to foreign servers</entry>
361 </row>
362 </tbody>
363 </tgroup>
364 </table>
365 </sect1>
368 <sect1 id="catalog-pg-aggregate">
369 <title><structname>pg_aggregate</structname></title>
371 <indexterm zone="catalog-pg-aggregate">
372 <primary>pg_aggregate</primary>
373 </indexterm>
375 <para>
376 The catalog <structname>pg_aggregate</structname> stores information about
377 aggregate functions. An aggregate function is a function that
378 operates on a set of values (typically one column from each row
379 that matches a query condition) and returns a single value computed
380 from all these values. Typical aggregate functions are
381 <function>sum</function>, <function>count</function>, and
382 <function>max</function>. Each entry in
383 <structname>pg_aggregate</structname> is an extension of an entry
384 in <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.
385 The <structname>pg_proc</structname> entry carries the aggregate's name,
386 input and output data types, and other information that is similar to
387 ordinary functions.
388 </para>
390 <table>
391 <title><structname>pg_aggregate</structname> Columns</title>
392 <tgroup cols="1">
393 <thead>
394 <row>
395 <entry role="catalog_table_entry"><para role="column_definition">
396 Column Type
397 </para>
398 <para>
399 Description
400 </para></entry>
401 </row>
402 </thead>
404 <tbody>
405 <row>
406 <entry role="catalog_table_entry"><para role="column_definition">
407 <structfield>aggfnoid</structfield> <type>regproc</type>
408 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
409 </para>
410 <para>
411 <structname>pg_proc</structname> OID of the aggregate function
412 </para></entry>
413 </row>
415 <row>
416 <entry role="catalog_table_entry"><para role="column_definition">
417 <structfield>aggkind</structfield> <type>char</type>
418 </para>
419 <para>
420 Aggregate kind:
421 <literal>n</literal> for <quote>normal</quote> aggregates,
422 <literal>o</literal> for <quote>ordered-set</quote> aggregates, or
423 <literal>h</literal> for <quote>hypothetical-set</quote> aggregates
424 </para></entry>
425 </row>
427 <row>
428 <entry role="catalog_table_entry"><para role="column_definition">
429 <structfield>aggnumdirectargs</structfield> <type>int2</type>
430 </para>
431 <para>
432 Number of direct (non-aggregated) arguments of an ordered-set or
433 hypothetical-set aggregate, counting a variadic array as one argument.
434 If equal to <structfield>pronargs</structfield>, the aggregate must be variadic
435 and the variadic array describes the aggregated arguments as well as
436 the final direct arguments.
437 Always zero for normal aggregates.
438 </para></entry>
439 </row>
441 <row>
442 <entry role="catalog_table_entry"><para role="column_definition">
443 <structfield>aggtransfn</structfield> <type>regproc</type>
444 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
445 </para>
446 <para>
447 Transition function
448 </para></entry>
449 </row>
451 <row>
452 <entry role="catalog_table_entry"><para role="column_definition">
453 <structfield>aggfinalfn</structfield> <type>regproc</type>
454 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
455 </para>
456 <para>
457 Final function (zero if none)
458 </para></entry>
459 </row>
461 <row>
462 <entry role="catalog_table_entry"><para role="column_definition">
463 <structfield>aggcombinefn</structfield> <type>regproc</type>
464 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
465 </para>
466 <para>
467 Combine function (zero if none)
468 </para></entry>
469 </row>
471 <row>
472 <entry role="catalog_table_entry"><para role="column_definition">
473 <structfield>aggserialfn</structfield> <type>regproc</type>
474 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
475 </para>
476 <para>
477 Serialization function (zero if none)
478 </para></entry>
479 </row>
481 <row>
482 <entry role="catalog_table_entry"><para role="column_definition">
483 <structfield>aggdeserialfn</structfield> <type>regproc</type>
484 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
485 </para>
486 <para>
487 Deserialization function (zero if none)
488 </para></entry>
489 </row>
491 <row>
492 <entry role="catalog_table_entry"><para role="column_definition">
493 <structfield>aggmtransfn</structfield> <type>regproc</type>
494 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
495 </para>
496 <para>
497 Forward transition function for moving-aggregate mode (zero if none)
498 </para></entry>
499 </row>
501 <row>
502 <entry role="catalog_table_entry"><para role="column_definition">
503 <structfield>aggminvtransfn</structfield> <type>regproc</type>
504 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
505 </para>
506 <para>
507 Inverse transition function for moving-aggregate mode (zero if none)
508 </para></entry>
509 </row>
511 <row>
512 <entry role="catalog_table_entry"><para role="column_definition">
513 <structfield>aggmfinalfn</structfield> <type>regproc</type>
514 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
515 </para>
516 <para>
517 Final function for moving-aggregate mode (zero if none)
518 </para></entry>
519 </row>
521 <row>
522 <entry role="catalog_table_entry"><para role="column_definition">
523 <structfield>aggfinalextra</structfield> <type>bool</type>
524 </para>
525 <para>
526 True to pass extra dummy arguments to <structfield>aggfinalfn</structfield>
527 </para></entry>
528 </row>
530 <row>
531 <entry role="catalog_table_entry"><para role="column_definition">
532 <structfield>aggmfinalextra</structfield> <type>bool</type>
533 </para>
534 <para>
535 True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield>
536 </para></entry>
537 </row>
539 <row>
540 <entry role="catalog_table_entry"><para role="column_definition">
541 <structfield>aggfinalmodify</structfield> <type>char</type>
542 </para>
543 <para>
544 Whether <structfield>aggfinalfn</structfield> modifies the
545 transition state value:
546 <literal>r</literal> if it is read-only,
547 <literal>s</literal> if the <structfield>aggtransfn</structfield>
548 cannot be applied after the <structfield>aggfinalfn</structfield>, or
549 <literal>w</literal> if it writes on the value
550 </para></entry>
551 </row>
553 <row>
554 <entry role="catalog_table_entry"><para role="column_definition">
555 <structfield>aggmfinalmodify</structfield> <type>char</type>
556 </para>
557 <para>
558 Like <structfield>aggfinalmodify</structfield>, but for
559 the <structfield>aggmfinalfn</structfield>
560 </para></entry>
561 </row>
563 <row>
564 <entry role="catalog_table_entry"><para role="column_definition">
565 <structfield>aggsortop</structfield> <type>oid</type>
566 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
567 </para>
568 <para>
569 Associated sort operator (zero if none)
570 </para></entry>
571 </row>
573 <row>
574 <entry role="catalog_table_entry"><para role="column_definition">
575 <structfield>aggtranstype</structfield> <type>oid</type>
576 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
577 </para>
578 <para>
579 Data type of the aggregate function's internal transition (state) data
580 </para></entry>
581 </row>
583 <row>
584 <entry role="catalog_table_entry"><para role="column_definition">
585 <structfield>aggtransspace</structfield> <type>int4</type>
586 </para>
587 <para>
588 Approximate average size (in bytes) of the transition state
589 data, or zero to use a default estimate
590 </para></entry>
591 </row>
593 <row>
594 <entry role="catalog_table_entry"><para role="column_definition">
595 <structfield>aggmtranstype</structfield> <type>oid</type>
596 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
597 </para>
598 <para>
599 Data type of the aggregate function's internal transition (state)
600 data for moving-aggregate mode (zero if none)
601 </para></entry>
602 </row>
604 <row>
605 <entry role="catalog_table_entry"><para role="column_definition">
606 <structfield>aggmtransspace</structfield> <type>int4</type>
607 </para>
608 <para>
609 Approximate average size (in bytes) of the transition state data
610 for moving-aggregate mode, or zero to use a default estimate
611 </para></entry>
612 </row>
614 <row>
615 <entry role="catalog_table_entry"><para role="column_definition">
616 <structfield>agginitval</structfield> <type>text</type>
617 </para>
618 <para>
619 The initial value of the transition state. This is a text
620 field containing the initial value in its external string
621 representation. If this field is null, the transition state
622 value starts out null.
623 </para></entry>
624 </row>
626 <row>
627 <entry role="catalog_table_entry"><para role="column_definition">
628 <structfield>aggminitval</structfield> <type>text</type>
629 </para>
630 <para>
631 The initial value of the transition state for moving-aggregate mode.
632 This is a text field containing the initial value in its external
633 string representation. If this field is null, the transition state
634 value starts out null.
635 </para></entry>
636 </row>
637 </tbody>
638 </tgroup>
639 </table>
641 <para>
642 New aggregate functions are registered with the <link
643 linkend="sql-createaggregate"><command>CREATE AGGREGATE</command></link>
644 command. See <xref linkend="xaggr"/> for more information about
645 writing aggregate functions and the meaning of the transition
646 functions, etc.
647 </para>
649 </sect1>
652 <sect1 id="catalog-pg-am">
653 <title><structname>pg_am</structname></title>
655 <indexterm zone="catalog-pg-am">
656 <primary>pg_am</primary>
657 </indexterm>
659 <para>
660 The catalog <structname>pg_am</structname> stores information about
661 relation access methods. There is one row for each access method supported
662 by the system.
663 Currently, only tables and indexes have access methods. The requirements for table
664 and index access methods are discussed in detail in <xref linkend="tableam"/> and
665 <xref linkend="indexam"/> respectively.
666 </para>
668 <table>
669 <title><structname>pg_am</structname> Columns</title>
670 <tgroup cols="1">
671 <thead>
672 <row>
673 <entry role="catalog_table_entry"><para role="column_definition">
674 Column Type
675 </para>
676 <para>
677 Description
678 </para></entry>
679 </row>
680 </thead>
682 <tbody>
683 <row>
684 <entry role="catalog_table_entry"><para role="column_definition">
685 <structfield>oid</structfield> <type>oid</type>
686 </para>
687 <para>
688 Row identifier
689 </para></entry>
690 </row>
692 <row>
693 <entry role="catalog_table_entry"><para role="column_definition">
694 <structfield>amname</structfield> <type>name</type>
695 </para>
696 <para>
697 Name of the access method
698 </para></entry>
699 </row>
701 <row>
702 <entry role="catalog_table_entry"><para role="column_definition">
703 <structfield>amhandler</structfield> <type>regproc</type>
704 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
705 </para>
706 <para>
707 OID of a handler function that is responsible for supplying information
708 about the access method
709 </para></entry>
710 </row>
712 <row>
713 <entry role="catalog_table_entry"><para role="column_definition">
714 <structfield>amtype</structfield> <type>char</type>
715 </para>
716 <para>
717 <literal>t</literal> = table (including materialized views),
718 <literal>i</literal> = index.
719 </para></entry>
720 </row>
721 </tbody>
722 </tgroup>
723 </table>
725 <note>
726 <para>
727 Before <productname>PostgreSQL</productname> 9.6, <structname>pg_am</structname>
728 contained many additional columns representing properties of index access
729 methods. That data is now only directly visible at the C code level.
730 However, <function>pg_index_column_has_property()</function> and related
731 functions have been added to allow SQL queries to inspect index access
732 method properties; see <xref linkend="functions-info-catalog-table"/>.
733 </para>
734 </note>
736 </sect1>
739 <sect1 id="catalog-pg-amop">
740 <title><structname>pg_amop</structname></title>
742 <indexterm zone="catalog-pg-amop">
743 <primary>pg_amop</primary>
744 </indexterm>
746 <para>
747 The catalog <structname>pg_amop</structname> stores information about
748 operators associated with access method operator families. There is one
749 row for each operator that is a member of an operator family. A family
750 member can be either a <firstterm>search</firstterm> operator or an
751 <firstterm>ordering</firstterm> operator. An operator
752 can appear in more than one family, but cannot appear in more than one
753 search position nor more than one ordering position within a family.
754 (It is allowed, though unlikely, for an operator to be used for both
755 search and ordering purposes.)
756 </para>
758 <table>
759 <title><structname>pg_amop</structname> Columns</title>
760 <tgroup cols="1">
761 <thead>
762 <row>
763 <entry role="catalog_table_entry"><para role="column_definition">
764 Column Type
765 </para>
766 <para>
767 Description
768 </para></entry>
769 </row>
770 </thead>
772 <tbody>
773 <row>
774 <entry role="catalog_table_entry"><para role="column_definition">
775 <structfield>oid</structfield> <type>oid</type>
776 </para>
777 <para>
778 Row identifier
779 </para></entry>
780 </row>
782 <row>
783 <entry role="catalog_table_entry"><para role="column_definition">
784 <structfield>amopfamily</structfield> <type>oid</type>
785 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
786 </para>
787 <para>
788 The operator family this entry is for
789 </para></entry>
790 </row>
792 <row>
793 <entry role="catalog_table_entry"><para role="column_definition">
794 <structfield>amoplefttype</structfield> <type>oid</type>
795 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
796 </para>
797 <para>
798 Left-hand input data type of operator
799 </para></entry>
800 </row>
802 <row>
803 <entry role="catalog_table_entry"><para role="column_definition">
804 <structfield>amoprighttype</structfield> <type>oid</type>
805 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
806 </para>
807 <para>
808 Right-hand input data type of operator
809 </para></entry>
810 </row>
812 <row>
813 <entry role="catalog_table_entry"><para role="column_definition">
814 <structfield>amopstrategy</structfield> <type>int2</type>
815 </para>
816 <para>
817 Operator strategy number
818 </para></entry>
819 </row>
821 <row>
822 <entry role="catalog_table_entry"><para role="column_definition">
823 <structfield>amoppurpose</structfield> <type>char</type>
824 </para>
825 <para>
826 Operator purpose, either <literal>s</literal> for search or
827 <literal>o</literal> for ordering
828 </para></entry>
829 </row>
831 <row>
832 <entry role="catalog_table_entry"><para role="column_definition">
833 <structfield>amopopr</structfield> <type>oid</type>
834 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
835 </para>
836 <para>
837 OID of the operator
838 </para></entry>
839 </row>
841 <row>
842 <entry role="catalog_table_entry"><para role="column_definition">
843 <structfield>amopmethod</structfield> <type>oid</type>
844 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
845 </para>
846 <para>
847 Index access method operator family is for
848 </para></entry>
849 </row>
851 <row>
852 <entry role="catalog_table_entry"><para role="column_definition">
853 <structfield>amopsortfamily</structfield> <type>oid</type>
854 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
855 </para>
856 <para>
857 The B-tree operator family this entry sorts according to, if an
858 ordering operator; zero if a search operator
859 </para></entry>
860 </row>
861 </tbody>
862 </tgroup>
863 </table>
865 <para>
866 A <quote>search</quote> operator entry indicates that an index of this operator
867 family can be searched to find all rows satisfying
868 <literal>WHERE</literal>
869 <replaceable>indexed_column</replaceable>
870 <replaceable>operator</replaceable>
871 <replaceable>constant</replaceable>.
872 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
873 type must match the index's column data type.
874 </para>
876 <para>
877 An <quote>ordering</quote> operator entry indicates that an index of this
878 operator family can be scanned to return rows in the order represented by
879 <literal>ORDER BY</literal>
880 <replaceable>indexed_column</replaceable>
881 <replaceable>operator</replaceable>
882 <replaceable>constant</replaceable>.
883 Such an operator could return any sortable data type, though again
884 its left-hand input type must match the index's column data type.
885 The exact semantics of the <literal>ORDER BY</literal> are specified by the
886 <structfield>amopsortfamily</structfield> column, which must reference
887 a B-tree operator family for the operator's result type.
888 </para>
890 <note>
891 <para>
892 At present, it's assumed that the sort order for an ordering operator
893 is the default for the referenced operator family, i.e., <literal>ASC NULLS
894 LAST</literal>. This might someday be relaxed by adding additional columns
895 to specify sort options explicitly.
896 </para>
897 </note>
899 <para>
900 An entry's <structfield>amopmethod</structfield> must match the
901 <structfield>opfmethod</structfield> of its containing operator family (including
902 <structfield>amopmethod</structfield> here is an intentional denormalization of the
903 catalog structure for performance reasons). Also,
904 <structfield>amoplefttype</structfield> and <structfield>amoprighttype</structfield> must match
905 the <structfield>oprleft</structfield> and <structfield>oprright</structfield> fields of the
906 referenced <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link> entry.
907 </para>
909 </sect1>
912 <sect1 id="catalog-pg-amproc">
913 <title><structname>pg_amproc</structname></title>
915 <indexterm zone="catalog-pg-amproc">
916 <primary>pg_amproc</primary>
917 </indexterm>
919 <para>
920 The catalog <structname>pg_amproc</structname> stores information about
921 support functions associated with access method operator families. There
922 is one row for each support function belonging to an operator family.
923 </para>
925 <table>
926 <title><structname>pg_amproc</structname> Columns</title>
927 <tgroup cols="1">
928 <thead>
929 <row>
930 <entry role="catalog_table_entry"><para role="column_definition">
931 Column Type
932 </para>
933 <para>
934 Description
935 </para></entry>
936 </row>
937 </thead>
939 <tbody>
940 <row>
941 <entry role="catalog_table_entry"><para role="column_definition">
942 <structfield>oid</structfield> <type>oid</type>
943 </para>
944 <para>
945 Row identifier
946 </para></entry>
947 </row>
949 <row>
950 <entry role="catalog_table_entry"><para role="column_definition">
951 <structfield>amprocfamily</structfield> <type>oid</type>
952 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
953 </para>
954 <para>
955 The operator family this entry is for
956 </para></entry>
957 </row>
959 <row>
960 <entry role="catalog_table_entry"><para role="column_definition">
961 <structfield>amproclefttype</structfield> <type>oid</type>
962 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
963 </para>
964 <para>
965 Left-hand input data type of associated operator
966 </para></entry>
967 </row>
969 <row>
970 <entry role="catalog_table_entry"><para role="column_definition">
971 <structfield>amprocrighttype</structfield> <type>oid</type>
972 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
973 </para>
974 <para>
975 Right-hand input data type of associated operator
976 </para></entry>
977 </row>
979 <row>
980 <entry role="catalog_table_entry"><para role="column_definition">
981 <structfield>amprocnum</structfield> <type>int2</type>
982 </para>
983 <para>
984 Support function number
985 </para></entry>
986 </row>
988 <row>
989 <entry role="catalog_table_entry"><para role="column_definition">
990 <structfield>amproc</structfield> <type>regproc</type>
991 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
992 </para>
993 <para>
994 OID of the function
995 </para></entry>
996 </row>
997 </tbody>
998 </tgroup>
999 </table>
1001 <para>
1002 The usual interpretation of the
1003 <structfield>amproclefttype</structfield> and <structfield>amprocrighttype</structfield> fields
1004 is that they identify the left and right input types of the operator(s)
1005 that a particular support function supports. For some access methods
1006 these match the input data type(s) of the support function itself, for
1007 others not. There is a notion of <quote>default</quote> support functions for
1008 an index, which are those with <structfield>amproclefttype</structfield> and
1009 <structfield>amprocrighttype</structfield> both equal to the index operator class's
1010 <structfield>opcintype</structfield>.
1011 </para>
1013 </sect1>
1016 <sect1 id="catalog-pg-attrdef">
1017 <title><structname>pg_attrdef</structname></title>
1019 <indexterm zone="catalog-pg-attrdef">
1020 <primary>pg_attrdef</primary>
1021 </indexterm>
1023 <para>
1024 The catalog <structname>pg_attrdef</structname> stores column default
1025 values. The main information about columns is stored in
1026 <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.
1027 Only columns for which a default value has been explicitly set will have
1028 an entry here.
1029 </para>
1031 <table>
1032 <title><structname>pg_attrdef</structname> Columns</title>
1033 <tgroup cols="1">
1034 <thead>
1035 <row>
1036 <entry role="catalog_table_entry"><para role="column_definition">
1037 Column Type
1038 </para>
1039 <para>
1040 Description
1041 </para></entry>
1042 </row>
1043 </thead>
1045 <tbody>
1046 <row>
1047 <entry role="catalog_table_entry"><para role="column_definition">
1048 <structfield>oid</structfield> <type>oid</type>
1049 </para>
1050 <para>
1051 Row identifier
1052 </para></entry>
1053 </row>
1055 <row>
1056 <entry role="catalog_table_entry"><para role="column_definition">
1057 <structfield>adrelid</structfield> <type>oid</type>
1058 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1059 </para>
1060 <para>
1061 The table this column belongs to
1062 </para></entry>
1063 </row>
1065 <row>
1066 <entry role="catalog_table_entry"><para role="column_definition">
1067 <structfield>adnum</structfield> <type>int2</type>
1068 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
1069 </para>
1070 <para>
1071 The number of the column
1072 </para></entry>
1073 </row>
1075 <row>
1076 <entry role="catalog_table_entry"><para role="column_definition">
1077 <structfield>adbin</structfield> <type>pg_node_tree</type>
1078 </para>
1079 <para>
1080 The column default value, in <function>nodeToString()</function>
1081 representation. Use <literal>pg_get_expr(adbin, adrelid)</literal> to
1082 convert it to an SQL expression.
1083 </para></entry>
1084 </row>
1085 </tbody>
1086 </tgroup>
1087 </table>
1088 </sect1>
1091 <sect1 id="catalog-pg-attribute">
1092 <title><structname>pg_attribute</structname></title>
1094 <indexterm zone="catalog-pg-attribute">
1095 <primary>pg_attribute</primary>
1096 </indexterm>
1098 <para>
1099 The catalog <structname>pg_attribute</structname> stores information about
1100 table columns. There will be exactly one
1101 <structname>pg_attribute</structname> row for every column in every
1102 table in the database. (There will also be attribute entries for
1103 indexes, and indeed all objects that have
1104 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>
1105 entries.)
1106 </para>
1108 <para>
1109 The term attribute is equivalent to column and is used for
1110 historical reasons.
1111 </para>
1113 <table>
1114 <title><structname>pg_attribute</structname> Columns</title>
1115 <tgroup cols="1">
1116 <thead>
1117 <row>
1118 <entry role="catalog_table_entry"><para role="column_definition">
1119 Column Type
1120 </para>
1121 <para>
1122 Description
1123 </para></entry>
1124 </row>
1125 </thead>
1127 <tbody>
1128 <row>
1129 <entry role="catalog_table_entry"><para role="column_definition">
1130 <structfield>attrelid</structfield> <type>oid</type>
1131 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1132 </para>
1133 <para>
1134 The table this column belongs to
1135 </para></entry>
1136 </row>
1138 <row>
1139 <entry role="catalog_table_entry"><para role="column_definition">
1140 <structfield>attname</structfield> <type>name</type>
1141 </para>
1142 <para>
1143 The column name
1144 </para></entry>
1145 </row>
1147 <row>
1148 <entry role="catalog_table_entry"><para role="column_definition">
1149 <structfield>atttypid</structfield> <type>oid</type>
1150 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1151 </para>
1152 <para>
1153 The data type of this column (zero for a dropped column)
1154 </para></entry>
1155 </row>
1157 <row>
1158 <entry role="catalog_table_entry"><para role="column_definition">
1159 <structfield>attstattarget</structfield> <type>int4</type>
1160 </para>
1161 <para>
1162 <structfield>attstattarget</structfield> controls the level of detail
1163 of statistics accumulated for this column by
1164 <link linkend="sql-analyze"><command>ANALYZE</command></link>.
1165 A zero value indicates that no statistics should be collected.
1166 A negative value says to use the system default statistics target.
1167 The exact meaning of positive values is data type-dependent.
1168 For scalar data types, <structfield>attstattarget</structfield>
1169 is both the target number of <quote>most common values</quote>
1170 to collect, and the target number of histogram bins to create.
1171 </para></entry>
1172 </row>
1174 <row>
1175 <entry role="catalog_table_entry"><para role="column_definition">
1176 <structfield>attlen</structfield> <type>int2</type>
1177 </para>
1178 <para>
1179 A copy of <literal>pg_type.typlen</literal> of this column's
1180 type
1181 </para></entry>
1182 </row>
1184 <row>
1185 <entry role="catalog_table_entry"><para role="column_definition">
1186 <structfield>attnum</structfield> <type>int2</type>
1187 </para>
1188 <para>
1189 The number of the column. Ordinary columns are numbered from 1
1190 up. System columns, such as <structfield>ctid</structfield>,
1191 have (arbitrary) negative numbers.
1192 </para></entry>
1193 </row>
1195 <row>
1196 <entry role="catalog_table_entry"><para role="column_definition">
1197 <structfield>attndims</structfield> <type>int4</type>
1198 </para>
1199 <para>
1200 Number of dimensions, if the column is an array type; otherwise 0.
1201 (Presently, the number of dimensions of an array is not enforced,
1202 so any nonzero value effectively means <quote>it's an array</quote>.)
1203 </para></entry>
1204 </row>
1206 <row>
1207 <entry role="catalog_table_entry"><para role="column_definition">
1208 <structfield>attcacheoff</structfield> <type>int4</type>
1209 </para>
1210 <para>
1211 Always -1 in storage, but when loaded into a row descriptor
1212 in memory this might be updated to cache the offset of the attribute
1213 within the row
1214 </para></entry>
1215 </row>
1217 <row>
1218 <entry role="catalog_table_entry"><para role="column_definition">
1219 <structfield>atttypmod</structfield> <type>int4</type>
1220 </para>
1221 <para>
1222 <structfield>atttypmod</structfield> records type-specific data
1223 supplied at table creation time (for example, the maximum
1224 length of a <type>varchar</type> column). It is passed to
1225 type-specific input functions and length coercion functions.
1226 The value will generally be -1 for types that do not need <structfield>atttypmod</structfield>.
1227 </para></entry>
1228 </row>
1230 <row>
1231 <entry role="catalog_table_entry"><para role="column_definition">
1232 <structfield>attbyval</structfield> <type>bool</type>
1233 </para>
1234 <para>
1235 A copy of <literal>pg_type.typbyval</literal> of this column's type
1236 </para></entry>
1237 </row>
1239 <row>
1240 <entry role="catalog_table_entry"><para role="column_definition">
1241 <structfield>attalign</structfield> <type>char</type>
1242 </para>
1243 <para>
1244 A copy of <literal>pg_type.typalign</literal> of this column's type
1245 </para></entry>
1246 </row>
1248 <row>
1249 <entry role="catalog_table_entry"><para role="column_definition">
1250 <structfield>attstorage</structfield> <type>char</type>
1251 </para>
1252 <para>
1253 Normally a copy of <literal>pg_type.typstorage</literal> of this
1254 column's type. For TOAST-able data types, this can be altered
1255 after column creation to control storage policy.
1256 </para></entry>
1257 </row>
1259 <row>
1260 <entry role="catalog_table_entry"><para role="column_definition">
1261 <structfield>attcompression</structfield> <type>char</type>
1262 </para>
1263 <para>
1264 The current compression method of the column. Typically this is
1265 <literal>'\0'</literal> to specify use of the current default setting
1266 (see <xref linkend="guc-default-toast-compression"/>). Otherwise,
1267 <literal>'p'</literal> selects pglz compression, while
1268 <literal>'l'</literal> selects <productname>LZ4</productname>
1269 compression. However, this field is ignored
1270 whenever <structfield>attstorage</structfield> does not allow
1271 compression.
1272 </para></entry>
1273 </row>
1275 <row>
1276 <entry role="catalog_table_entry"><para role="column_definition">
1277 <structfield>attnotnull</structfield> <type>bool</type>
1278 </para>
1279 <para>
1280 This represents a not-null constraint.
1281 </para></entry>
1282 </row>
1284 <row>
1285 <entry role="catalog_table_entry"><para role="column_definition">
1286 <structfield>atthasdef</structfield> <type>bool</type>
1287 </para>
1288 <para>
1289 This column has a default expression or generation expression, in which
1290 case there will be a corresponding entry in the
1291 <link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link> catalog that actually defines the
1292 expression. (Check <structfield>attgenerated</structfield> to
1293 determine whether this is a default or a generation expression.)
1294 </para></entry>
1295 </row>
1297 <row>
1298 <entry role="catalog_table_entry"><para role="column_definition">
1299 <structfield>atthasmissing</structfield> <type>bool</type>
1300 </para>
1301 <para>
1302 This column has a value which is used where the column is entirely
1303 missing from the row, as happens when a column is added with a
1304 non-volatile <literal>DEFAULT</literal> value after the row is created.
1305 The actual value used is stored in the
1306 <structfield>attmissingval</structfield> column.
1307 </para></entry>
1308 </row>
1310 <row>
1311 <entry role="catalog_table_entry"><para role="column_definition">
1312 <structfield>attidentity</structfield> <type>char</type>
1313 </para>
1314 <para>
1315 If a zero byte (<literal>''</literal>), then not an identity column.
1316 Otherwise, <literal>a</literal> = generated
1317 always, <literal>d</literal> = generated by default.
1318 </para></entry>
1319 </row>
1321 <row>
1322 <entry role="catalog_table_entry"><para role="column_definition">
1323 <structfield>attgenerated</structfield> <type>char</type>
1324 </para>
1325 <para>
1326 If a zero byte (<literal>''</literal>), then not a generated column.
1327 Otherwise, <literal>s</literal> = stored. (Other values might be added
1328 in the future.)
1329 </para></entry>
1330 </row>
1332 <row>
1333 <entry role="catalog_table_entry"><para role="column_definition">
1334 <structfield>attisdropped</structfield> <type>bool</type>
1335 </para>
1336 <para>
1337 This column has been dropped and is no longer valid. A dropped
1338 column is still physically present in the table, but is
1339 ignored by the parser and so cannot be accessed via SQL.
1340 </para></entry>
1341 </row>
1343 <row>
1344 <entry role="catalog_table_entry"><para role="column_definition">
1345 <structfield>attislocal</structfield> <type>bool</type>
1346 </para>
1347 <para>
1348 This column is defined locally in the relation. Note that a column can
1349 be locally defined and inherited simultaneously.
1350 </para></entry>
1351 </row>
1353 <row>
1354 <entry role="catalog_table_entry"><para role="column_definition">
1355 <structfield>attinhcount</structfield> <type>int4</type>
1356 </para>
1357 <para>
1358 The number of direct ancestors this column has. A column with a
1359 nonzero number of ancestors cannot be dropped nor renamed.
1360 </para></entry>
1361 </row>
1363 <row>
1364 <entry role="catalog_table_entry"><para role="column_definition">
1365 <structfield>attcollation</structfield> <type>oid</type>
1366 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
1367 </para>
1368 <para>
1369 The defined collation of the column, or zero if the column is
1370 not of a collatable data type
1371 </para></entry>
1372 </row>
1374 <row>
1375 <entry role="catalog_table_entry"><para role="column_definition">
1376 <structfield>attacl</structfield> <type>aclitem[]</type>
1377 </para>
1378 <para>
1379 Column-level access privileges, if any have been granted specifically
1380 on this column
1381 </para></entry>
1382 </row>
1384 <row>
1385 <entry role="catalog_table_entry"><para role="column_definition">
1386 <structfield>attoptions</structfield> <type>text[]</type>
1387 </para>
1388 <para>
1389 Attribute-level options, as <quote>keyword=value</quote> strings
1390 </para></entry>
1391 </row>
1393 <row>
1394 <entry role="catalog_table_entry"><para role="column_definition">
1395 <structfield>attfdwoptions</structfield> <type>text[]</type>
1396 </para>
1397 <para>
1398 Attribute-level foreign data wrapper options, as <quote>keyword=value</quote> strings
1399 </para></entry>
1400 </row>
1402 <row>
1403 <entry role="catalog_table_entry"><para role="column_definition">
1404 <structfield>attmissingval</structfield> <type>anyarray</type>
1405 </para>
1406 <para>
1407 This column has a one element array containing the value used when the
1408 column is entirely missing from the row, as happens when the column is
1409 added with a non-volatile <literal>DEFAULT</literal> value after the
1410 row is created. The value is only used when
1411 <structfield>atthasmissing</structfield> is true. If there is no value
1412 the column is null.
1413 </para></entry>
1414 </row>
1415 </tbody>
1416 </tgroup>
1417 </table>
1419 <para>
1420 In a dropped column's <structname>pg_attribute</structname> entry,
1421 <structfield>atttypid</structfield> is reset to zero, but
1422 <structfield>attlen</structfield> and the other fields copied from
1423 <link linkend="catalog-pg-type"><structname>pg_type</structname></link> are still valid. This arrangement is needed
1424 to cope with the situation where the dropped column's data type was
1425 later dropped, and so there is no <structname>pg_type</structname> row anymore.
1426 <structfield>attlen</structfield> and the other fields can be used
1427 to interpret the contents of a row of the table.
1428 </para>
1429 </sect1>
1432 <sect1 id="catalog-pg-authid">
1433 <title><structname>pg_authid</structname></title>
1435 <indexterm zone="catalog-pg-authid">
1436 <primary>pg_authid</primary>
1437 </indexterm>
1439 <para>
1440 The catalog <structname>pg_authid</structname> contains information about
1441 database authorization identifiers (roles). A role subsumes the concepts
1442 of <quote>users</quote> and <quote>groups</quote>. A user is essentially just a
1443 role with the <structfield>rolcanlogin</structfield> flag set. Any role (with or
1444 without <structfield>rolcanlogin</structfield>) can have other roles as members; see
1445 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1446 </para>
1448 <para>
1449 Since this catalog contains passwords, it must not be publicly readable.
1450 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1451 is a publicly readable view on
1452 <structname>pg_authid</structname> that blanks out the password field.
1453 </para>
1455 <para>
1456 <xref linkend="user-manag"/> contains detailed information about user and
1457 privilege management.
1458 </para>
1460 <para>
1461 Because user identities are cluster-wide,
1462 <structname>pg_authid</structname>
1463 is shared across all databases of a cluster: there is only one
1464 copy of <structname>pg_authid</structname> per cluster, not
1465 one per database.
1466 </para>
1468 <table>
1469 <title><structname>pg_authid</structname> Columns</title>
1470 <tgroup cols="1">
1471 <thead>
1472 <row>
1473 <entry role="catalog_table_entry"><para role="column_definition">
1474 Column Type
1475 </para>
1476 <para>
1477 Description
1478 </para></entry>
1479 </row>
1480 </thead>
1482 <tbody>
1483 <row>
1484 <entry role="catalog_table_entry"><para role="column_definition">
1485 <structfield>oid</structfield> <type>oid</type>
1486 </para>
1487 <para>
1488 Row identifier
1489 </para></entry>
1490 </row>
1492 <row>
1493 <entry role="catalog_table_entry"><para role="column_definition">
1494 <structfield>rolname</structfield> <type>name</type>
1495 </para>
1496 <para>
1497 Role name
1498 </para></entry>
1499 </row>
1501 <row>
1502 <entry role="catalog_table_entry"><para role="column_definition">
1503 <structfield>rolsuper</structfield> <type>bool</type>
1504 </para>
1505 <para>
1506 Role has superuser privileges
1507 </para></entry>
1508 </row>
1510 <row>
1511 <entry role="catalog_table_entry"><para role="column_definition">
1512 <structfield>rolinherit</structfield> <type>bool</type>
1513 </para>
1514 <para>
1515 Role automatically inherits privileges of roles it is a
1516 member of
1517 </para></entry>
1518 </row>
1520 <row>
1521 <entry role="catalog_table_entry"><para role="column_definition">
1522 <structfield>rolcreaterole</structfield> <type>bool</type>
1523 </para>
1524 <para>
1525 Role can create more roles
1526 </para></entry>
1527 </row>
1529 <row>
1530 <entry role="catalog_table_entry"><para role="column_definition">
1531 <structfield>rolcreatedb</structfield> <type>bool</type>
1532 </para>
1533 <para>
1534 Role can create databases
1535 </para></entry>
1536 </row>
1538 <row>
1539 <entry role="catalog_table_entry"><para role="column_definition">
1540 <structfield>rolcanlogin</structfield> <type>bool</type>
1541 </para>
1542 <para>
1543 Role can log in. That is, this role can be given as the initial
1544 session authorization identifier.
1545 </para></entry>
1546 </row>
1548 <row>
1549 <entry role="catalog_table_entry"><para role="column_definition">
1550 <structfield>rolreplication</structfield> <type>bool</type>
1551 </para>
1552 <para>
1553 Role is a replication role. A replication role can initiate replication
1554 connections and create and drop replication slots.
1555 </para></entry>
1556 </row>
1558 <row>
1559 <entry role="catalog_table_entry"><para role="column_definition">
1560 <structfield>rolbypassrls</structfield> <type>bool</type>
1561 </para>
1562 <para>
1563 Role bypasses every row-level security policy, see
1564 <xref linkend="ddl-rowsecurity"/> for more information.
1565 </para></entry>
1566 </row>
1568 <row>
1569 <entry role="catalog_table_entry"><para role="column_definition">
1570 <structfield>rolconnlimit</structfield> <type>int4</type>
1571 </para>
1572 <para>
1573 For roles that can log in, this sets maximum number of concurrent
1574 connections this role can make. -1 means no limit.
1575 </para></entry>
1576 </row>
1578 <row>
1579 <entry role="catalog_table_entry"><para role="column_definition">
1580 <structfield>rolpassword</structfield> <type>text</type>
1581 </para>
1582 <para>
1583 Password (possibly encrypted); null if none. The format depends
1584 on the form of encryption used.
1585 </para></entry>
1586 </row>
1588 <row>
1589 <entry role="catalog_table_entry"><para role="column_definition">
1590 <structfield>rolvaliduntil</structfield> <type>timestamptz</type>
1591 </para>
1592 <para>
1593 Password expiry time (only used for password authentication);
1594 null if no expiration
1595 </para></entry>
1596 </row>
1597 </tbody>
1598 </tgroup>
1599 </table>
1601 <para>
1602 For an MD5 encrypted password, <structfield>rolpassword</structfield>
1603 column will begin with the string <literal>md5</literal> followed by a
1604 32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1605 password concatenated to their user name. For example, if user
1606 <literal>joe</literal> has password <literal>xyzzy</literal>, <productname>PostgreSQL</productname>
1607 will store the md5 hash of <literal>xyzzyjoe</literal>.
1608 </para>
1610 <para>
1611 If the password is encrypted with SCRAM-SHA-256, it has the format:
1612 <synopsis>
1613 SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&lt;salt&gt;</replaceable>$<replaceable>&lt;StoredKey&gt;</replaceable>:<replaceable>&lt;ServerKey&gt;</replaceable>
1614 </synopsis>
1615 where <replaceable>salt</replaceable>, <replaceable>StoredKey</replaceable> and
1616 <replaceable>ServerKey</replaceable> are in Base64 encoded format. This format is
1617 the same as that specified by <ulink url="https://tools.ietf.org/html/rfc5803">RFC 5803</ulink>.
1618 </para>
1620 <para>
1621 A password that does not follow either of those formats is assumed to be
1622 unencrypted.
1623 </para>
1624 </sect1>
1627 <sect1 id="catalog-pg-auth-members">
1628 <title><structname>pg_auth_members</structname></title>
1630 <indexterm zone="catalog-pg-auth-members">
1631 <primary>pg_auth_members</primary>
1632 </indexterm>
1634 <para>
1635 The catalog <structname>pg_auth_members</structname> shows the membership
1636 relations between roles. Any non-circular set of relationships is allowed.
1637 </para>
1639 <para>
1640 Because user identities are cluster-wide,
1641 <structname>pg_auth_members</structname>
1642 is shared across all databases of a cluster: there is only one
1643 copy of <structname>pg_auth_members</structname> per cluster, not
1644 one per database.
1645 </para>
1647 <table>
1648 <title><structname>pg_auth_members</structname> Columns</title>
1649 <tgroup cols="1">
1650 <thead>
1651 <row>
1652 <entry role="catalog_table_entry"><para role="column_definition">
1653 Column Type
1654 </para>
1655 <para>
1656 Description
1657 </para></entry>
1658 </row>
1659 </thead>
1661 <tbody>
1662 <row>
1663 <entry role="catalog_table_entry"><para role="column_definition">
1664 <structfield>roleid</structfield> <type>oid</type>
1665 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1666 </para>
1667 <para>
1668 ID of a role that has a member
1669 </para></entry>
1670 </row>
1672 <row>
1673 <entry role="catalog_table_entry"><para role="column_definition">
1674 <structfield>member</structfield> <type>oid</type>
1675 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1676 </para>
1677 <para>
1678 ID of a role that is a member of <structfield>roleid</structfield>
1679 </para></entry>
1680 </row>
1682 <row>
1683 <entry role="catalog_table_entry"><para role="column_definition">
1684 <structfield>grantor</structfield> <type>oid</type>
1685 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1686 </para>
1687 <para>
1688 ID of the role that granted this membership
1689 </para></entry>
1690 </row>
1692 <row>
1693 <entry role="catalog_table_entry"><para role="column_definition">
1694 <structfield>admin_option</structfield> <type>bool</type>
1695 </para>
1696 <para>
1697 True if <structfield>member</structfield> can grant membership in
1698 <structfield>roleid</structfield> to others
1699 </para></entry>
1700 </row>
1701 </tbody>
1702 </tgroup>
1703 </table>
1705 </sect1>
1708 <sect1 id="catalog-pg-cast">
1709 <title><structname>pg_cast</structname></title>
1711 <indexterm zone="catalog-pg-cast">
1712 <primary>pg_cast</primary>
1713 </indexterm>
1715 <para>
1716 The catalog <structname>pg_cast</structname> stores data type conversion
1717 paths, both built-in and user-defined.
1718 </para>
1720 <para>
1721 It should be noted that <structname>pg_cast</structname> does not represent
1722 every type conversion that the system knows how to perform; only those that
1723 cannot be deduced from some generic rule. For example, casting between a
1724 domain and its base type is not explicitly represented in
1725 <structname>pg_cast</structname>. Another important exception is that
1726 <quote>automatic I/O conversion casts</quote>, those performed using a data
1727 type's own I/O functions to convert to or from <type>text</type> or other
1728 string types, are not explicitly represented in
1729 <structname>pg_cast</structname>.
1730 </para>
1732 <table>
1733 <title><structname>pg_cast</structname> Columns</title>
1734 <tgroup cols="1">
1735 <thead>
1736 <row>
1737 <entry role="catalog_table_entry"><para role="column_definition">
1738 Column Type
1739 </para>
1740 <para>
1741 Description
1742 </para></entry>
1743 </row>
1744 </thead>
1746 <tbody>
1747 <row>
1748 <entry role="catalog_table_entry"><para role="column_definition">
1749 <structfield>oid</structfield> <type>oid</type>
1750 </para>
1751 <para>
1752 Row identifier
1753 </para></entry>
1754 </row>
1756 <row>
1757 <entry role="catalog_table_entry"><para role="column_definition">
1758 <structfield>castsource</structfield> <type>oid</type>
1759 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1760 </para>
1761 <para>
1762 OID of the source data type
1763 </para></entry>
1764 </row>
1766 <row>
1767 <entry role="catalog_table_entry"><para role="column_definition">
1768 <structfield>casttarget</structfield> <type>oid</type>
1769 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1770 </para>
1771 <para>
1772 OID of the target data type
1773 </para></entry>
1774 </row>
1776 <row>
1777 <entry role="catalog_table_entry"><para role="column_definition">
1778 <structfield>castfunc</structfield> <type>oid</type>
1779 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
1780 </para>
1781 <para>
1782 The OID of the function to use to perform this cast. Zero is
1783 stored if the cast method doesn't require a function.
1784 </para></entry>
1785 </row>
1787 <row>
1788 <entry role="catalog_table_entry"><para role="column_definition">
1789 <structfield>castcontext</structfield> <type>char</type>
1790 </para>
1791 <para>
1792 Indicates what contexts the cast can be invoked in.
1793 <literal>e</literal> means only as an explicit cast (using
1794 <literal>CAST</literal> or <literal>::</literal> syntax).
1795 <literal>a</literal> means implicitly in assignment
1796 to a target column, as well as explicitly.
1797 <literal>i</literal> means implicitly in expressions, as well as the
1798 other cases.
1799 </para></entry>
1800 </row>
1802 <row>
1803 <entry role="catalog_table_entry"><para role="column_definition">
1804 <structfield>castmethod</structfield> <type>char</type>
1805 </para>
1806 <para>
1807 Indicates how the cast is performed.
1808 <literal>f</literal> means that the function specified in the <structfield>castfunc</structfield> field is used.
1809 <literal>i</literal> means that the input/output functions are used.
1810 <literal>b</literal> means that the types are binary-coercible, thus no conversion is required.
1811 </para></entry>
1812 </row>
1813 </tbody>
1814 </tgroup>
1815 </table>
1817 <para>
1818 The cast functions listed in <structname>pg_cast</structname> must
1819 always take the cast source type as their first argument type, and
1820 return the cast destination type as their result type. A cast
1821 function can have up to three arguments. The second argument,
1822 if present, must be type <type>integer</type>; it receives the type
1823 modifier associated with the destination type, or -1
1824 if there is none. The third argument,
1825 if present, must be type <type>boolean</type>; it receives <literal>true</literal>
1826 if the cast is an explicit cast, <literal>false</literal> otherwise.
1827 </para>
1829 <para>
1830 It is legitimate to create a <structname>pg_cast</structname> entry
1831 in which the source and target types are the same, if the associated
1832 function takes more than one argument. Such entries represent
1833 <quote>length coercion functions</quote> that coerce values of the type
1834 to be legal for a particular type modifier value.
1835 </para>
1837 <para>
1838 When a <structname>pg_cast</structname> entry has different source and
1839 target types and a function that takes more than one argument, it
1840 represents converting from one type to another and applying a length
1841 coercion in a single step. When no such entry is available, coercion
1842 to a type that uses a type modifier involves two steps, one to
1843 convert between data types and a second to apply the modifier.
1844 </para>
1845 </sect1>
1847 <sect1 id="catalog-pg-class">
1848 <title><structname>pg_class</structname></title>
1850 <indexterm zone="catalog-pg-class">
1851 <primary>pg_class</primary>
1852 </indexterm>
1854 <para>
1855 The catalog <structname>pg_class</structname> catalogs tables and most
1856 everything else that has columns or is otherwise similar to a
1857 table. This includes indexes (but see also <link
1858 linkend="catalog-pg-index"><structname>pg_index</structname></link>),
1859 sequences (but see also <link
1860 linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link>),
1861 views, materialized views, composite types, and TOAST tables;
1862 see <structfield>relkind</structfield>.
1863 Below, when we mean all of these kinds of objects we speak of
1864 <quote>relations</quote>. Not all columns are meaningful for all relation
1865 types.
1866 </para>
1868 <table>
1869 <title><structname>pg_class</structname> Columns</title>
1870 <tgroup cols="1">
1871 <thead>
1872 <row>
1873 <entry role="catalog_table_entry"><para role="column_definition">
1874 Column Type
1875 </para>
1876 <para>
1877 Description
1878 </para></entry>
1879 </row>
1880 </thead>
1882 <tbody>
1883 <row>
1884 <entry role="catalog_table_entry"><para role="column_definition">
1885 <structfield>oid</structfield> <type>oid</type>
1886 </para>
1887 <para>
1888 Row identifier
1889 </para></entry>
1890 </row>
1892 <row>
1893 <entry role="catalog_table_entry"><para role="column_definition">
1894 <structfield>relname</structfield> <type>name</type>
1895 </para>
1896 <para>
1897 Name of the table, index, view, etc.
1898 </para></entry>
1899 </row>
1901 <row>
1902 <entry role="catalog_table_entry"><para role="column_definition">
1903 <structfield>relnamespace</structfield> <type>oid</type>
1904 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
1905 </para>
1906 <para>
1907 The OID of the namespace that contains this relation
1908 </para></entry>
1909 </row>
1911 <row>
1912 <entry role="catalog_table_entry"><para role="column_definition">
1913 <structfield>reltype</structfield> <type>oid</type>
1914 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1915 </para>
1916 <para>
1917 The OID of the data type that corresponds to this table's row type,
1918 if any; zero for indexes, sequences, and toast tables, which have
1919 no <structname>pg_type</structname> entry
1920 </para></entry>
1921 </row>
1923 <row>
1924 <entry role="catalog_table_entry"><para role="column_definition">
1925 <structfield>reloftype</structfield> <type>oid</type>
1926 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1927 </para>
1928 <para>
1929 For typed tables, the OID of the underlying composite type;
1930 zero for all other relations
1931 </para></entry>
1932 </row>
1934 <row>
1935 <entry role="catalog_table_entry"><para role="column_definition">
1936 <structfield>relowner</structfield> <type>oid</type>
1937 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1938 </para>
1939 <para>
1940 Owner of the relation
1941 </para></entry>
1942 </row>
1944 <row>
1945 <entry role="catalog_table_entry"><para role="column_definition">
1946 <structfield>relam</structfield> <type>oid</type>
1947 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
1948 </para>
1949 <para>
1950 If this is a table or an index, the access method used (heap,
1951 B-tree, hash, etc.); otherwise zero (zero occurs for sequences,
1952 as well as relations without storage, such as views)
1953 </para></entry>
1954 </row>
1956 <row>
1957 <entry role="catalog_table_entry"><para role="column_definition">
1958 <structfield>relfilenode</structfield> <type>oid</type>
1959 </para>
1960 <para>
1961 Name of the on-disk file of this relation; zero means this
1962 is a <quote>mapped</quote> relation whose disk file name is determined
1963 by low-level state
1964 </para></entry>
1965 </row>
1967 <row>
1968 <entry role="catalog_table_entry"><para role="column_definition">
1969 <structfield>reltablespace</structfield> <type>oid</type>
1970 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>)
1971 </para>
1972 <para>
1973 The tablespace in which this relation is stored. If zero,
1974 the database's default tablespace is implied. (Not meaningful
1975 if the relation has no on-disk file.)
1976 </para></entry>
1977 </row>
1979 <row>
1980 <entry role="catalog_table_entry"><para role="column_definition">
1981 <structfield>relpages</structfield> <type>int4</type>
1982 </para>
1983 <para>
1984 Size of the on-disk representation of this table in pages (of size
1985 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1986 planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>,
1987 <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as
1988 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>.
1989 </para></entry>
1990 </row>
1992 <row>
1993 <entry role="catalog_table_entry"><para role="column_definition">
1994 <structfield>reltuples</structfield> <type>float4</type>
1995 </para>
1996 <para>
1997 Number of live rows in the table. This is only an estimate used by
1998 the planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>,
1999 <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as
2000 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>.
2001 If the table has never yet been vacuumed or
2002 analyzed, <structfield>reltuples</structfield>
2003 contains <literal>-1</literal> indicating that the row count is
2004 unknown.
2005 </para></entry>
2006 </row>
2008 <row>
2009 <entry role="catalog_table_entry"><para role="column_definition">
2010 <structfield>relallvisible</structfield> <type>int4</type>
2011 </para>
2012 <para>
2013 Number of pages that are marked all-visible in the table's
2014 visibility map. This is only an estimate used by the
2015 planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>,
2016 <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as
2017 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>.
2018 </para></entry>
2019 </row>
2021 <row>
2022 <entry role="catalog_table_entry"><para role="column_definition">
2023 <structfield>reltoastrelid</structfield> <type>oid</type>
2024 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2025 </para>
2026 <para>
2027 OID of the TOAST table associated with this table, zero if none. The
2028 TOAST table stores large attributes <quote>out of line</quote> in a
2029 secondary table.
2030 </para></entry>
2031 </row>
2033 <row>
2034 <entry role="catalog_table_entry"><para role="column_definition">
2035 <structfield>relhasindex</structfield> <type>bool</type>
2036 </para>
2037 <para>
2038 True if this is a table and it has (or recently had) any indexes
2039 </para></entry>
2040 </row>
2042 <row>
2043 <entry role="catalog_table_entry"><para role="column_definition">
2044 <structfield>relisshared</structfield> <type>bool</type>
2045 </para>
2046 <para>
2047 True if this table is shared across all databases in the cluster. Only
2048 certain system catalogs (such as <link linkend="catalog-pg-database"><structname>pg_database</structname></link>)
2049 are shared.
2050 </para></entry>
2051 </row>
2053 <row>
2054 <entry role="catalog_table_entry"><para role="column_definition">
2055 <structfield>relpersistence</structfield> <type>char</type>
2056 </para>
2057 <para>
2058 <literal>p</literal> = permanent table, <literal>u</literal> = unlogged table,
2059 <literal>t</literal> = temporary table
2060 </para></entry>
2061 </row>
2063 <row>
2064 <entry role="catalog_table_entry"><para role="column_definition">
2065 <structfield>relkind</structfield> <type>char</type>
2066 </para>
2067 <para>
2068 <literal>r</literal> = ordinary table,
2069 <literal>i</literal> = index,
2070 <literal>S</literal> = sequence,
2071 <literal>t</literal> = TOAST table,
2072 <literal>v</literal> = view,
2073 <literal>m</literal> = materialized view,
2074 <literal>c</literal> = composite type,
2075 <literal>f</literal> = foreign table,
2076 <literal>p</literal> = partitioned table,
2077 <literal>I</literal> = partitioned index
2078 </para></entry>
2079 </row>
2081 <row>
2082 <entry role="catalog_table_entry"><para role="column_definition">
2083 <structfield>relnatts</structfield> <type>int2</type>
2084 </para>
2085 <para>
2086 Number of user columns in the relation (system columns not
2087 counted). There must be this many corresponding entries in
2088 <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>. See also
2089 <structname>pg_attribute</structname>.<structfield>attnum</structfield>.
2090 </para></entry>
2091 </row>
2093 <row>
2094 <entry role="catalog_table_entry"><para role="column_definition">
2095 <structfield>relchecks</structfield> <type>int2</type>
2096 </para>
2097 <para>
2098 Number of <literal>CHECK</literal> constraints on the table; see
2099 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
2100 </para></entry>
2101 </row>
2103 <row>
2104 <entry role="catalog_table_entry"><para role="column_definition">
2105 <structfield>relhasrules</structfield> <type>bool</type>
2106 </para>
2107 <para>
2108 True if table has (or once had) rules; see
2109 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
2110 </para></entry>
2111 </row>
2113 <row>
2114 <entry role="catalog_table_entry"><para role="column_definition">
2115 <structfield>relhastriggers</structfield> <type>bool</type>
2116 </para>
2117 <para>
2118 True if table has (or once had) triggers; see
2119 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
2120 </para></entry>
2121 </row>
2123 <row>
2124 <entry role="catalog_table_entry"><para role="column_definition">
2125 <structfield>relhassubclass</structfield> <type>bool</type>
2126 </para>
2127 <para>
2128 True if table or index has (or once had) any inheritance children
2129 </para></entry>
2130 </row>
2132 <row>
2133 <entry role="catalog_table_entry"><para role="column_definition">
2134 <structfield>relrowsecurity</structfield> <type>bool</type>
2135 </para>
2136 <para>
2137 True if table has row-level security enabled; see
2138 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
2139 </para></entry>
2140 </row>
2142 <row>
2143 <entry role="catalog_table_entry"><para role="column_definition">
2144 <structfield>relforcerowsecurity</structfield> <type>bool</type>
2145 </para>
2146 <para>
2147 True if row-level security (when enabled) will also apply to table owner; see
2148 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
2149 </para></entry>
2150 </row>
2152 <row>
2153 <entry role="catalog_table_entry"><para role="column_definition">
2154 <structfield>relispopulated</structfield> <type>bool</type>
2155 </para>
2156 <para>
2157 True if relation is populated (this is true for all
2158 relations other than some materialized views)
2159 </para></entry>
2160 </row>
2162 <row>
2163 <entry role="catalog_table_entry"><para role="column_definition">
2164 <structfield>relreplident</structfield> <type>char</type>
2165 </para>
2166 <para>
2167 Columns used to form <quote>replica identity</quote> for rows:
2168 <literal>d</literal> = default (primary key, if any),
2169 <literal>n</literal> = nothing,
2170 <literal>f</literal> = all columns,
2171 <literal>i</literal> = index with
2172 <structfield>indisreplident</structfield> set (same as nothing if the
2173 index used has been dropped)
2174 </para></entry>
2175 </row>
2177 <row>
2178 <entry role="catalog_table_entry"><para role="column_definition">
2179 <structfield>relispartition</structfield> <type>bool</type>
2180 </para>
2181 <para>
2182 True if table or index is a partition
2183 </para></entry>
2184 </row>
2186 <row>
2187 <entry role="catalog_table_entry"><para role="column_definition">
2188 <structfield>relrewrite</structfield> <type>oid</type>
2189 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2190 </para>
2191 <para>
2192 For new relations being written during a DDL operation that requires a
2193 table rewrite, this contains the OID of the original relation;
2194 otherwise zero. That state is only visible internally; this field should
2195 never contain anything other than zero for a user-visible relation.
2196 </para></entry>
2197 </row>
2199 <row>
2200 <entry role="catalog_table_entry"><para role="column_definition">
2201 <structfield>relfrozenxid</structfield> <type>xid</type>
2202 </para>
2203 <para>
2204 All transaction IDs before this one have been replaced with a permanent
2205 (<quote>frozen</quote>) transaction ID in this table. This is used to track
2206 whether the table needs to be vacuumed in order to prevent transaction
2207 ID wraparound or to allow <literal>pg_xact</literal> to be shrunk. Zero
2208 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2209 </para></entry>
2210 </row>
2212 <row>
2213 <entry role="catalog_table_entry"><para role="column_definition">
2214 <structfield>relminmxid</structfield> <type>xid</type>
2215 </para>
2216 <para>
2217 All multixact IDs before this one have been replaced by a
2218 transaction ID in this table. This is used to track
2219 whether the table needs to be vacuumed in order to prevent multixact ID
2220 wraparound or to allow <literal>pg_multixact</literal> to be shrunk. Zero
2221 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
2222 </para></entry>
2223 </row>
2225 <row>
2226 <entry role="catalog_table_entry"><para role="column_definition">
2227 <structfield>relacl</structfield> <type>aclitem[]</type>
2228 </para>
2229 <para>
2230 Access privileges; see <xref linkend="ddl-priv"/> for details
2231 </para></entry>
2232 </row>
2234 <row>
2235 <entry role="catalog_table_entry"><para role="column_definition">
2236 <structfield>reloptions</structfield> <type>text[]</type>
2237 </para>
2238 <para>
2239 Access-method-specific options, as <quote>keyword=value</quote> strings
2240 </para></entry>
2241 </row>
2243 <row>
2244 <entry role="catalog_table_entry"><para role="column_definition">
2245 <structfield>relpartbound</structfield> <type>pg_node_tree</type>
2246 </para>
2247 <para>
2248 If table is a partition (see <structfield>relispartition</structfield>),
2249 internal representation of the partition bound
2250 </para></entry>
2251 </row>
2252 </tbody>
2253 </tgroup>
2254 </table>
2256 <para>
2257 Several of the Boolean flags in <structname>pg_class</structname> are maintained
2258 lazily: they are guaranteed to be true if that's the correct state, but
2259 may not be reset to false immediately when the condition is no longer
2260 true. For example, <structfield>relhasindex</structfield> is set by
2261 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>, but it is never cleared by
2262 <link linkend="sql-dropindex"><command>DROP INDEX</command></link>. Instead, <link linkend="sql-vacuum"><command>VACUUM</command></link> clears
2263 <structfield>relhasindex</structfield> if it finds the table has no indexes. This
2264 arrangement avoids race conditions and improves concurrency.
2265 </para>
2266 </sect1>
2268 <sect1 id="catalog-pg-collation">
2269 <title><structname>pg_collation</structname></title>
2271 <indexterm zone="catalog-pg-collation">
2272 <primary>pg_collation</primary>
2273 </indexterm>
2275 <para>
2276 The catalog <structname>pg_collation</structname> describes the
2277 available collations, which are essentially mappings from an SQL
2278 name to operating system locale categories.
2279 See <xref linkend="collation"/> for more information.
2280 </para>
2282 <table>
2283 <title><structname>pg_collation</structname> Columns</title>
2284 <tgroup cols="1">
2285 <thead>
2286 <row>
2287 <entry role="catalog_table_entry"><para role="column_definition">
2288 Column Type
2289 </para>
2290 <para>
2291 Description
2292 </para></entry>
2293 </row>
2294 </thead>
2296 <tbody>
2297 <row>
2298 <entry role="catalog_table_entry"><para role="column_definition">
2299 <structfield>oid</structfield> <type>oid</type>
2300 </para>
2301 <para>
2302 Row identifier
2303 </para></entry>
2304 </row>
2306 <row>
2307 <entry role="catalog_table_entry"><para role="column_definition">
2308 <structfield>collname</structfield> <type>name</type>
2309 </para>
2310 <para>
2311 Collation name (unique per namespace and encoding)
2312 </para></entry>
2313 </row>
2315 <row>
2316 <entry role="catalog_table_entry"><para role="column_definition">
2317 <structfield>collnamespace</structfield> <type>oid</type>
2318 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2319 </para>
2320 <para>
2321 The OID of the namespace that contains this collation
2322 </para></entry>
2323 </row>
2325 <row>
2326 <entry role="catalog_table_entry"><para role="column_definition">
2327 <structfield>collowner</structfield> <type>oid</type>
2328 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2329 </para>
2330 <para>
2331 Owner of the collation
2332 </para></entry>
2333 </row>
2335 <row>
2336 <entry role="catalog_table_entry"><para role="column_definition">
2337 <structfield>collprovider</structfield> <type>char</type>
2338 </para>
2339 <para>
2340 Provider of the collation: <literal>d</literal> = database
2341 default, <literal>c</literal> = libc, <literal>i</literal> = icu
2342 </para></entry>
2343 </row>
2345 <row>
2346 <entry role="catalog_table_entry"><para role="column_definition">
2347 <structfield>collisdeterministic</structfield> <type>bool</type>
2348 </para>
2349 <para>
2350 Is the collation deterministic?
2351 </para></entry>
2352 </row>
2354 <row>
2355 <entry role="catalog_table_entry"><para role="column_definition">
2356 <structfield>collencoding</structfield> <type>int4</type>
2357 </para>
2358 <para>
2359 Encoding in which the collation is applicable, or -1 if it
2360 works for any encoding
2361 </para></entry>
2362 </row>
2364 <row>
2365 <entry role="catalog_table_entry"><para role="column_definition">
2366 <structfield>collcollate</structfield> <type>name</type>
2367 </para>
2368 <para>
2369 <symbol>LC_COLLATE</symbol> for this collation object
2370 </para></entry>
2371 </row>
2373 <row>
2374 <entry role="catalog_table_entry"><para role="column_definition">
2375 <structfield>collctype</structfield> <type>name</type>
2376 </para>
2377 <para>
2378 <symbol>LC_CTYPE</symbol> for this collation object
2379 </para></entry>
2380 </row>
2382 <row>
2383 <entry role="catalog_table_entry"><para role="column_definition">
2384 <structfield>collversion</structfield> <type>text</type>
2385 </para>
2386 <para>
2387 Provider-specific version of the collation. This is recorded when the
2388 collation is created and then checked when it is used, to detect
2389 changes in the collation definition that could lead to data corruption.
2390 </para></entry>
2391 </row>
2392 </tbody>
2393 </tgroup>
2394 </table>
2396 <para>
2397 Note that the unique key on this catalog is (<structfield>collname</structfield>,
2398 <structfield>collencoding</structfield>, <structfield>collnamespace</structfield>) not just
2399 (<structfield>collname</structfield>, <structfield>collnamespace</structfield>).
2400 <productname>PostgreSQL</productname> generally ignores all
2401 collations that do not have <structfield>collencoding</structfield> equal to
2402 either the current database's encoding or -1, and creation of new entries
2403 with the same name as an entry with <structfield>collencoding</structfield> = -1
2404 is forbidden. Therefore it is sufficient to use a qualified SQL name
2405 (<replaceable>schema</replaceable>.<replaceable>name</replaceable>) to identify a collation,
2406 even though this is not unique according to the catalog definition.
2407 The reason for defining the catalog this way is that
2408 <application>initdb</application> fills it in at cluster initialization time with
2409 entries for all locales available on the system, so it must be able to
2410 hold entries for all encodings that might ever be used in the cluster.
2411 </para>
2413 <para>
2414 In the <literal>template0</literal> database, it could be useful to create
2415 collations whose encoding does not match the database encoding,
2416 since they could match the encodings of databases later cloned from
2417 <literal>template0</literal>. This would currently have to be done manually.
2418 </para>
2419 </sect1>
2421 <sect1 id="catalog-pg-constraint">
2422 <title><structname>pg_constraint</structname></title>
2424 <indexterm zone="catalog-pg-constraint">
2425 <primary>pg_constraint</primary>
2426 </indexterm>
2428 <para>
2429 The catalog <structname>pg_constraint</structname> stores check, primary
2430 key, unique, foreign key, and exclusion constraints on tables.
2431 (Column constraints are not treated specially. Every column constraint is
2432 equivalent to some table constraint.)
2433 Not-null constraints are represented in the
2434 <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>
2435 catalog, not here.
2436 </para>
2438 <para>
2439 User-defined constraint triggers (created with <link linkend="sql-createtrigger">
2440 <command>CREATE CONSTRAINT TRIGGER</command></link>) also give rise to an entry in this table.
2441 </para>
2443 <para>
2444 Check constraints on domains are stored here, too.
2445 </para>
2447 <table>
2448 <title><structname>pg_constraint</structname> Columns</title>
2449 <tgroup cols="1">
2450 <thead>
2451 <row>
2452 <entry role="catalog_table_entry"><para role="column_definition">
2453 Column Type
2454 </para>
2455 <para>
2456 Description
2457 </para></entry>
2458 </row>
2459 </thead>
2461 <tbody>
2462 <row>
2463 <entry role="catalog_table_entry"><para role="column_definition">
2464 <structfield>oid</structfield> <type>oid</type>
2465 </para>
2466 <para>
2467 Row identifier
2468 </para></entry>
2469 </row>
2471 <row>
2472 <entry role="catalog_table_entry"><para role="column_definition">
2473 <structfield>conname</structfield> <type>name</type>
2474 </para>
2475 <para>
2476 Constraint name (not necessarily unique!)
2477 </para></entry>
2478 </row>
2480 <row>
2481 <entry role="catalog_table_entry"><para role="column_definition">
2482 <structfield>connamespace</structfield> <type>oid</type>
2483 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2484 </para>
2485 <para>
2486 The OID of the namespace that contains this constraint
2487 </para></entry>
2488 </row>
2490 <row>
2491 <entry role="catalog_table_entry"><para role="column_definition">
2492 <structfield>contype</structfield> <type>char</type>
2493 </para>
2494 <para>
2495 <literal>c</literal> = check constraint,
2496 <literal>f</literal> = foreign key constraint,
2497 <literal>p</literal> = primary key constraint,
2498 <literal>u</literal> = unique constraint,
2499 <literal>t</literal> = constraint trigger,
2500 <literal>x</literal> = exclusion constraint
2501 </para></entry>
2502 </row>
2504 <row>
2505 <entry role="catalog_table_entry"><para role="column_definition">
2506 <structfield>condeferrable</structfield> <type>bool</type>
2507 </para>
2508 <para>
2509 Is the constraint deferrable?
2510 </para></entry>
2511 </row>
2513 <row>
2514 <entry role="catalog_table_entry"><para role="column_definition">
2515 <structfield>condeferred</structfield> <type>bool</type>
2516 </para>
2517 <para>
2518 Is the constraint deferred by default?
2519 </para></entry>
2520 </row>
2522 <row>
2523 <entry role="catalog_table_entry"><para role="column_definition">
2524 <structfield>convalidated</structfield> <type>bool</type>
2525 </para>
2526 <para>
2527 Has the constraint been validated?
2528 Currently, can be false only for foreign keys and CHECK constraints
2529 </para></entry>
2530 </row>
2532 <row>
2533 <entry role="catalog_table_entry"><para role="column_definition">
2534 <structfield>conrelid</structfield> <type>oid</type>
2535 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2536 </para>
2537 <para>
2538 The table this constraint is on; zero if not a table constraint
2539 </para></entry>
2540 </row>
2542 <row>
2543 <entry role="catalog_table_entry"><para role="column_definition">
2544 <structfield>contypid</structfield> <type>oid</type>
2545 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
2546 </para>
2547 <para>
2548 The domain this constraint is on; zero if not a domain constraint
2549 </para></entry>
2550 </row>
2552 <row>
2553 <entry role="catalog_table_entry"><para role="column_definition">
2554 <structfield>conindid</structfield> <type>oid</type>
2555 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2556 </para>
2557 <para>
2558 The index supporting this constraint, if it's a unique, primary
2559 key, foreign key, or exclusion constraint; else zero
2560 </para></entry>
2561 </row>
2563 <row>
2564 <entry role="catalog_table_entry"><para role="column_definition">
2565 <structfield>conparentid</structfield> <type>oid</type>
2566 (references <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.<structfield>oid</structfield>)
2567 </para>
2568 <para>
2569 The corresponding constraint of the parent partitioned table,
2570 if this is a constraint on a partition; else zero
2571 </para></entry>
2572 </row>
2574 <row>
2575 <entry role="catalog_table_entry"><para role="column_definition">
2576 <structfield>confrelid</structfield> <type>oid</type>
2577 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2578 </para>
2579 <para>
2580 If a foreign key, the referenced table; else zero
2581 </para></entry>
2582 </row>
2584 <row>
2585 <entry role="catalog_table_entry"><para role="column_definition">
2586 <structfield>confupdtype</structfield> <type>char</type>
2587 </para>
2588 <para>
2589 Foreign key update action code:
2590 <literal>a</literal> = no action,
2591 <literal>r</literal> = restrict,
2592 <literal>c</literal> = cascade,
2593 <literal>n</literal> = set null,
2594 <literal>d</literal> = set default
2595 </para></entry>
2596 </row>
2598 <row>
2599 <entry role="catalog_table_entry"><para role="column_definition">
2600 <structfield>confdeltype</structfield> <type>char</type>
2601 </para>
2602 <para>
2603 Foreign key deletion action code:
2604 <literal>a</literal> = no action,
2605 <literal>r</literal> = restrict,
2606 <literal>c</literal> = cascade,
2607 <literal>n</literal> = set null,
2608 <literal>d</literal> = set default
2609 </para></entry>
2610 </row>
2612 <row>
2613 <entry role="catalog_table_entry"><para role="column_definition">
2614 <structfield>confmatchtype</structfield> <type>char</type>
2615 </para>
2616 <para>
2617 Foreign key match type:
2618 <literal>f</literal> = full,
2619 <literal>p</literal> = partial,
2620 <literal>s</literal> = simple
2621 </para></entry>
2622 </row>
2624 <row>
2625 <entry role="catalog_table_entry"><para role="column_definition">
2626 <structfield>conislocal</structfield> <type>bool</type>
2627 </para>
2628 <para>
2629 This constraint is defined locally for the relation. Note that a
2630 constraint can be locally defined and inherited simultaneously.
2631 </para></entry>
2632 </row>
2634 <row>
2635 <entry role="catalog_table_entry"><para role="column_definition">
2636 <structfield>coninhcount</structfield> <type>int4</type>
2637 </para>
2638 <para>
2639 The number of direct inheritance ancestors this constraint has.
2640 A constraint with
2641 a nonzero number of ancestors cannot be dropped nor renamed.
2642 </para></entry>
2643 </row>
2645 <row>
2646 <entry role="catalog_table_entry"><para role="column_definition">
2647 <structfield>connoinherit</structfield> <type>bool</type>
2648 </para>
2649 <para>
2650 This constraint is defined locally for the relation. It is a
2651 non-inheritable constraint.
2652 </para></entry>
2653 </row>
2655 <row>
2656 <entry role="catalog_table_entry"><para role="column_definition">
2657 <structfield>conkey</structfield> <type>int2[]</type>
2658 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
2659 </para>
2660 <para>
2661 If a table constraint (including foreign keys, but not constraint
2662 triggers), list of the constrained columns
2663 </para></entry>
2664 </row>
2666 <row>
2667 <entry role="catalog_table_entry"><para role="column_definition">
2668 <structfield>confkey</structfield> <type>int2[]</type>
2669 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
2670 </para>
2671 <para>
2672 If a foreign key, list of the referenced columns
2673 </para></entry>
2674 </row>
2676 <row>
2677 <entry role="catalog_table_entry"><para role="column_definition">
2678 <structfield>conpfeqop</structfield> <type>oid[]</type>
2679 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2680 </para>
2681 <para>
2682 If a foreign key, list of the equality operators for PK = FK comparisons
2683 </para></entry>
2684 </row>
2686 <row>
2687 <entry role="catalog_table_entry"><para role="column_definition">
2688 <structfield>conppeqop</structfield> <type>oid[]</type>
2689 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2690 </para>
2691 <para>
2692 If a foreign key, list of the equality operators for PK = PK comparisons
2693 </para></entry>
2694 </row>
2696 <row>
2697 <entry role="catalog_table_entry"><para role="column_definition">
2698 <structfield>conffeqop</structfield> <type>oid[]</type>
2699 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2700 </para>
2701 <para>
2702 If a foreign key, list of the equality operators for FK = FK comparisons
2703 </para></entry>
2704 </row>
2706 <row>
2707 <entry role="catalog_table_entry"><para role="column_definition">
2708 <structfield>conexclop</structfield> <type>oid[]</type>
2709 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2710 </para>
2711 <para>
2712 If an exclusion constraint, list of the per-column exclusion operators
2713 </para></entry>
2714 </row>
2716 <row>
2717 <entry role="catalog_table_entry"><para role="column_definition">
2718 <structfield>conbin</structfield> <type>pg_node_tree</type>
2719 </para>
2720 <para>
2721 If a check constraint, an internal representation of the
2722 expression. (It's recommended to use
2723 <function>pg_get_constraintdef()</function> to extract the definition of
2724 a check constraint.)
2725 </para></entry>
2726 </row>
2727 </tbody>
2728 </tgroup>
2729 </table>
2731 <para>
2732 In the case of an exclusion constraint, <structfield>conkey</structfield>
2733 is only useful for constraint elements that are simple column references.
2734 For other cases, a zero appears in <structfield>conkey</structfield>
2735 and the associated index must be consulted to discover the expression
2736 that is constrained. (<structfield>conkey</structfield> thus has the
2737 same contents as <link linkend="catalog-pg-index"><structname>pg_index</structname></link>.<structfield>indkey</structfield> for the
2738 index.)
2739 </para>
2741 <note>
2742 <para>
2743 <literal>pg_class.relchecks</literal> needs to agree with the
2744 number of check-constraint entries found in this table for each
2745 relation.
2746 </para>
2747 </note>
2748 </sect1>
2751 <sect1 id="catalog-pg-conversion">
2752 <title><structname>pg_conversion</structname></title>
2754 <indexterm zone="catalog-pg-conversion">
2755 <primary>pg_conversion</primary>
2756 </indexterm>
2758 <para>
2759 The catalog <structname>pg_conversion</structname> describes
2760 encoding conversion functions. See <xref linkend="sql-createconversion"/>
2761 for more information.
2762 </para>
2764 <table>
2765 <title><structname>pg_conversion</structname> Columns</title>
2766 <tgroup cols="1">
2767 <thead>
2768 <row>
2769 <entry role="catalog_table_entry"><para role="column_definition">
2770 Column Type
2771 </para>
2772 <para>
2773 Description
2774 </para></entry>
2775 </row>
2776 </thead>
2778 <tbody>
2779 <row>
2780 <entry role="catalog_table_entry"><para role="column_definition">
2781 <structfield>oid</structfield> <type>oid</type>
2782 </para>
2783 <para>
2784 Row identifier
2785 </para></entry>
2786 </row>
2788 <row>
2789 <entry role="catalog_table_entry"><para role="column_definition">
2790 <structfield>conname</structfield> <type>name</type>
2791 </para>
2792 <para>
2793 Conversion name (unique within a namespace)
2794 </para></entry>
2795 </row>
2797 <row>
2798 <entry role="catalog_table_entry"><para role="column_definition">
2799 <structfield>connamespace</structfield> <type>oid</type>
2800 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2801 </para>
2802 <para>
2803 The OID of the namespace that contains this conversion
2804 </para></entry>
2805 </row>
2807 <row>
2808 <entry role="catalog_table_entry"><para role="column_definition">
2809 <structfield>conowner</structfield> <type>oid</type>
2810 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2811 </para>
2812 <para>
2813 Owner of the conversion
2814 </para></entry>
2815 </row>
2817 <row>
2818 <entry role="catalog_table_entry"><para role="column_definition">
2819 <structfield>conforencoding</structfield> <type>int4</type>
2820 </para>
2821 <para>
2822 Source encoding ID (<link linkend="pg-encoding-to-char"><function>pg_encoding_to_char()</function></link>
2823 can translate this number to the encoding name)
2824 </para></entry>
2825 </row>
2827 <row>
2828 <entry role="catalog_table_entry"><para role="column_definition">
2829 <structfield>contoencoding</structfield> <type>int4</type>
2830 </para>
2831 <para>
2832 Destination encoding ID (<link linkend="pg-encoding-to-char"><function>pg_encoding_to_char()</function></link>
2833 can translate this number to the encoding name)
2834 </para></entry>
2835 </row>
2837 <row>
2838 <entry role="catalog_table_entry"><para role="column_definition">
2839 <structfield>conproc</structfield> <type>regproc</type>
2840 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
2841 </para>
2842 <para>
2843 Conversion function
2844 </para></entry>
2845 </row>
2847 <row>
2848 <entry role="catalog_table_entry"><para role="column_definition">
2849 <structfield>condefault</structfield> <type>bool</type>
2850 </para>
2851 <para>
2852 True if this is the default conversion
2853 </para></entry>
2854 </row>
2855 </tbody>
2856 </tgroup>
2857 </table>
2859 </sect1>
2861 <sect1 id="catalog-pg-database">
2862 <title><structname>pg_database</structname></title>
2864 <indexterm zone="catalog-pg-database">
2865 <primary>pg_database</primary>
2866 </indexterm>
2868 <para>
2869 The catalog <structname>pg_database</structname> stores information about
2870 the available databases. Databases are created with the <link
2871 linkend="sql-createdatabase"><command>CREATE DATABASE</command></link> command.
2872 Consult <xref linkend="managing-databases"/> for details about the meaning
2873 of some of the parameters.
2874 </para>
2876 <para>
2877 Unlike most system catalogs, <structname>pg_database</structname>
2878 is shared across all databases of a cluster: there is only one
2879 copy of <structname>pg_database</structname> per cluster, not
2880 one per database.
2881 </para>
2883 <table>
2884 <title><structname>pg_database</structname> Columns</title>
2885 <tgroup cols="1">
2886 <thead>
2887 <row>
2888 <entry role="catalog_table_entry"><para role="column_definition">
2889 Column Type
2890 </para>
2891 <para>
2892 Description
2893 </para></entry>
2894 </row>
2895 </thead>
2897 <tbody>
2898 <row>
2899 <entry role="catalog_table_entry"><para role="column_definition">
2900 <structfield>oid</structfield> <type>oid</type>
2901 </para>
2902 <para>
2903 Row identifier
2904 </para></entry>
2905 </row>
2907 <row>
2908 <entry role="catalog_table_entry"><para role="column_definition">
2909 <structfield>datname</structfield> <type>name</type>
2910 </para>
2911 <para>
2912 Database name
2913 </para></entry>
2914 </row>
2916 <row>
2917 <entry role="catalog_table_entry"><para role="column_definition">
2918 <structfield>datdba</structfield> <type>oid</type>
2919 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2920 </para>
2921 <para>
2922 Owner of the database, usually the user who created it
2923 </para></entry>
2924 </row>
2926 <row>
2927 <entry role="catalog_table_entry"><para role="column_definition">
2928 <structfield>encoding</structfield> <type>int4</type>
2929 </para>
2930 <para>
2931 Character encoding for this database
2932 (<link linkend="pg-encoding-to-char"><function>pg_encoding_to_char()</function></link> can translate
2933 this number to the encoding name)
2934 </para></entry>
2935 </row>
2937 <row>
2938 <entry role="catalog_table_entry"><para role="column_definition">
2939 <structfield>datcollate</structfield> <type>name</type>
2940 </para>
2941 <para>
2942 LC_COLLATE for this database
2943 </para></entry>
2944 </row>
2946 <row>
2947 <entry role="catalog_table_entry"><para role="column_definition">
2948 <structfield>datctype</structfield> <type>name</type>
2949 </para>
2950 <para>
2951 LC_CTYPE for this database
2952 </para></entry>
2953 </row>
2955 <row>
2956 <entry role="catalog_table_entry"><para role="column_definition">
2957 <structfield>datistemplate</structfield> <type>bool</type>
2958 </para>
2959 <para>
2960 If true, then this database can be cloned by
2961 any user with <literal>CREATEDB</literal> privileges;
2962 if false, then only superusers or the owner of
2963 the database can clone it.
2964 </para></entry>
2965 </row>
2967 <row>
2968 <entry role="catalog_table_entry"><para role="column_definition">
2969 <structfield>datallowconn</structfield> <type>bool</type>
2970 </para>
2971 <para>
2972 If false then no one can connect to this database. This is
2973 used to protect the <literal>template0</literal> database from being altered.
2974 </para></entry>
2975 </row>
2977 <row>
2978 <entry role="catalog_table_entry"><para role="column_definition">
2979 <structfield>datconnlimit</structfield> <type>int4</type>
2980 </para>
2981 <para>
2982 Sets maximum number of concurrent connections that can be made
2983 to this database. -1 means no limit.
2984 </para></entry>
2985 </row>
2987 <row>
2988 <entry role="catalog_table_entry"><para role="column_definition">
2989 <structfield>datlastsysoid</structfield> <type>oid</type>
2990 </para>
2991 <para>
2992 Last system OID in the database; useful
2993 particularly to <application>pg_dump</application>
2994 </para></entry>
2995 </row>
2997 <row>
2998 <entry role="catalog_table_entry"><para role="column_definition">
2999 <structfield>datfrozenxid</structfield> <type>xid</type>
3000 </para>
3001 <para>
3002 All transaction IDs before this one have been replaced with a permanent
3003 (<quote>frozen</quote>) transaction ID in this database. This is used to
3004 track whether the database needs to be vacuumed in order to prevent
3005 transaction ID wraparound or to allow <literal>pg_xact</literal> to be shrunk.
3006 It is the minimum of the per-table
3007 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relfrozenxid</structfield> values.
3008 </para></entry>
3009 </row>
3011 <row>
3012 <entry role="catalog_table_entry"><para role="column_definition">
3013 <structfield>datminmxid</structfield> <type>xid</type>
3014 </para>
3015 <para>
3016 All multixact IDs before this one have been replaced with a
3017 transaction ID in this database. This is used to
3018 track whether the database needs to be vacuumed in order to prevent
3019 multixact ID wraparound or to allow <literal>pg_multixact</literal> to be shrunk.
3020 It is the minimum of the per-table
3021 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relminmxid</structfield> values.
3022 </para></entry>
3023 </row>
3025 <row>
3026 <entry role="catalog_table_entry"><para role="column_definition">
3027 <structfield>dattablespace</structfield> <type>oid</type>
3028 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>)
3029 </para>
3030 <para>
3031 The default tablespace for the database.
3032 Within this database, all tables for which
3033 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>reltablespace</structfield> is zero
3034 will be stored in this tablespace; in particular, all the non-shared
3035 system catalogs will be there.
3036 </para></entry>
3037 </row>
3039 <row>
3040 <entry role="catalog_table_entry"><para role="column_definition">
3041 <structfield>datacl</structfield> <type>aclitem[]</type>
3042 </para>
3043 <para>
3044 Access privileges; see <xref linkend="ddl-priv"/> for details
3045 </para></entry>
3046 </row>
3047 </tbody>
3048 </tgroup>
3049 </table>
3050 </sect1>
3053 <sect1 id="catalog-pg-db-role-setting">
3054 <title><structname>pg_db_role_setting</structname></title>
3056 <indexterm zone="catalog-pg-db-role-setting">
3057 <primary>pg_db_role_setting</primary>
3058 </indexterm>
3060 <para>
3061 The catalog <structname>pg_db_role_setting</structname> records the default
3062 values that have been set for run-time configuration variables,
3063 for each role and database combination.
3064 </para>
3066 <para>
3067 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
3068 is shared across all databases of a cluster: there is only one
3069 copy of <structname>pg_db_role_setting</structname> per cluster, not
3070 one per database.
3071 </para>
3073 <table>
3074 <title><structname>pg_db_role_setting</structname> Columns</title>
3075 <tgroup cols="1">
3076 <thead>
3077 <row>
3078 <entry role="catalog_table_entry"><para role="column_definition">
3079 Column Type
3080 </para>
3081 <para>
3082 Description
3083 </para></entry>
3084 </row>
3085 </thead>
3087 <tbody>
3088 <row>
3089 <entry role="catalog_table_entry"><para role="column_definition">
3090 <structfield>setdatabase</structfield> <type>oid</type>
3091 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
3092 </para>
3093 <para>
3094 The OID of the database the setting is applicable to, or zero if not database-specific
3095 </para></entry>
3096 </row>
3098 <row>
3099 <entry role="catalog_table_entry"><para role="column_definition">
3100 <structfield>setrole</structfield> <type>oid</type>
3101 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3102 </para>
3103 <para>
3104 The OID of the role the setting is applicable to, or zero if not role-specific
3105 </para></entry>
3106 </row>
3108 <row>
3109 <entry role="catalog_table_entry"><para role="column_definition">
3110 <structfield>setconfig</structfield> <type>text[]</type>
3111 </para>
3112 <para>
3113 Defaults for run-time configuration variables
3114 </para></entry>
3115 </row>
3116 </tbody>
3117 </tgroup>
3118 </table>
3119 </sect1>
3122 <sect1 id="catalog-pg-default-acl">
3123 <title><structname>pg_default_acl</structname></title>
3125 <indexterm zone="catalog-pg-default-acl">
3126 <primary>pg_default_acl</primary>
3127 </indexterm>
3129 <para>
3130 The catalog <structname>pg_default_acl</structname> stores initial
3131 privileges to be assigned to newly created objects.
3132 </para>
3134 <table>
3135 <title><structname>pg_default_acl</structname> Columns</title>
3136 <tgroup cols="1">
3137 <thead>
3138 <row>
3139 <entry role="catalog_table_entry"><para role="column_definition">
3140 Column Type
3141 </para>
3142 <para>
3143 Description
3144 </para></entry>
3145 </row>
3146 </thead>
3148 <tbody>
3149 <row>
3150 <entry role="catalog_table_entry"><para role="column_definition">
3151 <structfield>oid</structfield> <type>oid</type>
3152 </para>
3153 <para>
3154 Row identifier
3155 </para></entry>
3156 </row>
3158 <row>
3159 <entry role="catalog_table_entry"><para role="column_definition">
3160 <structfield>defaclrole</structfield> <type>oid</type>
3161 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3162 </para>
3163 <para>
3164 The OID of the role associated with this entry
3165 </para></entry>
3166 </row>
3168 <row>
3169 <entry role="catalog_table_entry"><para role="column_definition">
3170 <structfield>defaclnamespace</structfield> <type>oid</type>
3171 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
3172 </para>
3173 <para>
3174 The OID of the namespace associated with this entry,
3175 or zero if none
3176 </para></entry>
3177 </row>
3179 <row>
3180 <entry role="catalog_table_entry"><para role="column_definition">
3181 <structfield>defaclobjtype</structfield> <type>char</type>
3182 </para>
3183 <para>
3184 Type of object this entry is for:
3185 <literal>r</literal> = relation (table, view),
3186 <literal>S</literal> = sequence,
3187 <literal>f</literal> = function,
3188 <literal>T</literal> = type,
3189 <literal>n</literal> = schema
3190 </para></entry>
3191 </row>
3193 <row>
3194 <entry role="catalog_table_entry"><para role="column_definition">
3195 <structfield>defaclacl</structfield> <type>aclitem[]</type>
3196 </para>
3197 <para>
3198 Access privileges that this type of object should have on creation
3199 </para></entry>
3200 </row>
3201 </tbody>
3202 </tgroup>
3203 </table>
3205 <para>
3206 A <structname>pg_default_acl</structname> entry shows the initial privileges to
3207 be assigned to an object belonging to the indicated user. There are
3208 currently two types of entry: <quote>global</quote> entries with
3209 <structfield>defaclnamespace</structfield> = zero, and <quote>per-schema</quote> entries
3210 that reference a particular schema. If a global entry is present then
3211 it <emphasis>overrides</emphasis> the normal hard-wired default privileges
3212 for the object type. A per-schema entry, if present, represents privileges
3213 to be <emphasis>added to</emphasis> the global or hard-wired default privileges.
3214 </para>
3216 <para>
3217 Note that when an ACL entry in another catalog is null, it is taken
3218 to represent the hard-wired default privileges for its object,
3219 <emphasis>not</emphasis> whatever might be in <structname>pg_default_acl</structname>
3220 at the moment. <structname>pg_default_acl</structname> is only consulted during
3221 object creation.
3222 </para>
3224 </sect1>
3227 <sect1 id="catalog-pg-depend">
3228 <title><structname>pg_depend</structname></title>
3230 <indexterm zone="catalog-pg-depend">
3231 <primary>pg_depend</primary>
3232 </indexterm>
3234 <para>
3235 The catalog <structname>pg_depend</structname> records the dependency
3236 relationships between database objects. This information allows
3237 <command>DROP</command> commands to find which other objects must be dropped
3238 by <command>DROP CASCADE</command> or prevent dropping in the <command>DROP
3239 RESTRICT</command> case.
3240 </para>
3242 <para>
3243 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
3244 which performs a similar function for dependencies involving objects
3245 that are shared across a database cluster.
3246 </para>
3248 <table>
3249 <title><structname>pg_depend</structname> Columns</title>
3250 <tgroup cols="1">
3251 <thead>
3252 <row>
3253 <entry role="catalog_table_entry"><para role="column_definition">
3254 Column Type
3255 </para>
3256 <para>
3257 Description
3258 </para></entry>
3259 </row>
3260 </thead>
3262 <tbody>
3263 <row>
3264 <entry role="catalog_table_entry"><para role="column_definition">
3265 <structfield>classid</structfield> <type>oid</type>
3266 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3267 </para>
3268 <para>
3269 The OID of the system catalog the dependent object is in
3270 </para></entry>
3271 </row>
3273 <row>
3274 <entry role="catalog_table_entry"><para role="column_definition">
3275 <structfield>objid</structfield> <type>oid</type>
3276 (references any OID column)
3277 </para>
3278 <para>
3279 The OID of the specific dependent object
3280 </para></entry>
3281 </row>
3283 <row>
3284 <entry role="catalog_table_entry"><para role="column_definition">
3285 <structfield>objsubid</structfield> <type>int4</type>
3286 </para>
3287 <para>
3288 For a table column, this is the column number (the
3289 <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
3290 table itself). For all other object types, this column is
3291 zero.
3292 </para></entry>
3293 </row>
3295 <row>
3296 <entry role="catalog_table_entry"><para role="column_definition">
3297 <structfield>refclassid</structfield> <type>oid</type>
3298 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3299 </para>
3300 <para>
3301 The OID of the system catalog the referenced object is in
3302 </para></entry>
3303 </row>
3305 <row>
3306 <entry role="catalog_table_entry"><para role="column_definition">
3307 <structfield>refobjid</structfield> <type>oid</type>
3308 (references any OID column)
3309 </para>
3310 <para>
3311 The OID of the specific referenced object
3312 </para></entry>
3313 </row>
3315 <row>
3316 <entry role="catalog_table_entry"><para role="column_definition">
3317 <structfield>refobjsubid</structfield> <type>int4</type>
3318 </para>
3319 <para>
3320 For a table column, this is the column number (the
3321 <structfield>refobjid</structfield> and <structfield>refclassid</structfield> refer
3322 to the table itself). For all other object types, this column
3323 is zero.
3324 </para></entry>
3325 </row>
3327 <row>
3328 <entry role="catalog_table_entry"><para role="column_definition">
3329 <structfield>deptype</structfield> <type>char</type>
3330 </para>
3331 <para>
3332 A code defining the specific semantics of this dependency relationship; see text
3333 </para></entry>
3334 </row>
3335 </tbody>
3336 </tgroup>
3337 </table>
3339 <para>
3340 In all cases, a <structname>pg_depend</structname> entry indicates that the
3341 referenced object cannot be dropped without also dropping the dependent
3342 object. However, there are several subflavors identified by
3343 <structfield>deptype</structfield>:
3345 <variablelist>
3346 <varlistentry>
3347 <term><symbol>DEPENDENCY_NORMAL</symbol> (<literal>n</literal>)</term>
3348 <listitem>
3349 <para>
3350 A normal relationship between separately-created objects. The
3351 dependent object can be dropped without affecting the
3352 referenced object. The referenced object can only be dropped
3353 by specifying <literal>CASCADE</literal>, in which case the dependent
3354 object is dropped, too. Example: a table column has a normal
3355 dependency on its data type.
3356 </para>
3357 </listitem>
3358 </varlistentry>
3360 <varlistentry>
3361 <term><symbol>DEPENDENCY_AUTO</symbol> (<literal>a</literal>)</term>
3362 <listitem>
3363 <para>
3364 The dependent object can be dropped separately from the
3365 referenced object, and should be automatically dropped
3366 (regardless of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
3367 mode) if the referenced object is dropped. Example: a named
3368 constraint on a table is made auto-dependent on the table, so
3369 that it will go away if the table is dropped.
3370 </para>
3371 </listitem>
3372 </varlistentry>
3374 <varlistentry>
3375 <term><symbol>DEPENDENCY_INTERNAL</symbol> (<literal>i</literal>)</term>
3376 <listitem>
3377 <para>
3378 The dependent object was created as part of creation of the
3379 referenced object, and is really just a part of its internal
3380 implementation. A direct <command>DROP</command> of the dependent
3381 object will be disallowed outright (we'll tell the user to issue
3382 a <command>DROP</command> against the referenced object, instead).
3383 A <command>DROP</command> of the referenced object will result in
3384 automatically dropping the dependent object
3385 whether <literal>CASCADE</literal> is specified or not. If the
3386 dependent object has to be dropped due to a dependency on some other
3387 object being removed, its drop is converted to a drop of the referenced
3388 object, so that <literal>NORMAL</literal> and <literal>AUTO</literal>
3389 dependencies of the dependent object behave much like they were
3390 dependencies of the referenced object.
3391 Example: a view's <literal>ON SELECT</literal> rule is made
3392 internally dependent on the view, preventing it from being dropped
3393 while the view remains. Dependencies of the rule (such as tables it
3394 refers to) act as if they were dependencies of the view.
3395 </para>
3396 </listitem>
3397 </varlistentry>
3399 <varlistentry>
3400 <term><symbol>DEPENDENCY_PARTITION_PRI</symbol> (<literal>P</literal>)</term>
3401 <term><symbol>DEPENDENCY_PARTITION_SEC</symbol> (<literal>S</literal>)</term>
3402 <listitem>
3403 <para>
3404 The dependent object was created as part of creation of the
3405 referenced object, and is really just a part of its internal
3406 implementation; however, unlike <literal>INTERNAL</literal>,
3407 there is more than one such referenced object. The dependent object
3408 must not be dropped unless at least one of these referenced objects
3409 is dropped; if any one is, the dependent object should be dropped
3410 whether or not <literal>CASCADE</literal> is specified. Also
3411 unlike <literal>INTERNAL</literal>, a drop of some other object
3412 that the dependent object depends on does not result in automatic
3413 deletion of any partition-referenced object. Hence, if the drop
3414 does not cascade to at least one of these objects via some other
3415 path, it will be refused. (In most cases, the dependent object
3416 shares all its non-partition dependencies with at least one
3417 partition-referenced object, so that this restriction does not
3418 result in blocking any cascaded delete.)
3419 Primary and secondary partition dependencies behave identically
3420 except that the primary dependency is preferred for use in error
3421 messages; hence, a partition-dependent object should have one
3422 primary partition dependency and one or more secondary partition
3423 dependencies.
3424 Note that partition dependencies are made in addition to, not
3425 instead of, any dependencies the object would normally have. This
3426 simplifies <command>ATTACH/DETACH PARTITION</command> operations:
3427 the partition dependencies need only be added or removed.
3428 Example: a child partitioned index is made partition-dependent
3429 on both the partition table it is on and the parent partitioned
3430 index, so that it goes away if either of those is dropped, but
3431 not otherwise. The dependency on the parent index is primary,
3432 so that if the user tries to drop the child partitioned index,
3433 the error message will suggest dropping the parent index instead
3434 (not the table).
3435 </para>
3436 </listitem>
3437 </varlistentry>
3439 <varlistentry>
3440 <term><symbol>DEPENDENCY_EXTENSION</symbol> (<literal>e</literal>)</term>
3441 <listitem>
3442 <para>
3443 The dependent object is a member of the <firstterm>extension</firstterm> that is
3444 the referenced object (see
3445 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3446 The dependent object can be dropped only via
3447 <link linkend="sql-dropextension"><command>DROP EXTENSION</command></link> on the referenced object.
3448 Functionally this dependency type acts the same as
3449 an <literal>INTERNAL</literal> dependency, but it's kept separate for
3450 clarity and to simplify <application>pg_dump</application>.
3451 </para>
3452 </listitem>
3453 </varlistentry>
3455 <varlistentry>
3456 <term><symbol>DEPENDENCY_AUTO_EXTENSION</symbol> (<literal>x</literal>)</term>
3457 <listitem>
3458 <para>
3459 The dependent object is not a member of the extension that is the
3460 referenced object (and so it should not be ignored
3461 by <application>pg_dump</application>), but it cannot function
3462 without the extension and should be auto-dropped if the extension is.
3463 The dependent object may be dropped on its own as well.
3464 Functionally this dependency type acts the same as
3465 an <literal>AUTO</literal> dependency, but it's kept separate for
3466 clarity and to simplify <application>pg_dump</application>.
3467 </para>
3468 </listitem>
3469 </varlistentry>
3470 </variablelist>
3472 Other dependency flavors might be needed in future.
3473 </para>
3475 <para>
3476 Note that it's quite possible for two objects to be linked by more than
3477 one <structname>pg_depend</structname> entry. For example, a child
3478 partitioned index would have both a partition-type dependency on its
3479 associated partition table, and an auto dependency on each column of
3480 that table that it indexes. This sort of situation expresses the union
3481 of multiple dependency semantics. A dependent object can be dropped
3482 without <literal>CASCADE</literal> if any of its dependencies satisfies
3483 its condition for automatic dropping. Conversely, all the
3484 dependencies' restrictions about which objects must be dropped together
3485 must be satisfied.
3486 </para>
3488 <para>
3489 Most objects created during <application>initdb</application> are
3490 considered <quote>pinned</quote>, which means that the system itself
3491 depends on them. Therefore, they are never allowed to be dropped.
3492 Also, knowing that pinned objects will not be dropped, the dependency
3493 mechanism doesn't bother to make <structname>pg_depend</structname>
3494 entries showing dependencies on them. Thus, for example, a table
3495 column of type <type>numeric</type> notionally has
3496 a <literal>NORMAL</literal> dependency on the <type>numeric</type>
3497 data type, but no such entry actually appears
3498 in <structname>pg_depend</structname>.
3499 </para>
3501 </sect1>
3504 <sect1 id="catalog-pg-description">
3505 <title><structname>pg_description</structname></title>
3507 <indexterm zone="catalog-pg-description">
3508 <primary>pg_description</primary>
3509 </indexterm>
3511 <para>
3512 The catalog <structname>pg_description</structname> stores optional descriptions
3513 (comments) for each database object. Descriptions can be manipulated
3514 with the <link linkend="sql-comment"><command>COMMENT</command></link> command and viewed with
3515 <application>psql</application>'s <literal>\d</literal> commands.
3516 Descriptions of many built-in system objects are provided in the initial
3517 contents of <structname>pg_description</structname>.
3518 </para>
3520 <para>
3521 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3522 which performs a similar function for descriptions involving objects that
3523 are shared across a database cluster.
3524 </para>
3526 <table>
3527 <title><structname>pg_description</structname> Columns</title>
3528 <tgroup cols="1">
3529 <thead>
3530 <row>
3531 <entry role="catalog_table_entry"><para role="column_definition">
3532 Column Type
3533 </para>
3534 <para>
3535 Description
3536 </para></entry>
3537 </row>
3538 </thead>
3540 <tbody>
3541 <row>
3542 <entry role="catalog_table_entry"><para role="column_definition">
3543 <structfield>objoid</structfield> <type>oid</type>
3544 (references any OID column)
3545 </para>
3546 <para>
3547 The OID of the object this description pertains to
3548 </para></entry>
3549 </row>
3551 <row>
3552 <entry role="catalog_table_entry"><para role="column_definition">
3553 <structfield>classoid</structfield> <type>oid</type>
3554 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3555 </para>
3556 <para>
3557 The OID of the system catalog this object appears in
3558 </para></entry>
3559 </row>
3561 <row>
3562 <entry role="catalog_table_entry"><para role="column_definition">
3563 <structfield>objsubid</structfield> <type>int4</type>
3564 </para>
3565 <para>
3566 For a comment on a table column, this is the column number (the
3567 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
3568 the table itself). For all other object types, this column is
3569 zero.
3570 </para></entry>
3571 </row>
3573 <row>
3574 <entry role="catalog_table_entry"><para role="column_definition">
3575 <structfield>description</structfield> <type>text</type>
3576 </para>
3577 <para>
3578 Arbitrary text that serves as the description of this object
3579 </para></entry>
3580 </row>
3581 </tbody>
3582 </tgroup>
3583 </table>
3585 </sect1>
3588 <sect1 id="catalog-pg-enum">
3589 <title><structname>pg_enum</structname></title>
3591 <indexterm zone="catalog-pg-enum">
3592 <primary>pg_enum</primary>
3593 </indexterm>
3595 <para>
3596 The <structname>pg_enum</structname> catalog contains entries
3597 showing the values and labels for each enum type. The
3598 internal representation of a given enum value is actually the OID
3599 of its associated row in <structname>pg_enum</structname>.
3600 </para>
3602 <table>
3603 <title><structname>pg_enum</structname> Columns</title>
3604 <tgroup cols="1">
3605 <thead>
3606 <row>
3607 <entry role="catalog_table_entry"><para role="column_definition">
3608 Column Type
3609 </para>
3610 <para>
3611 Description
3612 </para></entry>
3613 </row>
3614 </thead>
3616 <tbody>
3617 <row>
3618 <entry role="catalog_table_entry"><para role="column_definition">
3619 <structfield>oid</structfield> <type>oid</type>
3620 </para>
3621 <para>
3622 Row identifier
3623 </para></entry>
3624 </row>
3626 <row>
3627 <entry role="catalog_table_entry"><para role="column_definition">
3628 <structfield>enumtypid</structfield> <type>oid</type>
3629 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
3630 </para>
3631 <para>
3632 The OID of the <link linkend="catalog-pg-type"><structname>pg_type</structname></link> entry owning this enum value
3633 </para></entry>
3634 </row>
3636 <row>
3637 <entry role="catalog_table_entry"><para role="column_definition">
3638 <structfield>enumsortorder</structfield> <type>float4</type>
3639 </para>
3640 <para>
3641 The sort position of this enum value within its enum type
3642 </para></entry>
3643 </row>
3645 <row>
3646 <entry role="catalog_table_entry"><para role="column_definition">
3647 <structfield>enumlabel</structfield> <type>name</type>
3648 </para>
3649 <para>
3650 The textual label for this enum value
3651 </para></entry>
3652 </row>
3653 </tbody>
3654 </tgroup>
3655 </table>
3657 <para>
3658 The OIDs for <structname>pg_enum</structname> rows follow a special
3659 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3660 as the sort ordering of their enum type. That is, if two even OIDs
3661 belong to the same enum type, the smaller OID must have the smaller
3662 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3663 need bear no relationship to the sort order. This rule allows the
3664 enum comparison routines to avoid catalog lookups in many common cases.
3665 The routines that create and alter enum types attempt to assign even
3666 OIDs to enum values whenever possible.
3667 </para>
3669 <para>
3670 When an enum type is created, its members are assigned sort-order
3671 positions 1..<replaceable>n</replaceable>. But members added later might be given
3672 negative or fractional values of <structfield>enumsortorder</structfield>.
3673 The only requirement on these values is that they be correctly
3674 ordered and unique within each enum type.
3675 </para>
3676 </sect1>
3679 <sect1 id="catalog-pg-event-trigger">
3680 <title><structname>pg_event_trigger</structname></title>
3682 <indexterm zone="catalog-pg-event-trigger">
3683 <primary>pg_event_trigger</primary>
3684 </indexterm>
3686 <para>
3687 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3688 See <xref linkend="event-triggers"/> for more information.
3689 </para>
3691 <table>
3692 <title><structname>pg_event_trigger</structname> Columns</title>
3693 <tgroup cols="1">
3694 <thead>
3695 <row>
3696 <entry role="catalog_table_entry"><para role="column_definition">
3697 Column Type
3698 </para>
3699 <para>
3700 Description
3701 </para></entry>
3702 </row>
3703 </thead>
3705 <tbody>
3706 <row>
3707 <entry role="catalog_table_entry"><para role="column_definition">
3708 <structfield>oid</structfield> <type>oid</type>
3709 </para>
3710 <para>
3711 Row identifier
3712 </para></entry>
3713 </row>
3715 <row>
3716 <entry role="catalog_table_entry"><para role="column_definition">
3717 <structfield>evtname</structfield> <type>name</type>
3718 </para>
3719 <para>
3720 Trigger name (must be unique)
3721 </para></entry>
3722 </row>
3724 <row>
3725 <entry role="catalog_table_entry"><para role="column_definition">
3726 <structfield>evtevent</structfield> <type>name</type>
3727 </para>
3728 <para>
3729 Identifies the event for which this trigger fires
3730 </para></entry>
3731 </row>
3733 <row>
3734 <entry role="catalog_table_entry"><para role="column_definition">
3735 <structfield>evtowner</structfield> <type>oid</type>
3736 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3737 </para>
3738 <para>
3739 Owner of the event trigger
3740 </para></entry>
3741 </row>
3743 <row>
3744 <entry role="catalog_table_entry"><para role="column_definition">
3745 <structfield>evtfoid</structfield> <type>oid</type>
3746 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
3747 </para>
3748 <para>
3749 The function to be called
3750 </para></entry>
3751 </row>
3753 <row>
3754 <entry role="catalog_table_entry"><para role="column_definition">
3755 <structfield>evtenabled</structfield> <type>char</type>
3756 </para>
3757 <para>
3758 Controls in which <xref linkend="guc-session-replication-role"/> modes
3759 the event trigger fires.
3760 <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
3761 <literal>D</literal> = trigger is disabled,
3762 <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
3763 <literal>A</literal> = trigger fires always.
3764 </para></entry>
3765 </row>
3767 <row>
3768 <entry role="catalog_table_entry"><para role="column_definition">
3769 <structfield>evttags</structfield> <type>text[]</type>
3770 </para>
3771 <para>
3772 Command tags for which this trigger will fire. If NULL, the firing
3773 of this trigger is not restricted on the basis of the command tag.
3774 </para></entry>
3775 </row>
3776 </tbody>
3777 </tgroup>
3778 </table>
3779 </sect1>
3782 <sect1 id="catalog-pg-extension">
3783 <title><structname>pg_extension</structname></title>
3785 <indexterm zone="catalog-pg-extension">
3786 <primary>pg_extension</primary>
3787 </indexterm>
3789 <para>
3790 The catalog <structname>pg_extension</structname> stores information
3791 about the installed extensions. See <xref linkend="extend-extensions"/>
3792 for details about extensions.
3793 </para>
3795 <table>
3796 <title><structname>pg_extension</structname> Columns</title>
3797 <tgroup cols="1">
3798 <thead>
3799 <row>
3800 <entry role="catalog_table_entry"><para role="column_definition">
3801 Column Type
3802 </para>
3803 <para>
3804 Description
3805 </para></entry>
3806 </row>
3807 </thead>
3809 <tbody>
3810 <row>
3811 <entry role="catalog_table_entry"><para role="column_definition">
3812 <structfield>oid</structfield> <type>oid</type>
3813 </para>
3814 <para>
3815 Row identifier
3816 </para></entry>
3817 </row>
3819 <row>
3820 <entry role="catalog_table_entry"><para role="column_definition">
3821 <structfield>extname</structfield> <type>name</type>
3822 </para>
3823 <para>
3824 Name of the extension
3825 </para></entry>
3826 </row>
3828 <row>
3829 <entry role="catalog_table_entry"><para role="column_definition">
3830 <structfield>extowner</structfield> <type>oid</type>
3831 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3832 </para>
3833 <para>
3834 Owner of the extension
3835 </para></entry>
3836 </row>
3838 <row>
3839 <entry role="catalog_table_entry"><para role="column_definition">
3840 <structfield>extnamespace</structfield> <type>oid</type>
3841 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
3842 </para>
3843 <para>
3844 Schema containing the extension's exported objects
3845 </para></entry>
3846 </row>
3848 <row>
3849 <entry role="catalog_table_entry"><para role="column_definition">
3850 <structfield>extrelocatable</structfield> <type>bool</type>
3851 </para>
3852 <para>
3853 True if extension can be relocated to another schema
3854 </para></entry>
3855 </row>
3857 <row>
3858 <entry role="catalog_table_entry"><para role="column_definition">
3859 <structfield>extversion</structfield> <type>text</type>
3860 </para>
3861 <para>
3862 Version name for the extension
3863 </para></entry>
3864 </row>
3866 <row>
3867 <entry role="catalog_table_entry"><para role="column_definition">
3868 <structfield>extconfig</structfield> <type>oid[]</type>
3869 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3870 </para>
3871 <para>
3872 Array of <type>regclass</type> OIDs for the extension's configuration
3873 table(s), or <literal>NULL</literal> if none
3874 </para></entry>
3875 </row>
3877 <row>
3878 <entry role="catalog_table_entry"><para role="column_definition">
3879 <structfield>extcondition</structfield> <type>text[]</type>
3880 </para>
3881 <para>
3882 Array of <literal>WHERE</literal>-clause filter conditions for the
3883 extension's configuration table(s), or <literal>NULL</literal> if none
3884 </para></entry>
3885 </row>
3886 </tbody>
3887 </tgroup>
3888 </table>
3890 <para>
3891 Note that unlike most catalogs with a <quote>namespace</quote> column,
3892 <structfield>extnamespace</structfield> is not meant to imply
3893 that the extension belongs to that schema. Extension names are never
3894 schema-qualified. Rather, <structfield>extnamespace</structfield>
3895 indicates the schema that contains most or all of the extension's
3896 objects. If <structfield>extrelocatable</structfield> is true, then
3897 this schema must in fact contain all schema-qualifiable objects
3898 belonging to the extension.
3899 </para>
3900 </sect1>
3903 <sect1 id="catalog-pg-foreign-data-wrapper">
3904 <title><structname>pg_foreign_data_wrapper</structname></title>
3906 <indexterm zone="catalog-pg-foreign-data-wrapper">
3907 <primary>pg_foreign_data_wrapper</primary>
3908 </indexterm>
3910 <para>
3911 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3912 foreign-data wrapper definitions. A foreign-data wrapper is the
3913 mechanism by which external data, residing on foreign servers, is
3914 accessed.
3915 </para>
3917 <table>
3918 <title><structname>pg_foreign_data_wrapper</structname> Columns</title>
3919 <tgroup cols="1">
3920 <thead>
3921 <row>
3922 <entry role="catalog_table_entry"><para role="column_definition">
3923 Column Type
3924 </para>
3925 <para>
3926 Description
3927 </para></entry>
3928 </row>
3929 </thead>
3931 <tbody>
3932 <row>
3933 <entry role="catalog_table_entry"><para role="column_definition">
3934 <structfield>oid</structfield> <type>oid</type>
3935 </para>
3936 <para>
3937 Row identifier
3938 </para></entry>
3939 </row>
3941 <row>
3942 <entry role="catalog_table_entry"><para role="column_definition">
3943 <structfield>fdwname</structfield> <type>name</type>
3944 </para>
3945 <para>
3946 Name of the foreign-data wrapper
3947 </para></entry>
3948 </row>
3950 <row>
3951 <entry role="catalog_table_entry"><para role="column_definition">
3952 <structfield>fdwowner</structfield> <type>oid</type>
3953 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3954 </para>
3955 <para>
3956 Owner of the foreign-data wrapper
3957 </para></entry>
3958 </row>
3960 <row>
3961 <entry role="catalog_table_entry"><para role="column_definition">
3962 <structfield>fdwhandler</structfield> <type>oid</type>
3963 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
3964 </para>
3965 <para>
3966 References a handler function that is responsible for
3967 supplying execution routines for the foreign-data wrapper.
3968 Zero if no handler is provided
3969 </para></entry>
3970 </row>
3972 <row>
3973 <entry role="catalog_table_entry"><para role="column_definition">
3974 <structfield>fdwvalidator</structfield> <type>oid</type>
3975 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
3976 </para>
3977 <para>
3978 References a validator function that is responsible for
3979 checking the validity of the options given to the
3980 foreign-data wrapper, as well as options for foreign servers and user
3981 mappings using the foreign-data wrapper. Zero if no validator
3982 is provided
3983 </para></entry>
3984 </row>
3986 <row>
3987 <entry role="catalog_table_entry"><para role="column_definition">
3988 <structfield>fdwacl</structfield> <type>aclitem[]</type>
3989 </para>
3990 <para>
3991 Access privileges; see <xref linkend="ddl-priv"/> for details
3992 </para></entry>
3993 </row>
3995 <row>
3996 <entry role="catalog_table_entry"><para role="column_definition">
3997 <structfield>fdwoptions</structfield> <type>text[]</type>
3998 </para>
3999 <para>
4000 Foreign-data wrapper specific options, as <quote>keyword=value</quote> strings
4001 </para></entry>
4002 </row>
4003 </tbody>
4004 </tgroup>
4005 </table>
4006 </sect1>
4009 <sect1 id="catalog-pg-foreign-server">
4010 <title><structname>pg_foreign_server</structname></title>
4012 <indexterm zone="catalog-pg-foreign-server">
4013 <primary>pg_foreign_server</primary>
4014 </indexterm>
4016 <para>
4017 The catalog <structname>pg_foreign_server</structname> stores
4018 foreign server definitions. A foreign server describes a source
4019 of external data, such as a remote server. Foreign
4020 servers are accessed via foreign-data wrappers.
4021 </para>
4023 <table>
4024 <title><structname>pg_foreign_server</structname> Columns</title>
4025 <tgroup cols="1">
4026 <thead>
4027 <row>
4028 <entry role="catalog_table_entry"><para role="column_definition">
4029 Column Type
4030 </para>
4031 <para>
4032 Description
4033 </para></entry>
4034 </row>
4035 </thead>
4037 <tbody>
4038 <row>
4039 <entry role="catalog_table_entry"><para role="column_definition">
4040 <structfield>oid</structfield> <type>oid</type>
4041 </para>
4042 <para>
4043 Row identifier
4044 </para></entry>
4045 </row>
4047 <row>
4048 <entry role="catalog_table_entry"><para role="column_definition">
4049 <structfield>srvname</structfield> <type>name</type>
4050 </para>
4051 <para>
4052 Name of the foreign server
4053 </para></entry>
4054 </row>
4056 <row>
4057 <entry role="catalog_table_entry"><para role="column_definition">
4058 <structfield>srvowner</structfield> <type>oid</type>
4059 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4060 </para>
4061 <para>
4062 Owner of the foreign server
4063 </para></entry>
4064 </row>
4066 <row>
4067 <entry role="catalog_table_entry"><para role="column_definition">
4068 <structfield>srvfdw</structfield> <type>oid</type>
4069 (references <link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.<structfield>oid</structfield>)
4070 </para>
4071 <para>
4072 OID of the foreign-data wrapper of this foreign server
4073 </para></entry>
4074 </row>
4076 <row>
4077 <entry role="catalog_table_entry"><para role="column_definition">
4078 <structfield>srvtype</structfield> <type>text</type>
4079 </para>
4080 <para>
4081 Type of the server (optional)
4082 </para></entry>
4083 </row>
4085 <row>
4086 <entry role="catalog_table_entry"><para role="column_definition">
4087 <structfield>srvversion</structfield> <type>text</type>
4088 </para>
4089 <para>
4090 Version of the server (optional)
4091 </para></entry>
4092 </row>
4094 <row>
4095 <entry role="catalog_table_entry"><para role="column_definition">
4096 <structfield>srvacl</structfield> <type>aclitem[]</type>
4097 </para>
4098 <para>
4099 Access privileges; see <xref linkend="ddl-priv"/> for details
4100 </para></entry>
4101 </row>
4103 <row>
4104 <entry role="catalog_table_entry"><para role="column_definition">
4105 <structfield>srvoptions</structfield> <type>text[]</type>
4106 </para>
4107 <para>
4108 Foreign server specific options, as <quote>keyword=value</quote> strings
4109 </para></entry>
4110 </row>
4111 </tbody>
4112 </tgroup>
4113 </table>
4114 </sect1>
4117 <sect1 id="catalog-pg-foreign-table">
4118 <title><structname>pg_foreign_table</structname></title>
4120 <indexterm zone="catalog-pg-foreign-table">
4121 <primary>pg_foreign_table</primary>
4122 </indexterm>
4124 <para>
4125 The catalog <structname>pg_foreign_table</structname> contains
4126 auxiliary information about foreign tables. A foreign table is
4127 primarily represented by a
4128 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>
4129 entry, just like a regular table. Its <structname>pg_foreign_table</structname>
4130 entry contains the information that is pertinent only to foreign tables
4131 and not any other kind of relation.
4132 </para>
4134 <table>
4135 <title><structname>pg_foreign_table</structname> Columns</title>
4136 <tgroup cols="1">
4137 <thead>
4138 <row>
4139 <entry role="catalog_table_entry"><para role="column_definition">
4140 Column Type
4141 </para>
4142 <para>
4143 Description
4144 </para></entry>
4145 </row>
4146 </thead>
4148 <tbody>
4149 <row>
4150 <entry role="catalog_table_entry"><para role="column_definition">
4151 <structfield>ftrelid</structfield> <type>oid</type>
4152 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4153 </para>
4154 <para>
4155 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this foreign table
4156 </para></entry>
4157 </row>
4159 <row>
4160 <entry role="catalog_table_entry"><para role="column_definition">
4161 <structfield>ftserver</structfield> <type>oid</type>
4162 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
4163 </para>
4164 <para>
4165 OID of the foreign server for this foreign table
4166 </para></entry>
4167 </row>
4169 <row>
4170 <entry role="catalog_table_entry"><para role="column_definition">
4171 <structfield>ftoptions</structfield> <type>text[]</type>
4172 </para>
4173 <para>
4174 Foreign table options, as <quote>keyword=value</quote> strings
4175 </para></entry>
4176 </row>
4177 </tbody>
4178 </tgroup>
4179 </table>
4180 </sect1>
4183 <sect1 id="catalog-pg-index">
4184 <title><structname>pg_index</structname></title>
4186 <indexterm zone="catalog-pg-index">
4187 <primary>pg_index</primary>
4188 </indexterm>
4190 <para>
4191 The catalog <structname>pg_index</structname> contains part of the information
4192 about indexes. The rest is mostly in
4193 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.
4194 </para>
4196 <table>
4197 <title><structname>pg_index</structname> Columns</title>
4198 <tgroup cols="1">
4199 <thead>
4200 <row>
4201 <entry role="catalog_table_entry"><para role="column_definition">
4202 Column Type
4203 </para>
4204 <para>
4205 Description
4206 </para></entry>
4207 </row>
4208 </thead>
4210 <tbody>
4211 <row>
4212 <entry role="catalog_table_entry"><para role="column_definition">
4213 <structfield>indexrelid</structfield> <type>oid</type>
4214 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4215 </para>
4216 <para>
4217 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this index
4218 </para></entry>
4219 </row>
4221 <row>
4222 <entry role="catalog_table_entry"><para role="column_definition">
4223 <structfield>indrelid</structfield> <type>oid</type>
4224 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4225 </para>
4226 <para>
4227 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for the table this index is for
4228 </para></entry>
4229 </row>
4231 <row>
4232 <entry role="catalog_table_entry"><para role="column_definition">
4233 <structfield>indnatts</structfield> <type>int2</type>
4234 </para>
4235 <para>
4236 The total number of columns in the index (duplicates
4237 <literal>pg_class.relnatts</literal>); this number includes both key and included attributes
4238 </para></entry>
4239 </row>
4241 <row>
4242 <entry role="catalog_table_entry"><para role="column_definition">
4243 <structfield>indnkeyatts</structfield> <type>int2</type>
4244 </para>
4245 <para>
4246 The number of <firstterm>key columns</firstterm> in the index,
4247 not counting any <firstterm>included columns</firstterm>, which are
4248 merely stored and do not participate in the index semantics
4249 </para></entry>
4250 </row>
4252 <row>
4253 <entry role="catalog_table_entry"><para role="column_definition">
4254 <structfield>indisunique</structfield> <type>bool</type>
4255 </para>
4256 <para>
4257 If true, this is a unique index
4258 </para></entry>
4259 </row>
4261 <row>
4262 <entry role="catalog_table_entry"><para role="column_definition">
4263 <structfield>indisprimary</structfield> <type>bool</type>
4264 </para>
4265 <para>
4266 If true, this index represents the primary key of the table
4267 (<structfield>indisunique</structfield> should always be true when this is true)
4268 </para></entry>
4269 </row>
4271 <row>
4272 <entry role="catalog_table_entry"><para role="column_definition">
4273 <structfield>indisexclusion</structfield> <type>bool</type>
4274 </para>
4275 <para>
4276 If true, this index supports an exclusion constraint
4277 </para></entry>
4278 </row>
4280 <row>
4281 <entry role="catalog_table_entry"><para role="column_definition">
4282 <structfield>indimmediate</structfield> <type>bool</type>
4283 </para>
4284 <para>
4285 If true, the uniqueness check is enforced immediately on
4286 insertion
4287 (irrelevant if <structfield>indisunique</structfield> is not true)
4288 </para></entry>
4289 </row>
4291 <row>
4292 <entry role="catalog_table_entry"><para role="column_definition">
4293 <structfield>indisclustered</structfield> <type>bool</type>
4294 </para>
4295 <para>
4296 If true, the table was last clustered on this index
4297 </para></entry>
4298 </row>
4300 <row>
4301 <entry role="catalog_table_entry"><para role="column_definition">
4302 <structfield>indisvalid</structfield> <type>bool</type>
4303 </para>
4304 <para>
4305 If true, the index is currently valid for queries. False means the
4306 index is possibly incomplete: it must still be modified by
4307 <link linkend="sql-insert"><command>INSERT</command></link>/<link linkend="sql-update"><command>UPDATE</command></link> operations, but it cannot safely
4308 be used for queries. If it is unique, the uniqueness property is not
4309 guaranteed true either.
4310 </para></entry>
4311 </row>
4313 <row>
4314 <entry role="catalog_table_entry"><para role="column_definition">
4315 <structfield>indcheckxmin</structfield> <type>bool</type>
4316 </para>
4317 <para>
4318 If true, queries must not use the index until the <structfield>xmin</structfield>
4319 of this <structname>pg_index</structname> row is below their <symbol>TransactionXmin</symbol>
4320 event horizon, because the table may contain broken HOT chains with
4321 incompatible rows that they can see
4322 </para></entry>
4323 </row>
4325 <row>
4326 <entry role="catalog_table_entry"><para role="column_definition">
4327 <structfield>indisready</structfield> <type>bool</type>
4328 </para>
4329 <para>
4330 If true, the index is currently ready for inserts. False means the
4331 index must be ignored by <link linkend="sql-insert"><command>INSERT</command></link>/<link linkend="sql-update"><command>UPDATE</command></link>
4332 operations.
4333 </para></entry>
4334 </row>
4336 <row>
4337 <entry role="catalog_table_entry"><para role="column_definition">
4338 <structfield>indislive</structfield> <type>bool</type>
4339 </para>
4340 <para>
4341 If false, the index is in process of being dropped, and should be
4342 ignored for all purposes (including HOT-safety decisions)
4343 </para></entry>
4344 </row>
4346 <row>
4347 <entry role="catalog_table_entry"><para role="column_definition">
4348 <structfield>indisreplident</structfield> <type>bool</type>
4349 </para>
4350 <para>
4351 If true this index has been chosen as <quote>replica identity</quote>
4352 using <link linkend="sql-altertable-replica-identity"><command>ALTER TABLE ...
4353 REPLICA IDENTITY USING INDEX ...</command></link>
4354 </para></entry>
4355 </row>
4357 <row>
4358 <entry role="catalog_table_entry"><para role="column_definition">
4359 <structfield>indkey</structfield> <type>int2vector</type>
4360 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
4361 </para>
4362 <para>
4363 This is an array of <structfield>indnatts</structfield> values that
4364 indicate which table columns this index indexes. For example a value
4365 of <literal>1 3</literal> would mean that the first and the third table
4366 columns make up the index entries. Key columns come before non-key
4367 (included) columns. A zero in this array indicates that the
4368 corresponding index attribute is an expression over the table columns,
4369 rather than a simple column reference.
4370 </para></entry>
4371 </row>
4373 <row>
4374 <entry role="catalog_table_entry"><para role="column_definition">
4375 <structfield>indcollation</structfield> <type>oidvector</type>
4376 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
4377 </para>
4378 <para>
4379 For each column in the index key
4380 (<structfield>indnkeyatts</structfield> values), this contains the OID
4381 of the collation to use for the index, or zero if the column is not of
4382 a collatable data type.
4383 </para></entry>
4384 </row>
4386 <row>
4387 <entry role="catalog_table_entry"><para role="column_definition">
4388 <structfield>indclass</structfield> <type>oidvector</type>
4389 (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
4390 </para>
4391 <para>
4392 For each column in the index key
4393 (<structfield>indnkeyatts</structfield> values), this contains the OID
4394 of the operator class to use. See
4395 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4396 </para></entry>
4397 </row>
4399 <row>
4400 <entry role="catalog_table_entry"><para role="column_definition">
4401 <structfield>indoption</structfield> <type>int2vector</type>
4402 </para>
4403 <para>
4404 This is an array of <structfield>indnkeyatts</structfield> values that
4405 store per-column flag bits. The meaning of the bits is defined by
4406 the index's access method.
4407 </para></entry>
4408 </row>
4410 <row>
4411 <entry role="catalog_table_entry"><para role="column_definition">
4412 <structfield>indexprs</structfield> <type>pg_node_tree</type>
4413 </para>
4414 <para>
4415 Expression trees (in <function>nodeToString()</function>
4416 representation) for index attributes that are not simple column
4417 references. This is a list with one element for each zero
4418 entry in <structfield>indkey</structfield>. Null if all index attributes
4419 are simple references.
4420 </para></entry>
4421 </row>
4423 <row>
4424 <entry role="catalog_table_entry"><para role="column_definition">
4425 <structfield>indpred</structfield> <type>pg_node_tree</type>
4426 </para>
4427 <para>
4428 Expression tree (in <function>nodeToString()</function>
4429 representation) for partial index predicate. Null if not a
4430 partial index.
4431 </para></entry>
4432 </row>
4433 </tbody>
4434 </tgroup>
4435 </table>
4437 </sect1>
4440 <sect1 id="catalog-pg-inherits">
4441 <title><structname>pg_inherits</structname></title>
4443 <indexterm zone="catalog-pg-inherits">
4444 <primary>pg_inherits</primary>
4445 </indexterm>
4447 <para>
4448 The catalog <structname>pg_inherits</structname> records information about
4449 table and index inheritance hierarchies. There is one entry for each direct
4450 parent-child table or index relationship in the database. (Indirect
4451 inheritance can be determined by following chains of entries.)
4452 </para>
4454 <table>
4455 <title><structname>pg_inherits</structname> Columns</title>
4456 <tgroup cols="1">
4457 <thead>
4458 <row>
4459 <entry role="catalog_table_entry"><para role="column_definition">
4460 Column Type
4461 </para>
4462 <para>
4463 Description
4464 </para></entry>
4465 </row>
4466 </thead>
4468 <tbody>
4469 <row>
4470 <entry role="catalog_table_entry"><para role="column_definition">
4471 <structfield>inhrelid</structfield> <type>oid</type>
4472 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4473 </para>
4474 <para>
4475 The OID of the child table or index
4476 </para></entry>
4477 </row>
4479 <row>
4480 <entry role="catalog_table_entry"><para role="column_definition">
4481 <structfield>inhparent</structfield> <type>oid</type>
4482 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4483 </para>
4484 <para>
4485 The OID of the parent table or index
4486 </para></entry>
4487 </row>
4489 <row>
4490 <entry role="catalog_table_entry"><para role="column_definition">
4491 <structfield>inhseqno</structfield> <type>int4</type>
4492 </para>
4493 <para>
4494 If there is more than one direct parent for a child table (multiple
4495 inheritance), this number tells the order in which the
4496 inherited columns are to be arranged. The count starts at 1.
4497 </para>
4498 <para>
4499 Indexes cannot have multiple inheritance, since they can only inherit
4500 when using declarative partitioning.
4501 </para></entry>
4502 </row>
4504 <row>
4505 <entry role="catalog_table_entry"><para role="column_definition">
4506 <structfield>inhdetachpending</structfield> <type>bool</type>
4507 </para>
4508 <para>
4509 <literal>true</literal> for a partition that is in the process of
4510 being detached; <literal>false</literal> otherwise.
4511 </para></entry>
4512 </row>
4513 </tbody>
4514 </tgroup>
4515 </table>
4517 </sect1>
4519 <sect1 id="catalog-pg-init-privs">
4520 <title><structname>pg_init_privs</structname></title>
4522 <indexterm zone="catalog-pg-init-privs">
4523 <primary>pg_init_privs</primary>
4524 </indexterm>
4526 <para>
4527 The catalog <structname>pg_init_privs</structname> records information about
4528 the initial privileges of objects in the system. There is one entry
4529 for each object in the database which has a non-default (non-NULL)
4530 initial set of privileges.
4531 </para>
4533 <para>
4534 Objects can have initial privileges either by having those privileges set
4535 when the system is initialized (by <application>initdb</application>) or when the
4536 object is created during a <link linkend="sql-createextension"><command>CREATE EXTENSION</command></link> and the
4537 extension script sets initial privileges using the <link linkend="sql-grant"><command>GRANT</command></link>
4538 system. Note that the system will automatically handle recording of the
4539 privileges during the extension script and that extension authors need
4540 only use the <command>GRANT</command> and <command>REVOKE</command>
4541 statements in their script to have the privileges recorded. The
4542 <literal>privtype</literal> column indicates if the initial privilege was
4543 set by <application>initdb</application> or during a
4544 <command>CREATE EXTENSION</command> command.
4545 </para>
4547 <para>
4548 Objects which have initial privileges set by <application>initdb</application> will
4549 have entries where <literal>privtype</literal> is
4550 <literal>'i'</literal>, while objects which have initial privileges set
4551 by <command>CREATE EXTENSION</command> will have entries where
4552 <literal>privtype</literal> is <literal>'e'</literal>.
4553 </para>
4555 <table>
4556 <title><structname>pg_init_privs</structname> Columns</title>
4557 <tgroup cols="1">
4558 <thead>
4559 <row>
4560 <entry role="catalog_table_entry"><para role="column_definition">
4561 Column Type
4562 </para>
4563 <para>
4564 Description
4565 </para></entry>
4566 </row>
4567 </thead>
4569 <tbody>
4570 <row>
4571 <entry role="catalog_table_entry"><para role="column_definition">
4572 <structfield>objoid</structfield> <type>oid</type>
4573 (references any OID column)
4574 </para>
4575 <para>
4576 The OID of the specific object
4577 </para></entry>
4578 </row>
4580 <row>
4581 <entry role="catalog_table_entry"><para role="column_definition">
4582 <structfield>classoid</structfield> <type>oid</type>
4583 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4584 </para>
4585 <para>
4586 The OID of the system catalog the object is in
4587 </para></entry>
4588 </row>
4590 <row>
4591 <entry role="catalog_table_entry"><para role="column_definition">
4592 <structfield>objsubid</structfield> <type>int4</type>
4593 </para>
4594 <para>
4595 For a table column, this is the column number (the
4596 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to the
4597 table itself). For all other object types, this column is
4598 zero.
4599 </para></entry>
4600 </row>
4602 <row>
4603 <entry role="catalog_table_entry"><para role="column_definition">
4604 <structfield>privtype</structfield> <type>char</type>
4605 </para>
4606 <para>
4607 A code defining the type of initial privilege of this object; see text
4608 </para></entry>
4609 </row>
4611 <row>
4612 <entry role="catalog_table_entry"><para role="column_definition">
4613 <structfield>initprivs</structfield> <type>aclitem[]</type>
4614 </para>
4615 <para>
4616 The initial access privileges; see
4617 <xref linkend="ddl-priv"/> for details
4618 </para></entry>
4619 </row>
4620 </tbody>
4621 </tgroup>
4622 </table>
4624 </sect1>
4627 <sect1 id="catalog-pg-language">
4628 <title><structname>pg_language</structname></title>
4630 <indexterm zone="catalog-pg-language">
4631 <primary>pg_language</primary>
4632 </indexterm>
4634 <para>
4635 The catalog <structname>pg_language</structname> registers
4636 languages in which you can write functions or stored procedures.
4637 See <xref linkend="sql-createlanguage"/>
4638 and <xref linkend="xplang"/> for more information about language handlers.
4639 </para>
4641 <table>
4642 <title><structname>pg_language</structname> Columns</title>
4643 <tgroup cols="1">
4644 <thead>
4645 <row>
4646 <entry role="catalog_table_entry"><para role="column_definition">
4647 Column Type
4648 </para>
4649 <para>
4650 Description
4651 </para></entry>
4652 </row>
4653 </thead>
4655 <tbody>
4656 <row>
4657 <entry role="catalog_table_entry"><para role="column_definition">
4658 <structfield>oid</structfield> <type>oid</type>
4659 </para>
4660 <para>
4661 Row identifier
4662 </para></entry>
4663 </row>
4665 <row>
4666 <entry role="catalog_table_entry"><para role="column_definition">
4667 <structfield>lanname</structfield> <type>name</type>
4668 </para>
4669 <para>
4670 Name of the language
4671 </para></entry>
4672 </row>
4674 <row>
4675 <entry role="catalog_table_entry"><para role="column_definition">
4676 <structfield>lanowner</structfield> <type>oid</type>
4677 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4678 </para>
4679 <para>
4680 Owner of the language
4681 </para></entry>
4682 </row>
4684 <row>
4685 <entry role="catalog_table_entry"><para role="column_definition">
4686 <structfield>lanispl</structfield> <type>bool</type>
4687 </para>
4688 <para>
4689 This is false for internal languages (such as
4690 <acronym>SQL</acronym>) and true for user-defined languages.
4691 Currently, <application>pg_dump</application> still uses this
4692 to determine which languages need to be dumped, but this might be
4693 replaced by a different mechanism in the future.
4694 </para></entry>
4695 </row>
4697 <row>
4698 <entry role="catalog_table_entry"><para role="column_definition">
4699 <structfield>lanpltrusted</structfield> <type>bool</type>
4700 </para>
4701 <para>
4702 True if this is a trusted language, which means that it is believed
4703 not to grant access to anything outside the normal SQL execution
4704 environment. Only superusers can create functions in untrusted
4705 languages.
4706 </para></entry>
4707 </row>
4709 <row>
4710 <entry role="catalog_table_entry"><para role="column_definition">
4711 <structfield>lanplcallfoid</structfield> <type>oid</type>
4712 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4713 </para>
4714 <para>
4715 For noninternal languages this references the language
4716 handler, which is a special function that is responsible for
4717 executing all functions that are written in the particular
4718 language. Zero for internal languages.
4719 </para></entry>
4720 </row>
4722 <row>
4723 <entry role="catalog_table_entry"><para role="column_definition">
4724 <structfield>laninline</structfield> <type>oid</type>
4725 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4726 </para>
4727 <para>
4728 This references a function that is responsible for executing
4729 <quote>inline</quote> anonymous code blocks
4730 (<xref linkend="sql-do"/> blocks).
4731 Zero if inline blocks are not supported.
4732 </para></entry>
4733 </row>
4735 <row>
4736 <entry role="catalog_table_entry"><para role="column_definition">
4737 <structfield>lanvalidator</structfield> <type>oid</type>
4738 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4739 </para>
4740 <para>
4741 This references a language validator function that is responsible
4742 for checking the syntax and validity of new functions when they
4743 are created. Zero if no validator is provided.
4744 </para></entry>
4745 </row>
4747 <row>
4748 <entry role="catalog_table_entry"><para role="column_definition">
4749 <structfield>lanacl</structfield> <type>aclitem[]</type>
4750 </para>
4751 <para>
4752 Access privileges; see <xref linkend="ddl-priv"/> for details
4753 </para></entry>
4754 </row>
4755 </tbody>
4756 </tgroup>
4757 </table>
4759 </sect1>
4762 <sect1 id="catalog-pg-largeobject">
4763 <title><structname>pg_largeobject</structname></title>
4765 <indexterm zone="catalog-pg-largeobject">
4766 <primary>pg_largeobject</primary>
4767 </indexterm>
4769 <para>
4770 The catalog <structname>pg_largeobject</structname> holds the data making up
4771 <quote>large objects</quote>. A large object is identified by an OID
4772 assigned when it is created. Each large object is broken into
4773 segments or <quote>pages</quote> small enough to be conveniently stored as rows
4774 in <structname>pg_largeobject</structname>.
4775 The amount of data per page is defined to be <symbol>LOBLKSIZE</symbol> (which is currently
4776 <literal>BLCKSZ/4</literal>, or typically 2 kB).
4777 </para>
4779 <para>
4780 Prior to <productname>PostgreSQL</productname> 9.0, there was no permission structure
4781 associated with large objects. As a result,
4782 <structname>pg_largeobject</structname> was publicly readable and could be
4783 used to obtain the OIDs (and contents) of all large objects in the system.
4784 This is no longer the case; use
4785 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>
4786 to obtain a list of large object OIDs.
4787 </para>
4789 <table>
4790 <title><structname>pg_largeobject</structname> Columns</title>
4791 <tgroup cols="1">
4792 <thead>
4793 <row>
4794 <entry role="catalog_table_entry"><para role="column_definition">
4795 Column Type
4796 </para>
4797 <para>
4798 Description
4799 </para></entry>
4800 </row>
4801 </thead>
4803 <tbody>
4804 <row>
4805 <entry role="catalog_table_entry"><para role="column_definition">
4806 <structfield>loid</structfield> <type>oid</type>
4807 (references <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.<structfield>oid</structfield>)
4808 </para>
4809 <para>
4810 Identifier of the large object that includes this page
4811 </para></entry>
4812 </row>
4814 <row>
4815 <entry role="catalog_table_entry"><para role="column_definition">
4816 <structfield>pageno</structfield> <type>int4</type>
4817 </para>
4818 <para>
4819 Page number of this page within its large object
4820 (counting from zero)
4821 </para></entry>
4822 </row>
4824 <row>
4825 <entry role="catalog_table_entry"><para role="column_definition">
4826 <structfield>data</structfield> <type>bytea</type>
4827 </para>
4828 <para>
4829 Actual data stored in the large object.
4830 This will never be more than <symbol>LOBLKSIZE</symbol> bytes and might be less.
4831 </para></entry>
4832 </row>
4833 </tbody>
4834 </tgroup>
4835 </table>
4837 <para>
4838 Each row of <structname>pg_largeobject</structname> holds data
4839 for one page of a large object, beginning at
4840 byte offset (<literal>pageno * LOBLKSIZE</literal>) within the object. The implementation
4841 allows sparse storage: pages might be missing, and might be shorter than
4842 <literal>LOBLKSIZE</literal> bytes even if they are not the last page of the object.
4843 Missing regions within a large object read as zeroes.
4844 </para>
4846 </sect1>
4848 <sect1 id="catalog-pg-largeobject-metadata">
4849 <title><structname>pg_largeobject_metadata</structname></title>
4851 <indexterm zone="catalog-pg-largeobject-metadata">
4852 <primary>pg_largeobject_metadata</primary>
4853 </indexterm>
4855 <para>
4856 The catalog <structname>pg_largeobject_metadata</structname>
4857 holds metadata associated with large objects. The actual large object
4858 data is stored in
4859 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link>.
4860 </para>
4862 <table>
4863 <title><structname>pg_largeobject_metadata</structname> Columns</title>
4864 <tgroup cols="1">
4865 <thead>
4866 <row>
4867 <entry role="catalog_table_entry"><para role="column_definition">
4868 Column Type
4869 </para>
4870 <para>
4871 Description
4872 </para></entry>
4873 </row>
4874 </thead>
4876 <tbody>
4877 <row>
4878 <entry role="catalog_table_entry"><para role="column_definition">
4879 <structfield>oid</structfield> <type>oid</type>
4880 </para>
4881 <para>
4882 Row identifier
4883 </para></entry>
4884 </row>
4886 <row>
4887 <entry role="catalog_table_entry"><para role="column_definition">
4888 <structfield>lomowner</structfield> <type>oid</type>
4889 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4890 </para>
4891 <para>
4892 Owner of the large object
4893 </para></entry>
4894 </row>
4896 <row>
4897 <entry role="catalog_table_entry"><para role="column_definition">
4898 <structfield>lomacl</structfield> <type>aclitem[]</type>
4899 </para>
4900 <para>
4901 Access privileges; see <xref linkend="ddl-priv"/> for details
4902 </para></entry>
4903 </row>
4904 </tbody>
4905 </tgroup>
4906 </table>
4907 </sect1>
4910 <sect1 id="catalog-pg-namespace">
4911 <title><structname>pg_namespace</structname></title>
4913 <indexterm zone="catalog-pg-namespace">
4914 <primary>pg_namespace</primary>
4915 </indexterm>
4917 <para>
4918 The catalog <structname>pg_namespace</structname> stores namespaces.
4919 A namespace is the structure underlying SQL schemas: each namespace
4920 can have a separate collection of relations, types, etc. without name
4921 conflicts.
4922 </para>
4924 <table>
4925 <title><structname>pg_namespace</structname> Columns</title>
4926 <tgroup cols="1">
4927 <thead>
4928 <row>
4929 <entry role="catalog_table_entry"><para role="column_definition">
4930 Column Type
4931 </para>
4932 <para>
4933 Description
4934 </para></entry>
4935 </row>
4936 </thead>
4938 <tbody>
4939 <row>
4940 <entry role="catalog_table_entry"><para role="column_definition">
4941 <structfield>oid</structfield> <type>oid</type>
4942 </para>
4943 <para>
4944 Row identifier
4945 </para></entry>
4946 </row>
4948 <row>
4949 <entry role="catalog_table_entry"><para role="column_definition">
4950 <structfield>nspname</structfield> <type>name</type>
4951 </para>
4952 <para>
4953 Name of the namespace
4954 </para></entry>
4955 </row>
4957 <row>
4958 <entry role="catalog_table_entry"><para role="column_definition">
4959 <structfield>nspowner</structfield> <type>oid</type>
4960 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4961 </para>
4962 <para>
4963 Owner of the namespace
4964 </para></entry>
4965 </row>
4967 <row>
4968 <entry role="catalog_table_entry"><para role="column_definition">
4969 <structfield>nspacl</structfield> <type>aclitem[]</type>
4970 </para>
4971 <para>
4972 Access privileges; see <xref linkend="ddl-priv"/> for details
4973 </para></entry>
4974 </row>
4975 </tbody>
4976 </tgroup>
4977 </table>
4979 </sect1>
4982 <sect1 id="catalog-pg-opclass">
4983 <title><structname>pg_opclass</structname></title>
4985 <indexterm zone="catalog-pg-opclass">
4986 <primary>pg_opclass</primary>
4987 </indexterm>
4989 <para>
4990 The catalog <structname>pg_opclass</structname> defines
4991 index access method operator classes. Each operator class defines
4992 semantics for index columns of a particular data type and a particular
4993 index access method. An operator class essentially specifies that a
4994 particular operator family is applicable to a particular indexable column
4995 data type. The set of operators from the family that are actually usable
4996 with the indexed column are whichever ones accept the column's data type
4997 as their left-hand input.
4998 </para>
5000 <para>
5001 Operator classes are described at length in <xref linkend="xindex"/>.
5002 </para>
5004 <table>
5005 <title><structname>pg_opclass</structname> Columns</title>
5006 <tgroup cols="1">
5007 <thead>
5008 <row>
5009 <entry role="catalog_table_entry"><para role="column_definition">
5010 Column Type
5011 </para>
5012 <para>
5013 Description
5014 </para></entry>
5015 </row>
5016 </thead>
5018 <tbody>
5019 <row>
5020 <entry role="catalog_table_entry"><para role="column_definition">
5021 <structfield>oid</structfield> <type>oid</type>
5022 </para>
5023 <para>
5024 Row identifier
5025 </para></entry>
5026 </row>
5028 <row>
5029 <entry role="catalog_table_entry"><para role="column_definition">
5030 <structfield>opcmethod</structfield> <type>oid</type>
5031 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
5032 </para>
5033 <para>
5034 Index access method operator class is for
5035 </para></entry>
5036 </row>
5038 <row>
5039 <entry role="catalog_table_entry"><para role="column_definition">
5040 <structfield>opcname</structfield> <type>name</type>
5041 </para>
5042 <para>
5043 Name of this operator class
5044 </para></entry>
5045 </row>
5047 <row>
5048 <entry role="catalog_table_entry"><para role="column_definition">
5049 <structfield>opcnamespace</structfield> <type>oid</type>
5050 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5051 </para>
5052 <para>
5053 Namespace of this operator class
5054 </para></entry>
5055 </row>
5057 <row>
5058 <entry role="catalog_table_entry"><para role="column_definition">
5059 <structfield>opcowner</structfield> <type>oid</type>
5060 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5061 </para>
5062 <para>
5063 Owner of the operator class
5064 </para></entry>
5065 </row>
5067 <row>
5068 <entry role="catalog_table_entry"><para role="column_definition">
5069 <structfield>opcfamily</structfield> <type>oid</type>
5070 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
5071 </para>
5072 <para>
5073 Operator family containing the operator class
5074 </para></entry>
5075 </row>
5077 <row>
5078 <entry role="catalog_table_entry"><para role="column_definition">
5079 <structfield>opcintype</structfield> <type>oid</type>
5080 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5081 </para>
5082 <para>
5083 Data type that the operator class indexes
5084 </para></entry>
5085 </row>
5087 <row>
5088 <entry role="catalog_table_entry"><para role="column_definition">
5089 <structfield>opcdefault</structfield> <type>bool</type>
5090 </para>
5091 <para>
5092 True if this operator class is the default for <structfield>opcintype</structfield>
5093 </para></entry>
5094 </row>
5096 <row>
5097 <entry role="catalog_table_entry"><para role="column_definition">
5098 <structfield>opckeytype</structfield> <type>oid</type>
5099 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5100 </para>
5101 <para>
5102 Type of data stored in index, or zero if same as <structfield>opcintype</structfield>
5103 </para></entry>
5104 </row>
5105 </tbody>
5106 </tgroup>
5107 </table>
5109 <para>
5110 An operator class's <structfield>opcmethod</structfield> must match the
5111 <structfield>opfmethod</structfield> of its containing operator family.
5112 Also, there must be no more than one <structname>pg_opclass</structname>
5113 row having <structfield>opcdefault</structfield> true for any given combination of
5114 <structfield>opcmethod</structfield> and <structfield>opcintype</structfield>.
5115 </para>
5117 </sect1>
5120 <sect1 id="catalog-pg-operator">
5121 <title><structname>pg_operator</structname></title>
5123 <indexterm zone="catalog-pg-operator">
5124 <primary>pg_operator</primary>
5125 </indexterm>
5127 <para>
5128 The catalog <structname>pg_operator</structname> stores information about operators.
5129 See <xref linkend="sql-createoperator"/>
5130 and <xref linkend="xoper"/> for more information.
5131 </para>
5133 <table>
5134 <title><structname>pg_operator</structname> Columns</title>
5135 <tgroup cols="1">
5136 <thead>
5137 <row>
5138 <entry role="catalog_table_entry"><para role="column_definition">
5139 Column Type
5140 </para>
5141 <para>
5142 Description
5143 </para></entry>
5144 </row>
5145 </thead>
5147 <tbody>
5148 <row>
5149 <entry role="catalog_table_entry"><para role="column_definition">
5150 <structfield>oid</structfield> <type>oid</type>
5151 </para>
5152 <para>
5153 Row identifier
5154 </para></entry>
5155 </row>
5157 <row>
5158 <entry role="catalog_table_entry"><para role="column_definition">
5159 <structfield>oprname</structfield> <type>name</type>
5160 </para>
5161 <para>
5162 Name of the operator
5163 </para></entry>
5164 </row>
5166 <row>
5167 <entry role="catalog_table_entry"><para role="column_definition">
5168 <structfield>oprnamespace</structfield> <type>oid</type>
5169 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5170 </para>
5171 <para>
5172 The OID of the namespace that contains this operator
5173 </para></entry>
5174 </row>
5176 <row>
5177 <entry role="catalog_table_entry"><para role="column_definition">
5178 <structfield>oprowner</structfield> <type>oid</type>
5179 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5180 </para>
5181 <para>
5182 Owner of the operator
5183 </para></entry>
5184 </row>
5186 <row>
5187 <entry role="catalog_table_entry"><para role="column_definition">
5188 <structfield>oprkind</structfield> <type>char</type>
5189 </para>
5190 <para>
5191 <literal>b</literal> = infix operator (<quote>both</quote>),
5192 or <literal>l</literal> = prefix operator (<quote>left</quote>)
5193 </para></entry>
5194 </row>
5196 <row>
5197 <entry role="catalog_table_entry"><para role="column_definition">
5198 <structfield>oprcanmerge</structfield> <type>bool</type>
5199 </para>
5200 <para>
5201 This operator supports merge joins
5202 </para></entry>
5203 </row>
5205 <row>
5206 <entry role="catalog_table_entry"><para role="column_definition">
5207 <structfield>oprcanhash</structfield> <type>bool</type>
5208 </para>
5209 <para>
5210 This operator supports hash joins
5211 </para></entry>
5212 </row>
5214 <row>
5215 <entry role="catalog_table_entry"><para role="column_definition">
5216 <structfield>oprleft</structfield> <type>oid</type>
5217 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5218 </para>
5219 <para>
5220 Type of the left operand (zero for a prefix operator)
5221 </para></entry>
5222 </row>
5224 <row>
5225 <entry role="catalog_table_entry"><para role="column_definition">
5226 <structfield>oprright</structfield> <type>oid</type>
5227 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5228 </para>
5229 <para>
5230 Type of the right operand
5231 </para></entry>
5232 </row>
5234 <row>
5235 <entry role="catalog_table_entry"><para role="column_definition">
5236 <structfield>oprresult</structfield> <type>oid</type>
5237 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5238 </para>
5239 <para>
5240 Type of the result
5241 (zero for a not-yet-defined <quote>shell</quote> operator)
5242 </para></entry>
5243 </row>
5245 <row>
5246 <entry role="catalog_table_entry"><para role="column_definition">
5247 <structfield>oprcom</structfield> <type>oid</type>
5248 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
5249 </para>
5250 <para>
5251 Commutator of this operator (zero if none)
5252 </para></entry>
5253 </row>
5255 <row>
5256 <entry role="catalog_table_entry"><para role="column_definition">
5257 <structfield>oprnegate</structfield> <type>oid</type>
5258 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
5259 </para>
5260 <para>
5261 Negator of this operator (zero if none)
5262 </para></entry>
5263 </row>
5265 <row>
5266 <entry role="catalog_table_entry"><para role="column_definition">
5267 <structfield>oprcode</structfield> <type>regproc</type>
5268 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5269 </para>
5270 <para>
5271 Function that implements this operator
5272 (zero for a not-yet-defined <quote>shell</quote> operator)
5273 </para></entry>
5274 </row>
5276 <row>
5277 <entry role="catalog_table_entry"><para role="column_definition">
5278 <structfield>oprrest</structfield> <type>regproc</type>
5279 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5280 </para>
5281 <para>
5282 Restriction selectivity estimation function for this operator
5283 (zero if none)
5284 </para></entry>
5285 </row>
5287 <row>
5288 <entry role="catalog_table_entry"><para role="column_definition">
5289 <structfield>oprjoin</structfield> <type>regproc</type>
5290 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5291 </para>
5292 <para>
5293 Join selectivity estimation function for this operator
5294 (zero if none)
5295 </para></entry>
5296 </row>
5297 </tbody>
5298 </tgroup>
5299 </table>
5301 </sect1>
5304 <sect1 id="catalog-pg-opfamily">
5305 <title><structname>pg_opfamily</structname></title>
5307 <indexterm zone="catalog-pg-opfamily">
5308 <primary>pg_opfamily</primary>
5309 </indexterm>
5311 <para>
5312 The catalog <structname>pg_opfamily</structname> defines operator families.
5313 Each operator family is a collection of operators and associated
5314 support routines that implement the semantics specified for a particular
5315 index access method. Furthermore, the operators in a family are all
5316 <quote>compatible</quote>, in a way that is specified by the access method.
5317 The operator family concept allows cross-data-type operators to be used
5318 with indexes and to be reasoned about using knowledge of access method
5319 semantics.
5320 </para>
5322 <para>
5323 Operator families are described at length in <xref linkend="xindex"/>.
5324 </para>
5326 <table>
5327 <title><structname>pg_opfamily</structname> Columns</title>
5328 <tgroup cols="1">
5329 <thead>
5330 <row>
5331 <entry role="catalog_table_entry"><para role="column_definition">
5332 Column Type
5333 </para>
5334 <para>
5335 Description
5336 </para></entry>
5337 </row>
5338 </thead>
5340 <tbody>
5341 <row>
5342 <entry role="catalog_table_entry"><para role="column_definition">
5343 <structfield>oid</structfield> <type>oid</type>
5344 </para>
5345 <para>
5346 Row identifier
5347 </para></entry>
5348 </row>
5350 <row>
5351 <entry role="catalog_table_entry"><para role="column_definition">
5352 <structfield>opfmethod</structfield> <type>oid</type>
5353 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
5354 </para>
5355 <para>
5356 Index access method operator family is for
5357 </para></entry>
5358 </row>
5360 <row>
5361 <entry role="catalog_table_entry"><para role="column_definition">
5362 <structfield>opfname</structfield> <type>name</type>
5363 </para>
5364 <para>
5365 Name of this operator family
5366 </para></entry>
5367 </row>
5369 <row>
5370 <entry role="catalog_table_entry"><para role="column_definition">
5371 <structfield>opfnamespace</structfield> <type>oid</type>
5372 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5373 </para>
5374 <para>
5375 Namespace of this operator family
5376 </para></entry>
5377 </row>
5379 <row>
5380 <entry role="catalog_table_entry"><para role="column_definition">
5381 <structfield>opfowner</structfield> <type>oid</type>
5382 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5383 </para>
5384 <para>
5385 Owner of the operator family
5386 </para></entry>
5387 </row>
5388 </tbody>
5389 </tgroup>
5390 </table>
5392 <para>
5393 The majority of the information defining an operator family is not in its
5394 <structname>pg_opfamily</structname> row, but in the associated rows in
5395 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
5396 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
5398 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
5399 </para>
5401 </sect1>
5404 <sect1 id="catalog-pg-partitioned-table">
5405 <title><structname>pg_partitioned_table</structname></title>
5407 <indexterm zone="catalog-pg-partitioned-table">
5408 <primary>pg_partitioned_table</primary>
5409 </indexterm>
5411 <para>
5412 The catalog <structname>pg_partitioned_table</structname> stores
5413 information about how tables are partitioned.
5414 </para>
5416 <table>
5417 <title><structname>pg_partitioned_table</structname> Columns</title>
5418 <tgroup cols="1">
5419 <thead>
5420 <row>
5421 <entry role="catalog_table_entry"><para role="column_definition">
5422 Column Type
5423 </para>
5424 <para>
5425 Description
5426 </para></entry>
5427 </row>
5428 </thead>
5430 <tbody>
5431 <row>
5432 <entry role="catalog_table_entry"><para role="column_definition">
5433 <structfield>partrelid</structfield> <type>oid</type>
5434 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5435 </para>
5436 <para>
5437 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this partitioned table
5438 </para></entry>
5439 </row>
5441 <row>
5442 <entry role="catalog_table_entry"><para role="column_definition">
5443 <structfield>partstrat</structfield> <type>char</type>
5444 </para>
5445 <para>
5446 Partitioning strategy; <literal>h</literal> = hash partitioned table,
5447 <literal>l</literal> = list partitioned table, <literal>r</literal> = range partitioned table
5448 </para></entry>
5449 </row>
5451 <row>
5452 <entry role="catalog_table_entry"><para role="column_definition">
5453 <structfield>partnatts</structfield> <type>int2</type>
5454 </para>
5455 <para>
5456 The number of columns in the partition key
5457 </para></entry>
5458 </row>
5460 <row>
5461 <entry role="catalog_table_entry"><para role="column_definition">
5462 <structfield>partdefid</structfield> <type>oid</type>
5463 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5464 </para>
5465 <para>
5466 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for the default partition
5467 of this partitioned table, or zero if this partitioned table does not
5468 have a default partition
5469 </para></entry>
5470 </row>
5472 <row>
5473 <entry role="catalog_table_entry"><para role="column_definition">
5474 <structfield>partattrs</structfield> <type>int2vector</type>
5475 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
5476 </para>
5477 <para>
5478 This is an array of <structfield>partnatts</structfield> values that
5479 indicate which table columns are part of the partition key. For
5480 example, a value of <literal>1 3</literal> would mean that the first
5481 and the third table columns make up the partition key. A zero in this
5482 array indicates that the corresponding partition key column is an
5483 expression, rather than a simple column reference.
5484 </para></entry>
5485 </row>
5487 <row>
5488 <entry role="catalog_table_entry"><para role="column_definition">
5489 <structfield>partclass</structfield> <type>oidvector</type>
5490 (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
5491 </para>
5492 <para>
5493 For each column in the partition key, this contains the OID of the
5494 operator class to use. See
5495 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
5496 </para></entry>
5497 </row>
5499 <row>
5500 <entry role="catalog_table_entry"><para role="column_definition">
5501 <structfield>partcollation</structfield> <type>oidvector</type>
5502 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
5503 </para>
5504 <para>
5505 For each column in the partition key, this contains the OID of the
5506 collation to use for partitioning, or zero if the column is not
5507 of a collatable data type.
5508 </para></entry>
5509 </row>
5511 <row>
5512 <entry role="catalog_table_entry"><para role="column_definition">
5513 <structfield>partexprs</structfield> <type>pg_node_tree</type>
5514 </para>
5515 <para>
5516 Expression trees (in <function>nodeToString()</function>
5517 representation) for partition key columns that are not simple column
5518 references. This is a list with one element for each zero
5519 entry in <structfield>partattrs</structfield>. Null if all partition key columns
5520 are simple references.
5521 </para></entry>
5522 </row>
5523 </tbody>
5524 </tgroup>
5525 </table>
5526 </sect1>
5529 <sect1 id="catalog-pg-policy">
5530 <title><structname>pg_policy</structname></title>
5532 <indexterm zone="catalog-pg-policy">
5533 <primary>pg_policy</primary>
5534 </indexterm>
5536 <para>
5537 The catalog <structname>pg_policy</structname> stores row-level
5538 security policies for tables. A policy includes the kind of
5539 command that it applies to (possibly all commands), the roles that it
5540 applies to, the expression to be added as a security-barrier
5541 qualification to queries that include the table, and the expression
5542 to be added as a <literal>WITH CHECK</literal> option for queries that attempt to
5543 add new records to the table.
5544 </para>
5546 <table>
5547 <title><structname>pg_policy</structname> Columns</title>
5548 <tgroup cols="1">
5549 <thead>
5550 <row>
5551 <entry role="catalog_table_entry"><para role="column_definition">
5552 Column Type
5553 </para>
5554 <para>
5555 Description
5556 </para></entry>
5557 </row>
5558 </thead>
5560 <tbody>
5561 <row>
5562 <entry role="catalog_table_entry"><para role="column_definition">
5563 <structfield>oid</structfield> <type>oid</type>
5564 </para>
5565 <para>
5566 Row identifier
5567 </para></entry>
5568 </row>
5570 <row>
5571 <entry role="catalog_table_entry"><para role="column_definition">
5572 <structfield>polname</structfield> <type>name</type>
5573 </para>
5574 <para>
5575 The name of the policy
5576 </para></entry>
5577 </row>
5579 <row>
5580 <entry role="catalog_table_entry"><para role="column_definition">
5581 <structfield>polrelid</structfield> <type>oid</type>
5582 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5583 </para>
5584 <para>
5585 The table to which the policy applies
5586 </para></entry>
5587 </row>
5589 <row>
5590 <entry role="catalog_table_entry"><para role="column_definition">
5591 <structfield>polcmd</structfield> <type>char</type>
5592 </para>
5593 <para>
5594 The command type to which the policy is applied:
5595 <literal>r</literal> for <xref linkend="sql-select"/>,
5596 <literal>a</literal> for <xref linkend="sql-insert"/>,
5597 <literal>w</literal> for <xref linkend="sql-update"/>,
5598 <literal>d</literal> for <xref linkend="sql-delete"/>,
5599 or <literal>*</literal> for all
5600 </para></entry>
5601 </row>
5603 <row>
5604 <entry role="catalog_table_entry"><para role="column_definition">
5605 <structfield>polpermissive</structfield> <type>bool</type>
5606 </para>
5607 <para>
5608 Is the policy permissive or restrictive?
5609 </para></entry>
5610 </row>
5612 <row>
5613 <entry role="catalog_table_entry"><para role="column_definition">
5614 <structfield>polroles</structfield> <type>oid[]</type>
5615 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5616 </para>
5617 <para>
5618 The roles to which the policy is applied;
5619 zero means <literal>PUBLIC</literal>
5620 (and normally appears alone in the array)
5621 </para></entry>
5622 </row>
5624 <row>
5625 <entry role="catalog_table_entry"><para role="column_definition">
5626 <structfield>polqual</structfield> <type>pg_node_tree</type>
5627 </para>
5628 <para>
5629 The expression tree to be added to the security barrier qualifications for queries that use the table
5630 </para></entry>
5631 </row>
5633 <row>
5634 <entry role="catalog_table_entry"><para role="column_definition">
5635 <structfield>polwithcheck</structfield> <type>pg_node_tree</type>
5636 </para>
5637 <para>
5638 The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table
5639 </para></entry>
5640 </row>
5641 </tbody>
5642 </tgroup>
5643 </table>
5645 <note>
5646 <para>
5647 Policies stored in <structname>pg_policy</structname> are applied only when
5648 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relrowsecurity</structfield> is set for
5649 their table.
5650 </para>
5651 </note>
5653 </sect1>
5655 <sect1 id="catalog-pg-proc">
5656 <title><structname>pg_proc</structname></title>
5658 <indexterm zone="catalog-pg-proc">
5659 <primary>pg_proc</primary>
5660 </indexterm>
5662 <para>
5663 The catalog <structname>pg_proc</structname> stores information about
5664 functions, procedures, aggregate functions, and window functions
5665 (collectively also known as routines). See <xref
5666 linkend="sql-createfunction"/>, <xref linkend="sql-createprocedure"/>, and
5667 <xref linkend="xfunc"/> for more information.
5668 </para>
5670 <para>
5671 If <structfield>prokind</structfield> indicates that the entry is for an
5672 aggregate function, there should be a matching row in
5673 <link linkend="catalog-pg-aggregate"><structfield>pg_aggregate</structfield></link>.
5674 </para>
5676 <table>
5677 <title><structname>pg_proc</structname> Columns</title>
5678 <tgroup cols="1">
5679 <thead>
5680 <row>
5681 <entry role="catalog_table_entry"><para role="column_definition">
5682 Column Type
5683 </para>
5684 <para>
5685 Description
5686 </para></entry>
5687 </row>
5688 </thead>
5690 <tbody>
5691 <row>
5692 <entry role="catalog_table_entry"><para role="column_definition">
5693 <structfield>oid</structfield> <type>oid</type>
5694 </para>
5695 <para>
5696 Row identifier
5697 </para></entry>
5698 </row>
5700 <row>
5701 <entry role="catalog_table_entry"><para role="column_definition">
5702 <structfield>proname</structfield> <type>name</type>
5703 </para>
5704 <para>
5705 Name of the function
5706 </para></entry>
5707 </row>
5709 <row>
5710 <entry role="catalog_table_entry"><para role="column_definition">
5711 <structfield>pronamespace</structfield> <type>oid</type>
5712 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5713 </para>
5714 <para>
5715 The OID of the namespace that contains this function
5716 </para></entry>
5717 </row>
5719 <row>
5720 <entry role="catalog_table_entry"><para role="column_definition">
5721 <structfield>proowner</structfield> <type>oid</type>
5722 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5723 </para>
5724 <para>
5725 Owner of the function
5726 </para></entry>
5727 </row>
5729 <row>
5730 <entry role="catalog_table_entry"><para role="column_definition">
5731 <structfield>prolang</structfield> <type>oid</type>
5732 (references <link linkend="catalog-pg-language"><structname>pg_language</structname></link>.<structfield>oid</structfield>)
5733 </para>
5734 <para>
5735 Implementation language or call interface of this function
5736 </para></entry>
5737 </row>
5739 <row>
5740 <entry role="catalog_table_entry"><para role="column_definition">
5741 <structfield>procost</structfield> <type>float4</type>
5742 </para>
5743 <para>
5744 Estimated execution cost (in units of
5745 <xref linkend="guc-cpu-operator-cost"/>); if <structfield>proretset</structfield>,
5746 this is cost per row returned
5747 </para></entry>
5748 </row>
5750 <row>
5751 <entry role="catalog_table_entry"><para role="column_definition">
5752 <structfield>prorows</structfield> <type>float4</type>
5753 </para>
5754 <para>
5755 Estimated number of result rows (zero if not <structfield>proretset</structfield>)
5756 </para></entry>
5757 </row>
5759 <row>
5760 <entry role="catalog_table_entry"><para role="column_definition">
5761 <structfield>provariadic</structfield> <type>oid</type>
5762 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5763 </para>
5764 <para>
5765 Data type of the variadic array parameter's elements,
5766 or zero if the function does not have a variadic parameter
5767 </para></entry>
5768 </row>
5770 <row>
5771 <entry role="catalog_table_entry"><para role="column_definition">
5772 <structfield>prosupport</structfield> <type>regproc</type>
5773 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5774 </para>
5775 <para>
5776 Planner support function for this function
5777 (see <xref linkend="xfunc-optimization"/>), or zero if none
5778 </para></entry>
5779 </row>
5781 <row>
5782 <entry role="catalog_table_entry"><para role="column_definition">
5783 <structfield>prokind</structfield> <type>char</type>
5784 </para>
5785 <para>
5786 <literal>f</literal> for a normal function, <literal>p</literal>
5787 for a procedure, <literal>a</literal> for an aggregate function, or
5788 <literal>w</literal> for a window function
5789 </para></entry>
5790 </row>
5792 <row>
5793 <entry role="catalog_table_entry"><para role="column_definition">
5794 <structfield>prosecdef</structfield> <type>bool</type>
5795 </para>
5796 <para>
5797 Function is a security definer (i.e., a <quote>setuid</quote>
5798 function)
5799 </para></entry>
5800 </row>
5802 <row>
5803 <entry role="catalog_table_entry"><para role="column_definition">
5804 <structfield>proleakproof</structfield> <type>bool</type>
5805 </para>
5806 <para>
5807 The function has no side effects. No information about the
5808 arguments is conveyed except via the return value. Any function
5809 that might throw an error depending on the values of its arguments
5810 is not leak-proof.
5811 </para></entry>
5812 </row>
5814 <row>
5815 <entry role="catalog_table_entry"><para role="column_definition">
5816 <structfield>proisstrict</structfield> <type>bool</type>
5817 </para>
5818 <para>
5819 Function returns null if any call argument is null. In that
5820 case the function won't actually be called at all. Functions
5821 that are not <quote>strict</quote> must be prepared to handle
5822 null inputs.
5823 </para></entry>
5824 </row>
5826 <row>
5827 <entry role="catalog_table_entry"><para role="column_definition">
5828 <structfield>proretset</structfield> <type>bool</type>
5829 </para>
5830 <para>
5831 Function returns a set (i.e., multiple values of the specified
5832 data type)
5833 </para></entry>
5834 </row>
5836 <row>
5837 <entry role="catalog_table_entry"><para role="column_definition">
5838 <structfield>provolatile</structfield> <type>char</type>
5839 </para>
5840 <para>
5841 <structfield>provolatile</structfield> tells whether the function's
5842 result depends only on its input arguments, or is affected by outside
5843 factors.
5844 It is <literal>i</literal> for <quote>immutable</quote> functions,
5845 which always deliver the same result for the same inputs.
5846 It is <literal>s</literal> for <quote>stable</quote> functions,
5847 whose results (for fixed inputs) do not change within a scan.
5848 It is <literal>v</literal> for <quote>volatile</quote> functions,
5849 whose results might change at any time. (Use <literal>v</literal> also
5850 for functions with side-effects, so that calls to them cannot get
5851 optimized away.)
5852 </para></entry>
5853 </row>
5855 <row>
5856 <entry role="catalog_table_entry"><para role="column_definition">
5857 <structfield>proparallel</structfield> <type>char</type>
5858 </para>
5859 <para>
5860 <structfield>proparallel</structfield> tells whether the function
5861 can be safely run in parallel mode.
5862 It is <literal>s</literal> for functions which are safe to run in
5863 parallel mode without restriction.
5864 It is <literal>r</literal> for functions which can be run in parallel
5865 mode, but their execution is restricted to the parallel group leader;
5866 parallel worker processes cannot invoke these functions.
5867 It is <literal>u</literal> for functions which are unsafe in parallel
5868 mode; the presence of such a function forces a serial execution plan.
5869 </para></entry>
5870 </row>
5872 <row>
5873 <entry role="catalog_table_entry"><para role="column_definition">
5874 <structfield>pronargs</structfield> <type>int2</type>
5875 </para>
5876 <para>
5877 Number of input arguments
5878 </para></entry>
5879 </row>
5881 <row>
5882 <entry role="catalog_table_entry"><para role="column_definition">
5883 <structfield>pronargdefaults</structfield> <type>int2</type>
5884 </para>
5885 <para>
5886 Number of arguments that have defaults
5887 </para></entry>
5888 </row>
5890 <row>
5891 <entry role="catalog_table_entry"><para role="column_definition">
5892 <structfield>prorettype</structfield> <type>oid</type>
5893 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5894 </para>
5895 <para>
5896 Data type of the return value
5897 </para></entry>
5898 </row>
5900 <row>
5901 <entry role="catalog_table_entry"><para role="column_definition">
5902 <structfield>proargtypes</structfield> <type>oidvector</type>
5903 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5904 </para>
5905 <para>
5906 An array of the data types of the function arguments. This includes
5907 only input arguments (including <literal>INOUT</literal> and
5908 <literal>VARIADIC</literal> arguments), and thus represents
5909 the call signature of the function.
5910 </para></entry>
5911 </row>
5913 <row>
5914 <entry role="catalog_table_entry"><para role="column_definition">
5915 <structfield>proallargtypes</structfield> <type>oid[]</type>
5916 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5917 </para>
5918 <para>
5919 An array of the data types of the function arguments. This includes
5920 all arguments (including <literal>OUT</literal> and
5921 <literal>INOUT</literal> arguments); however, if all the
5922 arguments are <literal>IN</literal> arguments, this field will be null.
5923 Note that subscripting is 1-based, whereas for historical reasons
5924 <structfield>proargtypes</structfield> is subscripted from 0.
5925 </para></entry>
5926 </row>
5928 <row>
5929 <entry role="catalog_table_entry"><para role="column_definition">
5930 <structfield>proargmodes</structfield> <type>char[]</type>
5931 </para>
5932 <para>
5933 An array of the modes of the function arguments, encoded as
5934 <literal>i</literal> for <literal>IN</literal> arguments,
5935 <literal>o</literal> for <literal>OUT</literal> arguments,
5936 <literal>b</literal> for <literal>INOUT</literal> arguments,
5937 <literal>v</literal> for <literal>VARIADIC</literal> arguments,
5938 <literal>t</literal> for <literal>TABLE</literal> arguments.
5939 If all the arguments are <literal>IN</literal> arguments,
5940 this field will be null.
5941 Note that subscripts correspond to positions of
5942 <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
5943 </para></entry>
5944 </row>
5946 <row>
5947 <entry role="catalog_table_entry"><para role="column_definition">
5948 <structfield>proargnames</structfield> <type>text[]</type>
5949 </para>
5950 <para>
5951 An array of the names of the function arguments.
5952 Arguments without a name are set to empty strings in the array.
5953 If none of the arguments have a name, this field will be null.
5954 Note that subscripts correspond to positions of
5955 <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
5956 </para></entry>
5957 </row>
5959 <row>
5960 <entry role="catalog_table_entry"><para role="column_definition">
5961 <structfield>proargdefaults</structfield> <type>pg_node_tree</type>
5962 </para>
5963 <para>
5964 Expression trees (in <function>nodeToString()</function> representation)
5965 for default values. This is a list with
5966 <structfield>pronargdefaults</structfield> elements, corresponding to the last
5967 <replaceable>N</replaceable> <emphasis>input</emphasis> arguments (i.e., the last
5968 <replaceable>N</replaceable> <structfield>proargtypes</structfield> positions).
5969 If none of the arguments have defaults, this field will be null.
5970 </para></entry>
5971 </row>
5973 <row>
5974 <entry role="catalog_table_entry"><para role="column_definition">
5975 <structfield>protrftypes</structfield> <type>oid[]</type>
5976 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5977 </para>
5978 <para>
5979 An array of the argument/result data type(s) for which to apply
5980 transforms (from the function's <literal>TRANSFORM</literal>
5981 clause). Null if none.
5982 </para></entry>
5983 </row>
5985 <row>
5986 <entry role="catalog_table_entry"><para role="column_definition">
5987 <structfield>prosrc</structfield> <type>text</type>
5988 </para>
5989 <para>
5990 This tells the function handler how to invoke the function. It
5991 might be the actual source code of the function for interpreted
5992 languages, a link symbol, a file name, or just about anything
5993 else, depending on the implementation language/call convention.
5994 </para></entry>
5995 </row>
5997 <row>
5998 <entry role="catalog_table_entry"><para role="column_definition">
5999 <structfield>probin</structfield> <type>text</type>
6000 </para>
6001 <para>
6002 Additional information about how to invoke the function.
6003 Again, the interpretation is language-specific.
6004 </para></entry>
6005 </row>
6007 <row>
6008 <entry role="catalog_table_entry"><para role="column_definition">
6009 <structfield>prosqlbody</structfield> <type>pg_node_tree</type>
6010 </para>
6011 <para>
6012 Pre-parsed SQL function body. This is used for SQL-language
6013 functions when the body is given in SQL-standard notation
6014 rather than as a string literal. It's null in other cases.
6015 </para></entry>
6016 </row>
6018 <row>
6019 <entry role="catalog_table_entry"><para role="column_definition">
6020 <structfield>proconfig</structfield> <type>text[]</type>
6021 </para>
6022 <para>
6023 Function's local settings for run-time configuration variables
6024 </para></entry>
6025 </row>
6027 <row>
6028 <entry role="catalog_table_entry"><para role="column_definition">
6029 <structfield>proacl</structfield> <type>aclitem[]</type>
6030 </para>
6031 <para>
6032 Access privileges; see <xref linkend="ddl-priv"/> for details
6033 </para></entry>
6034 </row>
6035 </tbody>
6036 </tgroup>
6037 </table>
6039 <para>
6040 For compiled functions, both built-in and dynamically loaded,
6041 <structfield>prosrc</structfield> contains the function's C-language
6042 name (link symbol).
6043 For SQL-language functions, <structfield>prosrc</structfield> contains
6044 the function's source text if that is specified as a string literal;
6045 but if the function body is specified in SQL-standard style,
6046 <structfield>prosrc</structfield> is unused (typically it's an empty
6047 string) and <structfield>prosqlbody</structfield> contains the
6048 pre-parsed definition.
6049 For all other currently-known language types,
6050 <structfield>prosrc</structfield> contains the function's source
6051 text. <structfield>probin</structfield> is null except for
6052 dynamically-loaded C functions, for which it gives the name of the
6053 shared library file containing the function.
6054 </para>
6056 </sect1>
6058 <sect1 id="catalog-pg-publication">
6059 <title><structname>pg_publication</structname></title>
6061 <indexterm zone="catalog-pg-publication">
6062 <primary>pg_publication</primary>
6063 </indexterm>
6065 <para>
6066 The catalog <structname>pg_publication</structname> contains all
6067 publications created in the database. For more on publications see
6068 <xref linkend="logical-replication-publication"/>.
6069 </para>
6071 <table>
6072 <title><structname>pg_publication</structname> Columns</title>
6073 <tgroup cols="1">
6074 <thead>
6075 <row>
6076 <entry role="catalog_table_entry"><para role="column_definition">
6077 Column Type
6078 </para>
6079 <para>
6080 Description
6081 </para></entry>
6082 </row>
6083 </thead>
6085 <tbody>
6086 <row>
6087 <entry role="catalog_table_entry"><para role="column_definition">
6088 <structfield>oid</structfield> <type>oid</type>
6089 </para>
6090 <para>
6091 Row identifier
6092 </para></entry>
6093 </row>
6095 <row>
6096 <entry role="catalog_table_entry"><para role="column_definition">
6097 <structfield>pubname</structfield> <type>name</type>
6098 </para>
6099 <para>
6100 Name of the publication
6101 </para></entry>
6102 </row>
6104 <row>
6105 <entry role="catalog_table_entry"><para role="column_definition">
6106 <structfield>pubowner</structfield> <type>oid</type>
6107 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
6108 </para>
6109 <para>
6110 Owner of the publication
6111 </para></entry>
6112 </row>
6114 <row>
6115 <entry role="catalog_table_entry"><para role="column_definition">
6116 <structfield>puballtables</structfield> <type>bool</type>
6117 </para>
6118 <para>
6119 If true, this publication automatically includes all tables
6120 in the database, including any that will be created in the future.
6121 </para></entry>
6122 </row>
6124 <row>
6125 <entry role="catalog_table_entry"><para role="column_definition">
6126 <structfield>pubinsert</structfield> <type>bool</type>
6127 </para>
6128 <para>
6129 If true, <xref linkend="sql-insert"/> operations are replicated for
6130 tables in the publication.
6131 </para></entry>
6132 </row>
6134 <row>
6135 <entry role="catalog_table_entry"><para role="column_definition">
6136 <structfield>pubupdate</structfield> <type>bool</type>
6137 </para>
6138 <para>
6139 If true, <xref linkend="sql-update"/> operations are replicated for
6140 tables in the publication.
6141 </para></entry>
6142 </row>
6144 <row>
6145 <entry role="catalog_table_entry"><para role="column_definition">
6146 <structfield>pubdelete</structfield> <type>bool</type>
6147 </para>
6148 <para>
6149 If true, <xref linkend="sql-delete"/> operations are replicated for
6150 tables in the publication.
6151 </para></entry>
6152 </row>
6154 <row>
6155 <entry role="catalog_table_entry"><para role="column_definition">
6156 <structfield>pubtruncate</structfield> <type>bool</type>
6157 </para>
6158 <para>
6159 If true, <xref linkend="sql-truncate"/> operations are replicated for
6160 tables in the publication.
6161 </para></entry>
6162 </row>
6164 <row>
6165 <entry role="catalog_table_entry"><para role="column_definition">
6166 <structfield>pubviaroot</structfield> <type>bool</type>
6167 </para>
6168 <para>
6169 If true, operations on a leaf partition are replicated using the
6170 identity and schema of its topmost partitioned ancestor mentioned in the
6171 publication instead of its own.
6172 </para></entry>
6173 </row>
6174 </tbody>
6175 </tgroup>
6176 </table>
6177 </sect1>
6179 <sect1 id="catalog-pg-publication-rel">
6180 <title><structname>pg_publication_rel</structname></title>
6182 <indexterm zone="catalog-pg-publication-rel">
6183 <primary>pg_publication_rel</primary>
6184 </indexterm>
6186 <para>
6187 The catalog <structname>pg_publication_rel</structname> contains the
6188 mapping between relations and publications in the database. This is a
6189 many-to-many mapping. See also <xref linkend="view-pg-publication-tables"/>
6190 for a more user-friendly view of this information.
6191 </para>
6193 <table>
6194 <title><structname>pg_publication_rel</structname> Columns</title>
6195 <tgroup cols="1">
6196 <thead>
6197 <row>
6198 <entry role="catalog_table_entry"><para role="column_definition">
6199 Column Type
6200 </para>
6201 <para>
6202 Description
6203 </para></entry>
6204 </row>
6205 </thead>
6207 <tbody>
6208 <row>
6209 <entry role="catalog_table_entry"><para role="column_definition">
6210 <structfield>oid</structfield> <type>oid</type>
6211 </para>
6212 <para>
6213 Row identifier
6214 </para></entry>
6215 </row>
6217 <row>
6218 <entry role="catalog_table_entry"><para role="column_definition">
6219 <structfield>prpubid</structfield> <type>oid</type>
6220 (references <link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.<structfield>oid</structfield>)
6221 </para>
6222 <para>
6223 Reference to publication
6224 </para></entry>
6225 </row>
6227 <row>
6228 <entry role="catalog_table_entry"><para role="column_definition">
6229 <structfield>prrelid</structfield> <type>oid</type>
6230 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6231 </para>
6232 <para>
6233 Reference to relation
6234 </para></entry>
6235 </row>
6236 </tbody>
6237 </tgroup>
6238 </table>
6239 </sect1>
6241 <sect1 id="catalog-pg-range">
6242 <title><structname>pg_range</structname></title>
6244 <indexterm zone="catalog-pg-range">
6245 <primary>pg_range</primary>
6246 </indexterm>
6248 <para>
6249 The catalog <structname>pg_range</structname> stores information about
6250 range types. This is in addition to the types' entries in
6251 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
6252 </para>
6254 <table>
6255 <title><structname>pg_range</structname> Columns</title>
6256 <tgroup cols="1">
6257 <thead>
6258 <row>
6259 <entry role="catalog_table_entry"><para role="column_definition">
6260 Column Type
6261 </para>
6262 <para>
6263 Description
6264 </para></entry>
6265 </row>
6266 </thead>
6268 <tbody>
6269 <row>
6270 <entry role="catalog_table_entry"><para role="column_definition">
6271 <structfield>rngtypid</structfield> <type>oid</type>
6272 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6273 </para>
6274 <para>
6275 OID of the range type
6276 </para></entry>
6277 </row>
6279 <row>
6280 <entry role="catalog_table_entry"><para role="column_definition">
6281 <structfield>rngsubtype</structfield> <type>oid</type>
6282 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6283 </para>
6284 <para>
6285 OID of the element type (subtype) of this range type
6286 </para></entry>
6287 </row>
6289 <row>
6290 <entry role="catalog_table_entry"><para role="column_definition">
6291 <structfield>rngmultitypid</structfield> <type>oid</type>
6292 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6293 </para>
6294 <para>
6295 OID of the multirange type for this range type
6296 </para></entry>
6297 </row>
6299 <row>
6300 <entry role="catalog_table_entry"><para role="column_definition">
6301 <structfield>rngcollation</structfield> <type>oid</type>
6302 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
6303 </para>
6304 <para>
6305 OID of the collation used for range comparisons, or zero if none
6306 </para></entry>
6307 </row>
6309 <row>
6310 <entry role="catalog_table_entry"><para role="column_definition">
6311 <structfield>rngsubopc</structfield> <type>oid</type>
6312 (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
6313 </para>
6314 <para>
6315 OID of the subtype's operator class used for range comparisons
6316 </para></entry>
6317 </row>
6319 <row>
6320 <entry role="catalog_table_entry"><para role="column_definition">
6321 <structfield>rngcanonical</structfield> <type>regproc</type>
6322 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
6323 </para>
6324 <para>
6325 OID of the function to convert a range value into canonical form,
6326 or zero if none
6327 </para></entry>
6328 </row>
6330 <row>
6331 <entry role="catalog_table_entry"><para role="column_definition">
6332 <structfield>rngsubdiff</structfield> <type>regproc</type>
6333 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
6334 </para>
6335 <para>
6336 OID of the function to return the difference between two element
6337 values as <type>double precision</type>, or zero if none
6338 </para></entry>
6339 </row>
6340 </tbody>
6341 </tgroup>
6342 </table>
6344 <para>
6345 <structfield>rngsubopc</structfield> (plus <structfield>rngcollation</structfield>, if the
6346 element type is collatable) determines the sort ordering used by the range
6347 type. <structfield>rngcanonical</structfield> is used when the element type is
6348 discrete. <structfield>rngsubdiff</structfield> is optional but should be supplied to
6349 improve performance of GiST indexes on the range type.
6350 </para>
6352 </sect1>
6354 <sect1 id="catalog-pg-replication-origin">
6355 <title><structname>pg_replication_origin</structname></title>
6357 <indexterm zone="catalog-pg-replication-origin">
6358 <primary>pg_replication_origin</primary>
6359 </indexterm>
6361 <para>
6362 The <structname>pg_replication_origin</structname> catalog contains
6363 all replication origins created. For more on replication origins
6364 see <xref linkend="replication-origins"/>.
6365 </para>
6367 <para>
6368 Unlike most system catalogs, <structname>pg_replication_origin</structname>
6369 is shared across all databases of a cluster: there is only one copy
6370 of <structname>pg_replication_origin</structname> per cluster, not one per
6371 database.
6372 </para>
6374 <table>
6375 <title><structname>pg_replication_origin</structname> Columns</title>
6376 <tgroup cols="1">
6377 <thead>
6378 <row>
6379 <entry role="catalog_table_entry"><para role="column_definition">
6380 Column Type
6381 </para>
6382 <para>
6383 Description
6384 </para></entry>
6385 </row>
6386 </thead>
6388 <tbody>
6389 <row>
6390 <entry role="catalog_table_entry"><para role="column_definition">
6391 <structfield>roident</structfield> <type>oid</type>
6392 </para>
6393 <para>
6394 A unique, cluster-wide identifier for the replication
6395 origin. Should never leave the system.
6396 </para></entry>
6397 </row>
6399 <row>
6400 <entry role="catalog_table_entry"><para role="column_definition">
6401 <structfield>roname</structfield> <type>text</type>
6402 </para>
6403 <para>
6404 The external, user defined, name of a replication
6405 origin.
6406 </para></entry>
6407 </row>
6408 </tbody>
6409 </tgroup>
6410 </table>
6411 </sect1>
6413 <sect1 id="catalog-pg-rewrite">
6414 <title><structname>pg_rewrite</structname></title>
6416 <indexterm zone="catalog-pg-rewrite">
6417 <primary>pg_rewrite</primary>
6418 </indexterm>
6420 <para>
6421 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
6422 </para>
6424 <table>
6425 <title><structname>pg_rewrite</structname> Columns</title>
6426 <tgroup cols="1">
6427 <thead>
6428 <row>
6429 <entry role="catalog_table_entry"><para role="column_definition">
6430 Column Type
6431 </para>
6432 <para>
6433 Description
6434 </para></entry>
6435 </row>
6436 </thead>
6438 <tbody>
6439 <row>
6440 <entry role="catalog_table_entry"><para role="column_definition">
6441 <structfield>oid</structfield> <type>oid</type>
6442 </para>
6443 <para>
6444 Row identifier
6445 </para></entry>
6446 </row>
6448 <row>
6449 <entry role="catalog_table_entry"><para role="column_definition">
6450 <structfield>rulename</structfield> <type>name</type>
6451 </para>
6452 <para>
6453 Rule name
6454 </para></entry>
6455 </row>
6457 <row>
6458 <entry role="catalog_table_entry"><para role="column_definition">
6459 <structfield>ev_class</structfield> <type>oid</type>
6460 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6461 </para>
6462 <para>
6463 The table this rule is for
6464 </para></entry>
6465 </row>
6467 <row>
6468 <entry role="catalog_table_entry"><para role="column_definition">
6469 <structfield>ev_type</structfield> <type>char</type>
6470 </para>
6471 <para>
6472 Event type that the rule is for: 1 = <xref linkend="sql-select"/>, 2 =
6473 <xref linkend="sql-update"/>, 3 = <xref linkend="sql-insert"/>, 4 =
6474 <xref linkend="sql-delete"/>
6475 </para></entry>
6476 </row>
6478 <row>
6479 <entry role="catalog_table_entry"><para role="column_definition">
6480 <structfield>ev_enabled</structfield> <type>char</type>
6481 </para>
6482 <para>
6483 Controls in which <xref linkend="guc-session-replication-role"/> modes
6484 the rule fires.
6485 <literal>O</literal> = rule fires in <quote>origin</quote> and <quote>local</quote> modes,
6486 <literal>D</literal> = rule is disabled,
6487 <literal>R</literal> = rule fires in <quote>replica</quote> mode,
6488 <literal>A</literal> = rule fires always.
6489 </para></entry>
6490 </row>
6492 <row>
6493 <entry role="catalog_table_entry"><para role="column_definition">
6494 <structfield>is_instead</structfield> <type>bool</type>
6495 </para>
6496 <para>
6497 True if the rule is an <literal>INSTEAD</literal> rule
6498 </para></entry>
6499 </row>
6501 <row>
6502 <entry role="catalog_table_entry"><para role="column_definition">
6503 <structfield>ev_qual</structfield> <type>pg_node_tree</type>
6504 </para>
6505 <para>
6506 Expression tree (in the form of a
6507 <function>nodeToString()</function> representation) for the
6508 rule's qualifying condition
6509 </para></entry>
6510 </row>
6512 <row>
6513 <entry role="catalog_table_entry"><para role="column_definition">
6514 <structfield>ev_action</structfield> <type>pg_node_tree</type>
6515 </para>
6516 <para>
6517 Query tree (in the form of a
6518 <function>nodeToString()</function> representation) for the
6519 rule's action
6520 </para></entry>
6521 </row>
6522 </tbody>
6523 </tgroup>
6524 </table>
6526 <note>
6527 <para>
6528 <literal>pg_class.relhasrules</literal>
6529 must be true if a table has any rules in this catalog.
6530 </para>
6531 </note>
6533 </sect1>
6535 <sect1 id="catalog-pg-seclabel">
6536 <title><structname>pg_seclabel</structname></title>
6538 <indexterm zone="catalog-pg-seclabel">
6539 <primary>pg_seclabel</primary>
6540 </indexterm>
6542 <para>
6543 The catalog <structname>pg_seclabel</structname> stores security
6544 labels on database objects. Security labels can be manipulated
6545 with the <link linkend="sql-security-label"><command>SECURITY LABEL</command></link> command. For an easier
6546 way to view security labels, see <xref linkend="view-pg-seclabels"/>.
6547 </para>
6549 <para>
6550 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
6551 which performs a similar function for security labels of database objects
6552 that are shared across a database cluster.
6553 </para>
6555 <table>
6556 <title><structname>pg_seclabel</structname> Columns</title>
6557 <tgroup cols="1">
6558 <thead>
6559 <row>
6560 <entry role="catalog_table_entry"><para role="column_definition">
6561 Column Type
6562 </para>
6563 <para>
6564 Description
6565 </para></entry>
6566 </row>
6567 </thead>
6569 <tbody>
6570 <row>
6571 <entry role="catalog_table_entry"><para role="column_definition">
6572 <structfield>objoid</structfield> <type>oid</type>
6573 (references any OID column)
6574 </para>
6575 <para>
6576 The OID of the object this security label pertains to
6577 </para></entry>
6578 </row>
6580 <row>
6581 <entry role="catalog_table_entry"><para role="column_definition">
6582 <structfield>classoid</structfield> <type>oid</type>
6583 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6584 </para>
6585 <para>
6586 The OID of the system catalog this object appears in
6587 </para></entry>
6588 </row>
6590 <row>
6591 <entry role="catalog_table_entry"><para role="column_definition">
6592 <structfield>objsubid</structfield> <type>int4</type>
6593 </para>
6594 <para>
6595 For a security label on a table column, this is the column number (the
6596 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
6597 the table itself). For all other object types, this column is
6598 zero.
6599 </para></entry>
6600 </row>
6602 <row>
6603 <entry role="catalog_table_entry"><para role="column_definition">
6604 <structfield>provider</structfield> <type>text</type>
6605 </para>
6606 <para>
6607 The label provider associated with this label.
6608 </para></entry>
6609 </row>
6611 <row>
6612 <entry role="catalog_table_entry"><para role="column_definition">
6613 <structfield>label</structfield> <type>text</type>
6614 </para>
6615 <para>
6616 The security label applied to this object.
6617 </para></entry>
6618 </row>
6619 </tbody>
6620 </tgroup>
6621 </table>
6622 </sect1>
6624 <sect1 id="catalog-pg-sequence">
6625 <title><structname>pg_sequence</structname></title>
6627 <indexterm zone="catalog-pg-sequence">
6628 <primary>pg_sequence</primary>
6629 </indexterm>
6631 <para>
6632 The catalog <structname>pg_sequence</structname> contains information about
6633 sequences. Some of the information about sequences, such as the name and
6634 the schema, is in
6635 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>
6636 </para>
6638 <table>
6639 <title><structname>pg_sequence</structname> Columns</title>
6640 <tgroup cols="1">
6641 <thead>
6642 <row>
6643 <entry role="catalog_table_entry"><para role="column_definition">
6644 Column Type
6645 </para>
6646 <para>
6647 Description
6648 </para></entry>
6649 </row>
6650 </thead>
6652 <tbody>
6653 <row>
6654 <entry role="catalog_table_entry"><para role="column_definition">
6655 <structfield>seqrelid</structfield> <type>oid</type>
6656 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6657 </para>
6658 <para>
6659 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this sequence
6660 </para></entry>
6661 </row>
6663 <row>
6664 <entry role="catalog_table_entry"><para role="column_definition">
6665 <structfield>seqtypid</structfield> <type>oid</type>
6666 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6667 </para>
6668 <para>
6669 Data type of the sequence
6670 </para></entry>
6671 </row>
6673 <row>
6674 <entry role="catalog_table_entry"><para role="column_definition">
6675 <structfield>seqstart</structfield> <type>int8</type>
6676 </para>
6677 <para>
6678 Start value of the sequence
6679 </para></entry>
6680 </row>
6682 <row>
6683 <entry role="catalog_table_entry"><para role="column_definition">
6684 <structfield>seqincrement</structfield> <type>int8</type>
6685 </para>
6686 <para>
6687 Increment value of the sequence
6688 </para></entry>
6689 </row>
6691 <row>
6692 <entry role="catalog_table_entry"><para role="column_definition">
6693 <structfield>seqmax</structfield> <type>int8</type>
6694 </para>
6695 <para>
6696 Maximum value of the sequence
6697 </para></entry>
6698 </row>
6700 <row>
6701 <entry role="catalog_table_entry"><para role="column_definition">
6702 <structfield>seqmin</structfield> <type>int8</type>
6703 </para>
6704 <para>
6705 Minimum value of the sequence
6706 </para></entry>
6707 </row>
6709 <row>
6710 <entry role="catalog_table_entry"><para role="column_definition">
6711 <structfield>seqcache</structfield> <type>int8</type>
6712 </para>
6713 <para>
6714 Cache size of the sequence
6715 </para></entry>
6716 </row>
6718 <row>
6719 <entry role="catalog_table_entry"><para role="column_definition">
6720 <structfield>seqcycle</structfield> <type>bool</type>
6721 </para>
6722 <para>
6723 Whether the sequence cycles
6724 </para></entry>
6725 </row>
6726 </tbody>
6727 </tgroup>
6728 </table>
6729 </sect1>
6731 <sect1 id="catalog-pg-shdepend">
6732 <title><structname>pg_shdepend</structname></title>
6734 <indexterm zone="catalog-pg-shdepend">
6735 <primary>pg_shdepend</primary>
6736 </indexterm>
6738 <para>
6739 The catalog <structname>pg_shdepend</structname> records the
6740 dependency relationships between database objects and shared objects,
6741 such as roles. This information allows
6742 <productname>PostgreSQL</productname> to ensure that those objects are
6743 unreferenced before attempting to delete them.
6744 </para>
6746 <para>
6747 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
6748 which performs a similar function for dependencies involving objects
6749 within a single database.
6750 </para>
6752 <para>
6753 Unlike most system catalogs, <structname>pg_shdepend</structname>
6754 is shared across all databases of a cluster: there is only one
6755 copy of <structname>pg_shdepend</structname> per cluster, not
6756 one per database.
6757 </para>
6759 <table>
6760 <title><structname>pg_shdepend</structname> Columns</title>
6761 <tgroup cols="1">
6762 <thead>
6763 <row>
6764 <entry role="catalog_table_entry"><para role="column_definition">
6765 Column Type
6766 </para>
6767 <para>
6768 Description
6769 </para></entry>
6770 </row>
6771 </thead>
6773 <tbody>
6774 <row>
6775 <entry role="catalog_table_entry"><para role="column_definition">
6776 <structfield>dbid</structfield> <type>oid</type>
6777 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
6778 </para>
6779 <para>
6780 The OID of the database the dependent object is in,
6781 or zero for a shared object
6782 </para></entry>
6783 </row>
6785 <row>
6786 <entry role="catalog_table_entry"><para role="column_definition">
6787 <structfield>classid</structfield> <type>oid</type>
6788 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6789 </para>
6790 <para>
6791 The OID of the system catalog the dependent object is in
6792 </para></entry>
6793 </row>
6795 <row>
6796 <entry role="catalog_table_entry"><para role="column_definition">
6797 <structfield>objid</structfield> <type>oid</type>
6798 (references any OID column)
6799 </para>
6800 <para>
6801 The OID of the specific dependent object
6802 </para></entry>
6803 </row>
6805 <row>
6806 <entry role="catalog_table_entry"><para role="column_definition">
6807 <structfield>objsubid</structfield> <type>int4</type>
6808 </para>
6809 <para>
6810 For a table column, this is the column number (the
6811 <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
6812 table itself). For all other object types, this column is zero.
6813 </para></entry>
6814 </row>
6816 <row>
6817 <entry role="catalog_table_entry"><para role="column_definition">
6818 <structfield>refclassid</structfield> <type>oid</type>
6819 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6820 </para>
6821 <para>
6822 The OID of the system catalog the referenced object is in
6823 (must be a shared catalog)
6824 </para></entry>
6825 </row>
6827 <row>
6828 <entry role="catalog_table_entry"><para role="column_definition">
6829 <structfield>refobjid</structfield> <type>oid</type>
6830 (references any OID column)
6831 </para>
6832 <para>
6833 The OID of the specific referenced object
6834 </para></entry>
6835 </row>
6837 <row>
6838 <entry role="catalog_table_entry"><para role="column_definition">
6839 <structfield>deptype</structfield> <type>char</type>
6840 </para>
6841 <para>
6842 A code defining the specific semantics of this dependency relationship; see text
6843 </para></entry>
6844 </row>
6845 </tbody>
6846 </tgroup>
6847 </table>
6849 <para>
6850 In all cases, a <structname>pg_shdepend</structname> entry indicates that
6851 the referenced object cannot be dropped without also dropping the dependent
6852 object. However, there are several subflavors identified by
6853 <structfield>deptype</structfield>:
6855 <variablelist>
6856 <varlistentry>
6857 <term><symbol>SHARED_DEPENDENCY_OWNER</symbol> (<literal>o</literal>)</term>
6858 <listitem>
6859 <para>
6860 The referenced object (which must be a role) is the owner of the
6861 dependent object.
6862 </para>
6863 </listitem>
6864 </varlistentry>
6866 <varlistentry>
6867 <term><symbol>SHARED_DEPENDENCY_ACL</symbol> (<literal>a</literal>)</term>
6868 <listitem>
6869 <para>
6870 The referenced object (which must be a role) is mentioned in the
6871 ACL (access control list, i.e., privileges list) of the
6872 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</symbol> entry is
6873 not made for the owner of the object, since the owner will have
6874 a <symbol>SHARED_DEPENDENCY_OWNER</symbol> entry anyway.)
6875 </para>
6876 </listitem>
6877 </varlistentry>
6879 <varlistentry>
6880 <term><symbol>SHARED_DEPENDENCY_POLICY</symbol> (<literal>r</literal>)</term>
6881 <listitem>
6882 <para>
6883 The referenced object (which must be a role) is mentioned as the
6884 target of a dependent policy object.
6885 </para>
6886 </listitem>
6887 </varlistentry>
6889 <varlistentry>
6890 <term><symbol>SHARED_DEPENDENCY_TABLESPACE</symbol> (<literal>t</literal>)</term>
6891 <listitem>
6892 <para>
6893 The referenced object (which must be a tablespace) is mentioned as
6894 the tablespace for a relation that doesn't have storage.
6895 </para>
6896 </listitem>
6897 </varlistentry>
6898 </variablelist>
6900 Other dependency flavors might be needed in future. Note in particular
6901 that the current definition only supports roles and tablespaces as referenced
6902 objects.
6903 </para>
6905 <para>
6906 As in the <structname>pg_depend</structname> catalog, most objects
6907 created during <application>initdb</application> are
6908 considered <quote>pinned</quote>. No entries are made
6909 in <structname>pg_shdepend</structname> that would have a pinned
6910 object as either referenced or dependent object.
6911 </para>
6913 </sect1>
6915 <sect1 id="catalog-pg-shdescription">
6916 <title><structname>pg_shdescription</structname></title>
6918 <indexterm zone="catalog-pg-shdescription">
6919 <primary>pg_shdescription</primary>
6920 </indexterm>
6922 <para>
6923 The catalog <structname>pg_shdescription</structname> stores optional
6924 descriptions (comments) for shared database objects. Descriptions can be
6925 manipulated with the <link linkend="sql-comment"><command>COMMENT</command></link> command and viewed with
6926 <application>psql</application>'s <literal>\d</literal> commands.
6927 </para>
6929 <para>
6930 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6931 which performs a similar function for descriptions involving objects
6932 within a single database.
6933 </para>
6935 <para>
6936 Unlike most system catalogs, <structname>pg_shdescription</structname>
6937 is shared across all databases of a cluster: there is only one
6938 copy of <structname>pg_shdescription</structname> per cluster, not
6939 one per database.
6940 </para>
6942 <table>
6943 <title><structname>pg_shdescription</structname> Columns</title>
6944 <tgroup cols="1">
6945 <thead>
6946 <row>
6947 <entry role="catalog_table_entry"><para role="column_definition">
6948 Column Type
6949 </para>
6950 <para>
6951 Description
6952 </para></entry>
6953 </row>
6954 </thead>
6956 <tbody>
6957 <row>
6958 <entry role="catalog_table_entry"><para role="column_definition">
6959 <structfield>objoid</structfield> <type>oid</type>
6960 (references any OID column)
6961 </para>
6962 <para>
6963 The OID of the object this description pertains to
6964 </para></entry>
6965 </row>
6967 <row>
6968 <entry role="catalog_table_entry"><para role="column_definition">
6969 <structfield>classoid</structfield> <type>oid</type>
6970 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6971 </para>
6972 <para>
6973 The OID of the system catalog this object appears in
6974 </para></entry>
6975 </row>
6977 <row>
6978 <entry role="catalog_table_entry"><para role="column_definition">
6979 <structfield>description</structfield> <type>text</type>
6980 </para>
6981 <para>
6982 Arbitrary text that serves as the description of this object
6983 </para></entry>
6984 </row>
6985 </tbody>
6986 </tgroup>
6987 </table>
6989 </sect1>
6991 <sect1 id="catalog-pg-shseclabel">
6992 <title><structname>pg_shseclabel</structname></title>
6994 <indexterm zone="catalog-pg-shseclabel">
6995 <primary>pg_shseclabel</primary>
6996 </indexterm>
6998 <para>
6999 The catalog <structname>pg_shseclabel</structname> stores security
7000 labels on shared database objects. Security labels can be manipulated
7001 with the <link linkend="sql-security-label"><command>SECURITY LABEL</command></link> command. For an easier
7002 way to view security labels, see <xref linkend="view-pg-seclabels"/>.
7003 </para>
7005 <para>
7006 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
7007 which performs a similar function for security labels involving objects
7008 within a single database.
7009 </para>
7011 <para>
7012 Unlike most system catalogs, <structname>pg_shseclabel</structname>
7013 is shared across all databases of a cluster: there is only one
7014 copy of <structname>pg_shseclabel</structname> per cluster, not
7015 one per database.
7016 </para>
7018 <table>
7019 <title><structname>pg_shseclabel</structname> Columns</title>
7020 <tgroup cols="1">
7021 <thead>
7022 <row>
7023 <entry role="catalog_table_entry"><para role="column_definition">
7024 Column Type
7025 </para>
7026 <para>
7027 Description
7028 </para></entry>
7029 </row>
7030 </thead>
7032 <tbody>
7033 <row>
7034 <entry role="catalog_table_entry"><para role="column_definition">
7035 <structfield>objoid</structfield> <type>oid</type>
7036 (references any OID column)
7037 </para>
7038 <para>
7039 The OID of the object this security label pertains to
7040 </para></entry>
7041 </row>
7043 <row>
7044 <entry role="catalog_table_entry"><para role="column_definition">
7045 <structfield>classoid</structfield> <type>oid</type>
7046 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7047 </para>
7048 <para>
7049 The OID of the system catalog this object appears in
7050 </para></entry>
7051 </row>
7053 <row>
7054 <entry role="catalog_table_entry"><para role="column_definition">
7055 <structfield>provider</structfield> <type>text</type>
7056 </para>
7057 <para>
7058 The label provider associated with this label.
7059 </para></entry>
7060 </row>
7062 <row>
7063 <entry role="catalog_table_entry"><para role="column_definition">
7064 <structfield>label</structfield> <type>text</type>
7065 </para>
7066 <para>
7067 The security label applied to this object.
7068 </para></entry>
7069 </row>
7070 </tbody>
7071 </tgroup>
7072 </table>
7073 </sect1>
7075 <sect1 id="catalog-pg-statistic">
7076 <title><structname>pg_statistic</structname></title>
7078 <indexterm zone="catalog-pg-statistic">
7079 <primary>pg_statistic</primary>
7080 </indexterm>
7082 <para>
7083 The catalog <structname>pg_statistic</structname> stores
7084 statistical data about the contents of the database. Entries are
7085 created by <link linkend="sql-analyze"><command>ANALYZE</command></link>
7086 and subsequently used by the query planner. Note that all the
7087 statistical data is inherently approximate, even assuming that it
7088 is up-to-date.
7089 </para>
7091 <para>
7092 Normally there is one entry, with <structfield>stainherit</structfield> =
7093 <literal>false</literal>, for each table column that has been analyzed.
7094 If the table has inheritance children, a second entry with
7095 <structfield>stainherit</structfield> = <literal>true</literal> is also created. This row
7096 represents the column's statistics over the inheritance tree, i.e.,
7097 statistics for the data you'd see with
7098 <literal>SELECT <replaceable>column</replaceable> FROM <replaceable>table</replaceable>*</literal>,
7099 whereas the <structfield>stainherit</structfield> = <literal>false</literal> row represents
7100 the results of
7101 <literal>SELECT <replaceable>column</replaceable> FROM ONLY <replaceable>table</replaceable></literal>.
7102 </para>
7104 <para>
7105 <structname>pg_statistic</structname> also stores statistical data about
7106 the values of index expressions. These are described as if they were
7107 actual data columns; in particular, <structfield>starelid</structfield>
7108 references the index. No entry is made for an ordinary non-expression
7109 index column, however, since it would be redundant with the entry
7110 for the underlying table column. Currently, entries for index expressions
7111 always have <structfield>stainherit</structfield> = <literal>false</literal>.
7112 </para>
7114 <para>
7115 Since different kinds of statistics might be appropriate for different
7116 kinds of data, <structname>pg_statistic</structname> is designed not
7117 to assume very much about what sort of statistics it stores. Only
7118 extremely general statistics (such as nullness) are given dedicated
7119 columns in <structname>pg_statistic</structname>. Everything else
7120 is stored in <quote>slots</quote>, which are groups of associated columns
7121 whose content is identified by a code number in one of the slot's columns.
7122 For more information see
7123 <filename>src/include/catalog/pg_statistic.h</filename>.
7124 </para>
7126 <para>
7127 <structname>pg_statistic</structname> should not be readable by the
7128 public, since even statistical information about a table's contents
7129 might be considered sensitive. (Example: minimum and maximum values
7130 of a salary column might be quite interesting.)
7131 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
7132 is a publicly readable view on
7133 <structname>pg_statistic</structname> that only exposes information
7134 about those tables that are readable by the current user.
7135 </para>
7137 <table>
7138 <title><structname>pg_statistic</structname> Columns</title>
7139 <tgroup cols="1">
7140 <thead>
7141 <row>
7142 <entry role="catalog_table_entry"><para role="column_definition">
7143 Column Type
7144 </para>
7145 <para>
7146 Description
7147 </para></entry>
7148 </row>
7149 </thead>
7151 <tbody>
7152 <row>
7153 <entry role="catalog_table_entry"><para role="column_definition">
7154 <structfield>starelid</structfield> <type>oid</type>
7155 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7156 </para>
7157 <para>
7158 The table or index that the described column belongs to
7159 </para></entry>
7160 </row>
7162 <row>
7163 <entry role="catalog_table_entry"><para role="column_definition">
7164 <structfield>staattnum</structfield> <type>int2</type>
7165 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
7166 </para>
7167 <para>
7168 The number of the described column
7169 </para></entry>
7170 </row>
7172 <row>
7173 <entry role="catalog_table_entry"><para role="column_definition">
7174 <structfield>stainherit</structfield> <type>bool</type>
7175 </para>
7176 <para>
7177 If true, the stats include inheritance child columns, not just the
7178 values in the specified relation
7179 </para></entry>
7180 </row>
7182 <row>
7183 <entry role="catalog_table_entry"><para role="column_definition">
7184 <structfield>stanullfrac</structfield> <type>float4</type>
7185 </para>
7186 <para>
7187 The fraction of the column's entries that are null
7188 </para></entry>
7189 </row>
7191 <row>
7192 <entry role="catalog_table_entry"><para role="column_definition">
7193 <structfield>stawidth</structfield> <type>int4</type>
7194 </para>
7195 <para>
7196 The average stored width, in bytes, of nonnull entries
7197 </para></entry>
7198 </row>
7200 <row>
7201 <entry role="catalog_table_entry"><para role="column_definition">
7202 <structfield>stadistinct</structfield> <type>float4</type>
7203 </para>
7204 <para>
7205 The number of distinct nonnull data values in the column.
7206 A value greater than zero is the actual number of distinct values.
7207 A value less than zero is the negative of a multiplier for the number
7208 of rows in the table; for example, a column in which about 80% of the
7209 values are nonnull and each nonnull value appears about twice on
7210 average could be represented by <structfield>stadistinct</structfield> = -0.4.
7211 A zero value means the number of distinct values is unknown.
7212 </para></entry>
7213 </row>
7215 <row>
7216 <entry role="catalog_table_entry"><para role="column_definition">
7217 <structfield>stakind<replaceable>N</replaceable></structfield> <type>int2</type>
7218 </para>
7219 <para>
7220 A code number indicating the kind of statistics stored in the
7221 <replaceable>N</replaceable>th <quote>slot</quote> of the
7222 <structname>pg_statistic</structname> row.
7223 </para></entry>
7224 </row>
7226 <row>
7227 <entry role="catalog_table_entry"><para role="column_definition">
7228 <structfield>staop<replaceable>N</replaceable></structfield> <type>oid</type>
7229 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
7230 </para>
7231 <para>
7232 An operator used to derive the statistics stored in the
7233 <replaceable>N</replaceable>th <quote>slot</quote>. For example, a
7234 histogram slot would show the <literal>&lt;</literal> operator
7235 that defines the sort order of the data.
7236 Zero if the statistics kind does not require an operator.
7237 </para></entry>
7238 </row>
7240 <row>
7241 <entry role="catalog_table_entry"><para role="column_definition">
7242 <structfield>stacoll<replaceable>N</replaceable></structfield> <type>oid</type>
7243 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
7244 </para>
7245 <para>
7246 The collation used to derive the statistics stored in the
7247 <replaceable>N</replaceable>th <quote>slot</quote>. For example, a
7248 histogram slot for a collatable column would show the collation that
7249 defines the sort order of the data. Zero for noncollatable data.
7250 </para></entry>
7251 </row>
7253 <row>
7254 <entry role="catalog_table_entry"><para role="column_definition">
7255 <structfield>stanumbers<replaceable>N</replaceable></structfield> <type>float4[]</type>
7256 </para>
7257 <para>
7258 Numerical statistics of the appropriate kind for the
7259 <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
7260 kind does not involve numerical values
7261 </para></entry>
7262 </row>
7264 <row>
7265 <entry role="catalog_table_entry"><para role="column_definition">
7266 <structfield>stavalues<replaceable>N</replaceable></structfield> <type>anyarray</type>
7267 </para>
7268 <para>
7269 Column data values of the appropriate kind for the
7270 <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
7271 kind does not store any data values. Each array's element
7272 values are actually of the specific column's data type, or a related
7273 type such as an array's element type, so there is no way to define
7274 these columns' type more specifically than <type>anyarray</type>.
7275 </para></entry>
7276 </row>
7277 </tbody>
7278 </tgroup>
7279 </table>
7281 </sect1>
7283 <sect1 id="catalog-pg-statistic-ext">
7284 <title><structname>pg_statistic_ext</structname></title>
7286 <indexterm zone="catalog-pg-statistic-ext">
7287 <primary>pg_statistic_ext</primary>
7288 </indexterm>
7290 <para>
7291 The catalog <structname>pg_statistic_ext</structname>
7292 holds definitions of extended planner statistics.
7293 Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
7294 created with <link linkend="sql-createstatistics"><command>CREATE STATISTICS</command></link>.
7295 </para>
7297 <table>
7298 <title><structname>pg_statistic_ext</structname> Columns</title>
7299 <tgroup cols="1">
7300 <thead>
7301 <row>
7302 <entry role="catalog_table_entry"><para role="column_definition">
7303 Column Type
7304 </para>
7305 <para>
7306 Description
7307 </para></entry>
7308 </row>
7309 </thead>
7311 <tbody>
7312 <row>
7313 <entry role="catalog_table_entry"><para role="column_definition">
7314 <structfield>oid</structfield> <type>oid</type>
7315 </para>
7316 <para>
7317 Row identifier
7318 </para></entry>
7319 </row>
7321 <row>
7322 <entry role="catalog_table_entry"><para role="column_definition">
7323 <structfield>stxrelid</structfield> <type>oid</type>
7324 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7325 </para>
7326 <para>
7327 Table containing the columns described by this object
7328 </para></entry>
7329 </row>
7331 <row>
7332 <entry role="catalog_table_entry"><para role="column_definition">
7333 <structfield>stxname</structfield> <type>name</type>
7334 </para>
7335 <para>
7336 Name of the statistics object
7337 </para></entry>
7338 </row>
7340 <row>
7341 <entry role="catalog_table_entry"><para role="column_definition">
7342 <structfield>stxnamespace</structfield> <type>oid</type>
7343 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
7344 </para>
7345 <para>
7346 The OID of the namespace that contains this statistics object
7347 </para></entry>
7348 </row>
7350 <row>
7351 <entry role="catalog_table_entry"><para role="column_definition">
7352 <structfield>stxowner</structfield> <type>oid</type>
7353 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7354 </para>
7355 <para>
7356 Owner of the statistics object
7357 </para></entry>
7358 </row>
7360 <row>
7361 <entry role="catalog_table_entry"><para role="column_definition">
7362 <structfield>stxstattarget</structfield> <type>int4</type>
7363 </para>
7364 <para>
7365 <structfield>stxstattarget</structfield> controls the level of detail
7366 of statistics accumulated for this statistics object by
7367 <link linkend="sql-analyze"><command>ANALYZE</command></link>.
7368 A zero value indicates that no statistics should be collected.
7369 A negative value says to use the maximum of the statistics targets of
7370 the referenced columns, if set, or the system default statistics target.
7371 Positive values of <structfield>stxstattarget</structfield>
7372 determine the target number of <quote>most common values</quote>
7373 to collect.
7374 </para></entry>
7375 </row>
7377 <row>
7378 <entry role="catalog_table_entry"><para role="column_definition">
7379 <structfield>stxkeys</structfield> <type>int2vector</type>
7380 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
7381 </para>
7382 <para>
7383 An array of attribute numbers, indicating which table columns are
7384 covered by this statistics object;
7385 for example a value of <literal>1 3</literal> would
7386 mean that the first and the third table columns are covered
7387 </para></entry>
7388 </row>
7390 <row>
7391 <entry role="catalog_table_entry"><para role="column_definition">
7392 <structfield>stxkind</structfield> <type>char[]</type>
7393 </para>
7394 <para>
7395 An array containing codes for the enabled statistics kinds;
7396 valid values are:
7397 <literal>d</literal> for n-distinct statistics,
7398 <literal>f</literal> for functional dependency statistics,
7399 <literal>m</literal> for most common values (MCV) list statistics, and
7400 <literal>e</literal> for expression statistics
7401 </para></entry>
7402 </row>
7404 <row>
7405 <entry role="catalog_table_entry"><para role="column_definition">
7406 <structfield>stxexprs</structfield> <type>pg_node_tree</type>
7407 </para>
7408 <para>
7409 Expression trees (in <function>nodeToString()</function>
7410 representation) for statistics object attributes that are not simple
7411 column references. This is a list with one element per expression.
7412 Null if all statistics object attributes are simple references.
7413 </para></entry>
7414 </row>
7416 </tbody>
7417 </tgroup>
7418 </table>
7420 <para>
7421 The <structname>pg_statistic_ext</structname> entry is filled in
7422 completely during <link linkend="sql-createstatistics"><command>CREATE STATISTICS</command></link>, but the actual
7423 statistical values are not computed then.
7424 Subsequent <link linkend="sql-analyze"><command>ANALYZE</command></link> commands compute the desired values
7425 and populate an entry in the
7426 <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
7427 catalog.
7428 </para>
7429 </sect1>
7431 <sect1 id="catalog-pg-statistic-ext-data">
7432 <title><structname>pg_statistic_ext_data</structname></title>
7434 <indexterm zone="catalog-pg-statistic-ext">
7435 <primary>pg_statistic_ext_data</primary>
7436 </indexterm>
7438 <para>
7439 The catalog <structname>pg_statistic_ext_data</structname>
7440 holds data for extended planner statistics defined in
7441 <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.
7442 Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
7443 created with <link linkend="sql-createstatistics"><command>CREATE STATISTICS</command></link>.
7444 </para>
7446 <para>
7447 Like <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>,
7448 <structname>pg_statistic_ext_data</structname> should not be
7449 readable by the public, since the contents might be considered sensitive.
7450 (Example: most common combinations of values in columns might be quite
7451 interesting.)
7452 <link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link>
7453 is a publicly readable view
7454 on <structname>pg_statistic_ext_data</structname> (after joining
7455 with <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>) that only exposes
7456 information about those tables and columns that are readable by the
7457 current user.
7458 </para>
7460 <table>
7461 <title><structname>pg_statistic_ext_data</structname> Columns</title>
7462 <tgroup cols="1">
7463 <thead>
7464 <row>
7465 <entry role="catalog_table_entry"><para role="column_definition">
7466 Column Type
7467 </para>
7468 <para>
7469 Description
7470 </para></entry>
7471 </row>
7472 </thead>
7474 <tbody>
7475 <row>
7476 <entry role="catalog_table_entry"><para role="column_definition">
7477 <structfield>stxoid</structfield> <type>oid</type>
7478 (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>oid</structfield>)
7479 </para>
7480 <para>
7481 Extended statistics object containing the definition for this data
7482 </para></entry>
7483 </row>
7485 <row>
7486 <entry role="catalog_table_entry"><para role="column_definition">
7487 <structfield>stxdndistinct</structfield> <type>pg_ndistinct</type>
7488 </para>
7489 <para>
7490 N-distinct counts, serialized as <structname>pg_ndistinct</structname> type
7491 </para></entry>
7492 </row>
7494 <row>
7495 <entry role="catalog_table_entry"><para role="column_definition">
7496 <structfield>stxddependencies</structfield> <type>pg_dependencies</type>
7497 </para>
7498 <para>
7499 Functional dependency statistics, serialized
7500 as <structname>pg_dependencies</structname> type
7501 </para></entry>
7502 </row>
7504 <row>
7505 <entry role="catalog_table_entry"><para role="column_definition">
7506 <structfield>stxdmcv</structfield> <type>pg_mcv_list</type>
7507 </para>
7508 <para>
7509 MCV (most-common values) list statistics, serialized as
7510 <structname>pg_mcv_list</structname> type
7511 </para></entry>
7512 </row>
7514 <row>
7515 <entry role="catalog_table_entry"><para role="column_definition">
7516 <structfield>stxdexpr</structfield> <type>pg_statistic[]</type>
7517 </para>
7518 <para>
7519 Per-expression statistics, serialized as an array of
7520 <structname>pg_statistic</structname> type
7521 </para></entry>
7522 </row>
7523 </tbody>
7524 </tgroup>
7525 </table>
7527 </sect1>
7529 <sect1 id="catalog-pg-subscription">
7530 <title><structname>pg_subscription</structname></title>
7532 <indexterm zone="catalog-pg-subscription">
7533 <primary>pg_subscription</primary>
7534 </indexterm>
7536 <para>
7537 The catalog <structname>pg_subscription</structname> contains all existing
7538 logical replication subscriptions. For more information about logical
7539 replication see <xref linkend="logical-replication"/>.
7540 </para>
7542 <para>
7543 Unlike most system catalogs, <structname>pg_subscription</structname> is
7544 shared across all databases of a cluster: there is only one copy
7545 of <structname>pg_subscription</structname> per cluster, not one per
7546 database.
7547 </para>
7549 <para>
7550 Access to the column <structfield>subconninfo</structfield> is revoked from
7551 normal users, because it could contain plain-text passwords.
7552 </para>
7554 <table>
7555 <title><structname>pg_subscription</structname> Columns</title>
7556 <tgroup cols="1">
7557 <thead>
7558 <row>
7559 <entry role="catalog_table_entry"><para role="column_definition">
7560 Column Type
7561 </para>
7562 <para>
7563 Description
7564 </para></entry>
7565 </row>
7566 </thead>
7568 <tbody>
7569 <row>
7570 <entry role="catalog_table_entry"><para role="column_definition">
7571 <structfield>oid</structfield> <type>oid</type>
7572 </para>
7573 <para>
7574 Row identifier
7575 </para></entry>
7576 </row>
7578 <row>
7579 <entry role="catalog_table_entry"><para role="column_definition">
7580 <structfield>subdbid</structfield> <type>oid</type>
7581 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
7582 </para>
7583 <para>
7584 OID of the database that the subscription resides in
7585 </para></entry>
7586 </row>
7588 <row>
7589 <entry role="catalog_table_entry"><para role="column_definition">
7590 <structfield>subname</structfield> <type>name</type>
7591 </para>
7592 <para>
7593 Name of the subscription
7594 </para></entry>
7595 </row>
7597 <row>
7598 <entry role="catalog_table_entry"><para role="column_definition">
7599 <structfield>subowner</structfield> <type>oid</type>
7600 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7601 </para>
7602 <para>
7603 Owner of the subscription
7604 </para></entry>
7605 </row>
7607 <row>
7608 <entry role="catalog_table_entry"><para role="column_definition">
7609 <structfield>subenabled</structfield> <type>bool</type>
7610 </para>
7611 <para>
7612 If true, the subscription is enabled and should be replicating
7613 </para></entry>
7614 </row>
7616 <row>
7617 <entry role="catalog_table_entry"><para role="column_definition">
7618 <structfield>subbinary</structfield> <type>bool</type>
7619 </para>
7620 <para>
7621 If true, the subscription will request that the publisher send data
7622 in binary format
7623 </para></entry>
7624 </row>
7626 <row>
7627 <entry role="catalog_table_entry"><para role="column_definition">
7628 <structfield>substream</structfield> <type>bool</type>
7629 </para>
7630 <para>
7631 If true, the subscription will allow streaming of in-progress
7632 transactions
7633 </para></entry>
7634 </row>
7636 <row>
7637 <entry role="catalog_table_entry"><para role="column_definition">
7638 <structfield>subtwophasestate</structfield> <type>char</type>
7639 </para>
7640 <para>
7641 State codes for two-phase mode:
7642 <literal>d</literal> = disabled,
7643 <literal>p</literal> = pending enablement,
7644 <literal>e</literal> = enabled
7645 </para></entry>
7646 </row>
7648 <row>
7649 <entry role="catalog_table_entry"><para role="column_definition">
7650 <structfield>subconninfo</structfield> <type>text</type>
7651 </para>
7652 <para>
7653 Connection string to the upstream database
7654 </para></entry>
7655 </row>
7657 <row>
7658 <entry role="catalog_table_entry"><para role="column_definition">
7659 <structfield>subslotname</structfield> <type>name</type>
7660 </para>
7661 <para>
7662 Name of the replication slot in the upstream database (also used
7663 for the local replication origin name);
7664 null represents <literal>NONE</literal>
7665 </para></entry>
7666 </row>
7668 <row>
7669 <entry role="catalog_table_entry"><para role="column_definition">
7670 <structfield>subsynccommit</structfield> <type>text</type>
7671 </para>
7672 <para>
7673 The <varname>synchronous_commit</varname>
7674 setting for the subscription's workers to use
7675 </para></entry>
7676 </row>
7678 <row>
7679 <entry role="catalog_table_entry"><para role="column_definition">
7680 <structfield>subpublications</structfield> <type>text[]</type>
7681 </para>
7682 <para>
7683 Array of subscribed publication names. These reference
7684 publications defined in the upstream database. For more on publications
7685 see <xref linkend="logical-replication-publication"/>.
7686 </para></entry>
7687 </row>
7688 </tbody>
7689 </tgroup>
7690 </table>
7691 </sect1>
7693 <sect1 id="catalog-pg-subscription-rel">
7694 <title><structname>pg_subscription_rel</structname></title>
7696 <indexterm zone="catalog-pg-subscription-rel">
7697 <primary>pg_subscription_rel</primary>
7698 </indexterm>
7700 <para>
7701 The catalog <structname>pg_subscription_rel</structname> contains the
7702 state for each replicated relation in each subscription. This is a
7703 many-to-many mapping.
7704 </para>
7706 <para>
7707 This catalog only contains tables known to the subscription after running
7708 either <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link> or
7709 <link linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION ... REFRESH
7710 PUBLICATION</command></link>.
7711 </para>
7713 <table>
7714 <title><structname>pg_subscription_rel</structname> Columns</title>
7715 <tgroup cols="1">
7716 <thead>
7717 <row>
7718 <entry role="catalog_table_entry"><para role="column_definition">
7719 Column Type
7720 </para>
7721 <para>
7722 Description
7723 </para></entry>
7724 </row>
7725 </thead>
7727 <tbody>
7728 <row>
7729 <entry role="catalog_table_entry"><para role="column_definition">
7730 <structfield>srsubid</structfield> <type>oid</type>
7731 (references <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.<structfield>oid</structfield>)
7732 </para>
7733 <para>
7734 Reference to subscription
7735 </para></entry>
7736 </row>
7738 <row>
7739 <entry role="catalog_table_entry"><para role="column_definition">
7740 <structfield>srrelid</structfield> <type>oid</type>
7741 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7742 </para>
7743 <para>
7744 Reference to relation
7745 </para></entry>
7746 </row>
7748 <row>
7749 <entry role="catalog_table_entry"><para role="column_definition">
7750 <structfield>srsubstate</structfield> <type>char</type>
7751 </para>
7752 <para>
7753 State code:
7754 <literal>i</literal> = initialize,
7755 <literal>d</literal> = data is being copied,
7756 <literal>f</literal> = finished table copy,
7757 <literal>s</literal> = synchronized,
7758 <literal>r</literal> = ready (normal replication)
7759 </para></entry>
7760 </row>
7762 <row>
7763 <entry role="catalog_table_entry"><para role="column_definition">
7764 <structfield>srsublsn</structfield> <type>pg_lsn</type>
7765 </para>
7766 <para>
7767 Remote LSN of the state change used for synchronization coordination
7768 when in <literal>s</literal> or <literal>r</literal> states,
7769 otherwise null
7770 </para></entry>
7771 </row>
7772 </tbody>
7773 </tgroup>
7774 </table>
7775 </sect1>
7777 <sect1 id="catalog-pg-tablespace">
7778 <title><structname>pg_tablespace</structname></title>
7780 <indexterm zone="catalog-pg-tablespace">
7781 <primary>pg_tablespace</primary>
7782 </indexterm>
7784 <para>
7785 The catalog <structname>pg_tablespace</structname> stores information
7786 about the available tablespaces. Tables can be placed in particular
7787 tablespaces to aid administration of disk layout.
7788 </para>
7790 <para>
7791 Unlike most system catalogs, <structname>pg_tablespace</structname>
7792 is shared across all databases of a cluster: there is only one
7793 copy of <structname>pg_tablespace</structname> per cluster, not
7794 one per database.
7795 </para>
7797 <table>
7798 <title><structname>pg_tablespace</structname> Columns</title>
7799 <tgroup cols="1">
7800 <thead>
7801 <row>
7802 <entry role="catalog_table_entry"><para role="column_definition">
7803 Column Type
7804 </para>
7805 <para>
7806 Description
7807 </para></entry>
7808 </row>
7809 </thead>
7811 <tbody>
7812 <row>
7813 <entry role="catalog_table_entry"><para role="column_definition">
7814 <structfield>oid</structfield> <type>oid</type>
7815 </para>
7816 <para>
7817 Row identifier
7818 </para></entry>
7819 </row>
7821 <row>
7822 <entry role="catalog_table_entry"><para role="column_definition">
7823 <structfield>spcname</structfield> <type>name</type>
7824 </para>
7825 <para>
7826 Tablespace name
7827 </para></entry>
7828 </row>
7830 <row>
7831 <entry role="catalog_table_entry"><para role="column_definition">
7832 <structfield>spcowner</structfield> <type>oid</type>
7833 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7834 </para>
7835 <para>
7836 Owner of the tablespace, usually the user who created it
7837 </para></entry>
7838 </row>
7840 <row>
7841 <entry role="catalog_table_entry"><para role="column_definition">
7842 <structfield>spcacl</structfield> <type>aclitem[]</type>
7843 </para>
7844 <para>
7845 Access privileges; see <xref linkend="ddl-priv"/> for details
7846 </para></entry>
7847 </row>
7849 <row>
7850 <entry role="catalog_table_entry"><para role="column_definition">
7851 <structfield>spcoptions</structfield> <type>text[]</type>
7852 </para>
7853 <para>
7854 Tablespace-level options, as <quote>keyword=value</quote> strings
7855 </para></entry>
7856 </row>
7857 </tbody>
7858 </tgroup>
7859 </table>
7860 </sect1>
7863 <sect1 id="catalog-pg-transform">
7864 <title><structname>pg_transform</structname></title>
7866 <indexterm zone="catalog-pg-transform">
7867 <primary>pg_transform</primary>
7868 </indexterm>
7870 <para>
7871 The catalog <structname>pg_transform</structname> stores information about
7872 transforms, which are a mechanism to adapt data types to procedural
7873 languages. See <xref linkend="sql-createtransform"/> for more information.
7874 </para>
7876 <table>
7877 <title><structname>pg_transform</structname> Columns</title>
7878 <tgroup cols="1">
7879 <thead>
7880 <row>
7881 <entry role="catalog_table_entry"><para role="column_definition">
7882 Column Type
7883 </para>
7884 <para>
7885 Description
7886 </para></entry>
7887 </row>
7888 </thead>
7890 <tbody>
7891 <row>
7892 <entry role="catalog_table_entry"><para role="column_definition">
7893 <structfield>oid</structfield> <type>oid</type>
7894 </para>
7895 <para>
7896 Row identifier
7897 </para></entry>
7898 </row>
7900 <row>
7901 <entry role="catalog_table_entry"><para role="column_definition">
7902 <structfield>trftype</structfield> <type>oid</type>
7903 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
7904 </para>
7905 <para>
7906 OID of the data type this transform is for
7907 </para></entry>
7908 </row>
7910 <row>
7911 <entry role="catalog_table_entry"><para role="column_definition">
7912 <structfield>trflang</structfield> <type>oid</type>
7913 (references <link linkend="catalog-pg-language"><structname>pg_language</structname></link>.<structfield>oid</structfield>)
7914 </para>
7915 <para>
7916 OID of the language this transform is for
7917 </para></entry>
7918 </row>
7920 <row>
7921 <entry role="catalog_table_entry"><para role="column_definition">
7922 <structfield>trffromsql</structfield> <type>regproc</type>
7923 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
7924 </para>
7925 <para>
7926 The OID of the function to use when converting the data type for input
7927 to the procedural language (e.g., function parameters). Zero is stored
7928 if the default behavior should be used.
7929 </para></entry>
7930 </row>
7932 <row>
7933 <entry role="catalog_table_entry"><para role="column_definition">
7934 <structfield>trftosql</structfield> <type>regproc</type>
7935 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
7936 </para>
7937 <para>
7938 The OID of the function to use when converting output from the
7939 procedural language (e.g., return values) to the data type. Zero is
7940 stored if the default behavior should be used.
7941 </para></entry>
7942 </row>
7943 </tbody>
7944 </tgroup>
7945 </table>
7946 </sect1>
7949 <sect1 id="catalog-pg-trigger">
7950 <title><structname>pg_trigger</structname></title>
7952 <indexterm zone="catalog-pg-trigger">
7953 <primary>pg_trigger</primary>
7954 </indexterm>
7956 <para>
7957 The catalog <structname>pg_trigger</structname> stores triggers on tables
7958 and views.
7959 See <xref linkend="sql-createtrigger"/>
7960 for more information.
7961 </para>
7963 <table>
7964 <title><structname>pg_trigger</structname> Columns</title>
7965 <tgroup cols="1">
7966 <thead>
7967 <row>
7968 <entry role="catalog_table_entry"><para role="column_definition">
7969 Column Type
7970 </para>
7971 <para>
7972 Description
7973 </para></entry>
7974 </row>
7975 </thead>
7977 <tbody>
7978 <row>
7979 <entry role="catalog_table_entry"><para role="column_definition">
7980 <structfield>oid</structfield> <type>oid</type>
7981 </para>
7982 <para>
7983 Row identifier
7984 </para></entry>
7985 </row>
7987 <row>
7988 <entry role="catalog_table_entry"><para role="column_definition">
7989 <structfield>tgrelid</structfield> <type>oid</type>
7990 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7991 </para>
7992 <para>
7993 The table this trigger is on
7994 </para></entry>
7995 </row>
7997 <row>
7998 <entry role="catalog_table_entry"><para role="column_definition">
7999 <structfield>tgparentid</structfield> <type>oid</type>
8000 (references <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link>.<structfield>oid</structfield>)
8001 </para>
8002 <para>
8003 Parent trigger that this trigger is cloned from (this happens when
8004 partitions are created or attached to a partitioned table);
8005 zero if not a clone
8006 </para></entry>
8007 </row>
8009 <row>
8010 <entry role="catalog_table_entry"><para role="column_definition">
8011 <structfield>tgname</structfield> <type>name</type>
8012 </para>
8013 <para>
8014 Trigger name (must be unique among triggers of same table)
8015 </para></entry>
8016 </row>
8018 <row>
8019 <entry role="catalog_table_entry"><para role="column_definition">
8020 <structfield>tgfoid</structfield> <type>oid</type>
8021 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8022 </para>
8023 <para>
8024 The function to be called
8025 </para></entry>
8026 </row>
8028 <row>
8029 <entry role="catalog_table_entry"><para role="column_definition">
8030 <structfield>tgtype</structfield> <type>int2</type>
8031 </para>
8032 <para>
8033 Bit mask identifying trigger firing conditions
8034 </para></entry>
8035 </row>
8037 <row>
8038 <entry role="catalog_table_entry"><para role="column_definition">
8039 <structfield>tgenabled</structfield> <type>char</type>
8040 </para>
8041 <para>
8042 Controls in which <xref linkend="guc-session-replication-role"/> modes
8043 the trigger fires.
8044 <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
8045 <literal>D</literal> = trigger is disabled,
8046 <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
8047 <literal>A</literal> = trigger fires always.
8048 </para></entry>
8049 </row>
8051 <row>
8052 <entry role="catalog_table_entry"><para role="column_definition">
8053 <structfield>tgisinternal</structfield> <type>bool</type>
8054 </para>
8055 <para>
8056 True if trigger is internally generated (usually, to enforce
8057 the constraint identified by <structfield>tgconstraint</structfield>)
8058 </para></entry>
8059 </row>
8061 <row>
8062 <entry role="catalog_table_entry"><para role="column_definition">
8063 <structfield>tgconstrrelid</structfield> <type>oid</type>
8064 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8065 </para>
8066 <para>
8067 The table referenced by a referential integrity constraint
8068 (zero if trigger is not for a referential integrity constraint)
8069 </para></entry>
8070 </row>
8072 <row>
8073 <entry role="catalog_table_entry"><para role="column_definition">
8074 <structfield>tgconstrindid</structfield> <type>oid</type>
8075 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8076 </para>
8077 <para>
8078 The index supporting a unique, primary key, referential integrity,
8079 or exclusion constraint
8080 (zero if trigger is not for one of these types of constraint)
8081 </para></entry>
8082 </row>
8084 <row>
8085 <entry role="catalog_table_entry"><para role="column_definition">
8086 <structfield>tgconstraint</structfield> <type>oid</type>
8087 (references <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.<structfield>oid</structfield>)
8088 </para>
8089 <para>
8090 The <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> entry associated with the trigger
8091 (zero if trigger is not for a constraint)
8092 </para></entry>
8093 </row>
8095 <row>
8096 <entry role="catalog_table_entry"><para role="column_definition">
8097 <structfield>tgdeferrable</structfield> <type>bool</type>
8098 </para>
8099 <para>
8100 True if constraint trigger is deferrable
8101 </para></entry>
8102 </row>
8104 <row>
8105 <entry role="catalog_table_entry"><para role="column_definition">
8106 <structfield>tginitdeferred</structfield> <type>bool</type>
8107 </para>
8108 <para>
8109 True if constraint trigger is initially deferred
8110 </para></entry>
8111 </row>
8113 <row>
8114 <entry role="catalog_table_entry"><para role="column_definition">
8115 <structfield>tgnargs</structfield> <type>int2</type>
8116 </para>
8117 <para>
8118 Number of argument strings passed to trigger function
8119 </para></entry>
8120 </row>
8122 <row>
8123 <entry role="catalog_table_entry"><para role="column_definition">
8124 <structfield>tgattr</structfield> <type>int2vector</type>
8125 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
8126 </para>
8127 <para>
8128 Column numbers, if trigger is column-specific; otherwise an
8129 empty array
8130 </para></entry>
8131 </row>
8133 <row>
8134 <entry role="catalog_table_entry"><para role="column_definition">
8135 <structfield>tgargs</structfield> <type>bytea</type>
8136 </para>
8137 <para>
8138 Argument strings to pass to trigger, each NULL-terminated
8139 </para></entry>
8140 </row>
8142 <row>
8143 <entry role="catalog_table_entry"><para role="column_definition">
8144 <structfield>tgqual</structfield> <type>pg_node_tree</type>
8145 </para>
8146 <para>
8147 Expression tree (in <function>nodeToString()</function>
8148 representation) for the trigger's <literal>WHEN</literal> condition, or null
8149 if none
8150 </para></entry>
8151 </row>
8153 <row>
8154 <entry role="catalog_table_entry"><para role="column_definition">
8155 <structfield>tgoldtable</structfield> <type>name</type>
8156 </para>
8157 <para>
8158 <literal>REFERENCING</literal> clause name for <literal>OLD TABLE</literal>,
8159 or null if none
8160 </para></entry>
8161 </row>
8163 <row>
8164 <entry role="catalog_table_entry"><para role="column_definition">
8165 <structfield>tgnewtable</structfield> <type>name</type>
8166 </para>
8167 <para>
8168 <literal>REFERENCING</literal> clause name for <literal>NEW TABLE</literal>,
8169 or null if none
8170 </para></entry>
8171 </row>
8172 </tbody>
8173 </tgroup>
8174 </table>
8176 <para>
8177 Currently, column-specific triggering is supported only for
8178 <literal>UPDATE</literal> events, and so <structfield>tgattr</structfield> is relevant
8179 only for that event type. <structfield>tgtype</structfield> might
8180 contain bits for other event types as well, but those are presumed
8181 to be table-wide regardless of what is in <structfield>tgattr</structfield>.
8182 </para>
8184 <note>
8185 <para>
8186 When <structfield>tgconstraint</structfield> is nonzero,
8187 <structfield>tgconstrrelid</structfield>, <structfield>tgconstrindid</structfield>,
8188 <structfield>tgdeferrable</structfield>, and <structfield>tginitdeferred</structfield> are
8189 largely redundant with the referenced <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> entry.
8190 However, it is possible for a non-deferrable trigger to be associated
8191 with a deferrable constraint: foreign key constraints can have some
8192 deferrable and some non-deferrable triggers.
8193 </para>
8194 </note>
8196 <note>
8197 <para>
8198 <literal>pg_class.relhastriggers</literal>
8199 must be true if a relation has any triggers in this catalog.
8200 </para>
8201 </note>
8203 </sect1>
8206 <sect1 id="catalog-pg-ts-config">
8207 <title><structname>pg_ts_config</structname></title>
8209 <indexterm zone="catalog-pg-ts-config">
8210 <primary>pg_ts_config</primary>
8211 </indexterm>
8213 <para>
8214 The <structname>pg_ts_config</structname> catalog contains entries
8215 representing text search configurations. A configuration specifies
8216 a particular text search parser and a list of dictionaries to use
8217 for each of the parser's output token types. The parser is shown
8218 in the <structname>pg_ts_config</structname> entry, but the
8219 token-to-dictionary mapping is defined by subsidiary entries in <link
8220 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
8221 </para>
8223 <para>
8224 <productname>PostgreSQL</productname>'s text search features are
8225 described at length in <xref linkend="textsearch"/>.
8226 </para>
8228 <table>
8229 <title><structname>pg_ts_config</structname> Columns</title>
8230 <tgroup cols="1">
8231 <thead>
8232 <row>
8233 <entry role="catalog_table_entry"><para role="column_definition">
8234 Column Type
8235 </para>
8236 <para>
8237 Description
8238 </para></entry>
8239 </row>
8240 </thead>
8242 <tbody>
8243 <row>
8244 <entry role="catalog_table_entry"><para role="column_definition">
8245 <structfield>oid</structfield> <type>oid</type>
8246 </para>
8247 <para>
8248 Row identifier
8249 </para></entry>
8250 </row>
8252 <row>
8253 <entry role="catalog_table_entry"><para role="column_definition">
8254 <structfield>cfgname</structfield> <type>name</type>
8255 </para>
8256 <para>
8257 Text search configuration name
8258 </para></entry>
8259 </row>
8261 <row>
8262 <entry role="catalog_table_entry"><para role="column_definition">
8263 <structfield>cfgnamespace</structfield> <type>oid</type>
8264 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8265 </para>
8266 <para>
8267 The OID of the namespace that contains this configuration
8268 </para></entry>
8269 </row>
8271 <row>
8272 <entry role="catalog_table_entry"><para role="column_definition">
8273 <structfield>cfgowner</structfield> <type>oid</type>
8274 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8275 </para>
8276 <para>
8277 Owner of the configuration
8278 </para></entry>
8279 </row>
8281 <row>
8282 <entry role="catalog_table_entry"><para role="column_definition">
8283 <structfield>cfgparser</structfield> <type>oid</type>
8284 (references <link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.<structfield>oid</structfield>)
8285 </para>
8286 <para>
8287 The OID of the text search parser for this configuration
8288 </para></entry>
8289 </row>
8290 </tbody>
8291 </tgroup>
8292 </table>
8293 </sect1>
8296 <sect1 id="catalog-pg-ts-config-map">
8297 <title><structname>pg_ts_config_map</structname></title>
8299 <indexterm zone="catalog-pg-ts-config-map">
8300 <primary>pg_ts_config_map</primary>
8301 </indexterm>
8303 <para>
8304 The <structname>pg_ts_config_map</structname> catalog contains entries
8305 showing which text search dictionaries should be consulted, and in
8306 what order, for each output token type of each text search configuration's
8307 parser.
8308 </para>
8310 <para>
8311 <productname>PostgreSQL</productname>'s text search features are
8312 described at length in <xref linkend="textsearch"/>.
8313 </para>
8315 <table>
8316 <title><structname>pg_ts_config_map</structname> Columns</title>
8317 <tgroup cols="1">
8318 <thead>
8319 <row>
8320 <entry role="catalog_table_entry"><para role="column_definition">
8321 Column Type
8322 </para>
8323 <para>
8324 Description
8325 </para></entry>
8326 </row>
8327 </thead>
8329 <tbody>
8330 <row>
8331 <entry role="catalog_table_entry"><para role="column_definition">
8332 <structfield>mapcfg</structfield> <type>oid</type>
8333 (references <link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.<structfield>oid</structfield>)
8334 </para>
8335 <para>
8336 The OID of the <link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link> entry owning this map entry
8337 </para></entry>
8338 </row>
8340 <row>
8341 <entry role="catalog_table_entry"><para role="column_definition">
8342 <structfield>maptokentype</structfield> <type>int4</type>
8343 </para>
8344 <para>
8345 A token type emitted by the configuration's parser
8346 </para></entry>
8347 </row>
8349 <row>
8350 <entry role="catalog_table_entry"><para role="column_definition">
8351 <structfield>mapseqno</structfield> <type>int4</type>
8352 </para>
8353 <para>
8354 Order in which to consult this entry (lower
8355 <structfield>mapseqno</structfield>s first)
8356 </para></entry>
8357 </row>
8359 <row>
8360 <entry role="catalog_table_entry"><para role="column_definition">
8361 <structfield>mapdict</structfield> <type>oid</type>
8362 (references <link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.<structfield>oid</structfield>)
8363 </para>
8364 <para>
8365 The OID of the text search dictionary to consult
8366 </para></entry>
8367 </row>
8368 </tbody>
8369 </tgroup>
8370 </table>
8371 </sect1>
8374 <sect1 id="catalog-pg-ts-dict">
8375 <title><structname>pg_ts_dict</structname></title>
8377 <indexterm zone="catalog-pg-ts-dict">
8378 <primary>pg_ts_dict</primary>
8379 </indexterm>
8381 <para>
8382 The <structname>pg_ts_dict</structname> catalog contains entries
8383 defining text search dictionaries. A dictionary depends on a text
8384 search template, which specifies all the implementation functions
8385 needed; the dictionary itself provides values for the user-settable
8386 parameters supported by the template. This division of labor allows
8387 dictionaries to be created by unprivileged users. The parameters
8388 are specified by a text string <structfield>dictinitoption</structfield>,
8389 whose format and meaning vary depending on the template.
8390 </para>
8392 <para>
8393 <productname>PostgreSQL</productname>'s text search features are
8394 described at length in <xref linkend="textsearch"/>.
8395 </para>
8397 <table>
8398 <title><structname>pg_ts_dict</structname> Columns</title>
8399 <tgroup cols="1">
8400 <thead>
8401 <row>
8402 <entry role="catalog_table_entry"><para role="column_definition">
8403 Column Type
8404 </para>
8405 <para>
8406 Description
8407 </para></entry>
8408 </row>
8409 </thead>
8411 <tbody>
8412 <row>
8413 <entry role="catalog_table_entry"><para role="column_definition">
8414 <structfield>oid</structfield> <type>oid</type>
8415 </para>
8416 <para>
8417 Row identifier
8418 </para></entry>
8419 </row>
8421 <row>
8422 <entry role="catalog_table_entry"><para role="column_definition">
8423 <structfield>dictname</structfield> <type>name</type>
8424 </para>
8425 <para>
8426 Text search dictionary name
8427 </para></entry>
8428 </row>
8430 <row>
8431 <entry role="catalog_table_entry"><para role="column_definition">
8432 <structfield>dictnamespace</structfield> <type>oid</type>
8433 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8434 </para>
8435 <para>
8436 The OID of the namespace that contains this dictionary
8437 </para></entry>
8438 </row>
8440 <row>
8441 <entry role="catalog_table_entry"><para role="column_definition">
8442 <structfield>dictowner</structfield> <type>oid</type>
8443 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8444 </para>
8445 <para>
8446 Owner of the dictionary
8447 </para></entry>
8448 </row>
8450 <row>
8451 <entry role="catalog_table_entry"><para role="column_definition">
8452 <structfield>dicttemplate</structfield> <type>oid</type>
8453 (references <link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.<structfield>oid</structfield>)
8454 </para>
8455 <para>
8456 The OID of the text search template for this dictionary
8457 </para></entry>
8458 </row>
8460 <row>
8461 <entry role="catalog_table_entry"><para role="column_definition">
8462 <structfield>dictinitoption</structfield> <type>text</type>
8463 </para>
8464 <para>
8465 Initialization option string for the template
8466 </para></entry>
8467 </row>
8468 </tbody>
8469 </tgroup>
8470 </table>
8471 </sect1>
8474 <sect1 id="catalog-pg-ts-parser">
8475 <title><structname>pg_ts_parser</structname></title>
8477 <indexterm zone="catalog-pg-ts-parser">
8478 <primary>pg_ts_parser</primary>
8479 </indexterm>
8481 <para>
8482 The <structname>pg_ts_parser</structname> catalog contains entries
8483 defining text search parsers. A parser is responsible for splitting
8484 input text into lexemes and assigning a token type to each lexeme.
8485 Since a parser must be implemented by C-language-level functions,
8486 creation of new parsers is restricted to database superusers.
8487 </para>
8489 <para>
8490 <productname>PostgreSQL</productname>'s text search features are
8491 described at length in <xref linkend="textsearch"/>.
8492 </para>
8494 <table>
8495 <title><structname>pg_ts_parser</structname> Columns</title>
8496 <tgroup cols="1">
8497 <thead>
8498 <row>
8499 <entry role="catalog_table_entry"><para role="column_definition">
8500 Column Type
8501 </para>
8502 <para>
8503 Description
8504 </para></entry>
8505 </row>
8506 </thead>
8508 <tbody>
8509 <row>
8510 <entry role="catalog_table_entry"><para role="column_definition">
8511 <structfield>oid</structfield> <type>oid</type>
8512 </para>
8513 <para>
8514 Row identifier
8515 </para></entry>
8516 </row>
8518 <row>
8519 <entry role="catalog_table_entry"><para role="column_definition">
8520 <structfield>prsname</structfield> <type>name</type>
8521 </para>
8522 <para>
8523 Text search parser name
8524 </para></entry>
8525 </row>
8527 <row>
8528 <entry role="catalog_table_entry"><para role="column_definition">
8529 <structfield>prsnamespace</structfield> <type>oid</type>
8530 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8531 </para>
8532 <para>
8533 The OID of the namespace that contains this parser
8534 </para></entry>
8535 </row>
8537 <row>
8538 <entry role="catalog_table_entry"><para role="column_definition">
8539 <structfield>prsstart</structfield> <type>regproc</type>
8540 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8541 </para>
8542 <para>
8543 OID of the parser's startup function
8544 </para></entry>
8545 </row>
8547 <row>
8548 <entry role="catalog_table_entry"><para role="column_definition">
8549 <structfield>prstoken</structfield> <type>regproc</type>
8550 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8551 </para>
8552 <para>
8553 OID of the parser's next-token function
8554 </para></entry>
8555 </row>
8557 <row>
8558 <entry role="catalog_table_entry"><para role="column_definition">
8559 <structfield>prsend</structfield> <type>regproc</type>
8560 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8561 </para>
8562 <para>
8563 OID of the parser's shutdown function
8564 </para></entry>
8565 </row>
8567 <row>
8568 <entry role="catalog_table_entry"><para role="column_definition">
8569 <structfield>prsheadline</structfield> <type>regproc</type>
8570 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8571 </para>
8572 <para>
8573 OID of the parser's headline function (zero if none)
8574 </para></entry>
8575 </row>
8577 <row>
8578 <entry role="catalog_table_entry"><para role="column_definition">
8579 <structfield>prslextype</structfield> <type>regproc</type>
8580 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8581 </para>
8582 <para>
8583 OID of the parser's lextype function
8584 </para></entry>
8585 </row>
8586 </tbody>
8587 </tgroup>
8588 </table>
8589 </sect1>
8592 <sect1 id="catalog-pg-ts-template">
8593 <title><structname>pg_ts_template</structname></title>
8595 <indexterm zone="catalog-pg-ts-template">
8596 <primary>pg_ts_template</primary>
8597 </indexterm>
8599 <para>
8600 The <structname>pg_ts_template</structname> catalog contains entries
8601 defining text search templates. A template is the implementation
8602 skeleton for a class of text search dictionaries.
8603 Since a template must be implemented by C-language-level functions,
8604 creation of new templates is restricted to database superusers.
8605 </para>
8607 <para>
8608 <productname>PostgreSQL</productname>'s text search features are
8609 described at length in <xref linkend="textsearch"/>.
8610 </para>
8612 <table>
8613 <title><structname>pg_ts_template</structname> Columns</title>
8614 <tgroup cols="1">
8615 <thead>
8616 <row>
8617 <entry role="catalog_table_entry"><para role="column_definition">
8618 Column Type
8619 </para>
8620 <para>
8621 Description
8622 </para></entry>
8623 </row>
8624 </thead>
8626 <tbody>
8627 <row>
8628 <entry role="catalog_table_entry"><para role="column_definition">
8629 <structfield>oid</structfield> <type>oid</type>
8630 </para>
8631 <para>
8632 Row identifier
8633 </para></entry>
8634 </row>
8636 <row>
8637 <entry role="catalog_table_entry"><para role="column_definition">
8638 <structfield>tmplname</structfield> <type>name</type>
8639 </para>
8640 <para>
8641 Text search template name
8642 </para></entry>
8643 </row>
8645 <row>
8646 <entry role="catalog_table_entry"><para role="column_definition">
8647 <structfield>tmplnamespace</structfield> <type>oid</type>
8648 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8649 </para>
8650 <para>
8651 The OID of the namespace that contains this template
8652 </para></entry>
8653 </row>
8655 <row>
8656 <entry role="catalog_table_entry"><para role="column_definition">
8657 <structfield>tmplinit</structfield> <type>regproc</type>
8658 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8659 </para>
8660 <para>
8661 OID of the template's initialization function (zero if none)
8662 </para></entry>
8663 </row>
8665 <row>
8666 <entry role="catalog_table_entry"><para role="column_definition">
8667 <structfield>tmpllexize</structfield> <type>regproc</type>
8668 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8669 </para>
8670 <para>
8671 OID of the template's lexize function
8672 </para></entry>
8673 </row>
8674 </tbody>
8675 </tgroup>
8676 </table>
8677 </sect1>
8680 <sect1 id="catalog-pg-type">
8681 <title><structname>pg_type</structname></title>
8683 <indexterm zone="catalog-pg-type">
8684 <primary>pg_type</primary>
8685 </indexterm>
8687 <para>
8688 The catalog <structname>pg_type</structname> stores information about data
8689 types. Base types and enum types (scalar types) are created with
8690 <link linkend="sql-createtype"><command>CREATE TYPE</command></link>, and
8691 domains with
8692 <link linkend="sql-createdomain"><command>CREATE DOMAIN</command></link>.
8693 A composite type is automatically created for each table in the database, to
8694 represent the row structure of the table. It is also possible to create
8695 composite types with <command>CREATE TYPE AS</command>.
8696 </para>
8698 <table>
8699 <title><structname>pg_type</structname> Columns</title>
8700 <tgroup cols="1">
8701 <thead>
8702 <row>
8703 <entry role="catalog_table_entry"><para role="column_definition">
8704 Column Type
8705 </para>
8706 <para>
8707 Description
8708 </para></entry>
8709 </row>
8710 </thead>
8712 <tbody>
8713 <row>
8714 <entry role="catalog_table_entry"><para role="column_definition">
8715 <structfield>oid</structfield> <type>oid</type>
8716 </para>
8717 <para>
8718 Row identifier
8719 </para></entry>
8720 </row>
8722 <row>
8723 <entry role="catalog_table_entry"><para role="column_definition">
8724 <structfield>typname</structfield> <type>name</type>
8725 </para>
8726 <para>
8727 Data type name
8728 </para></entry>
8729 </row>
8731 <row>
8732 <entry role="catalog_table_entry"><para role="column_definition">
8733 <structfield>typnamespace</structfield> <type>oid</type>
8734 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8735 </para>
8736 <para>
8737 The OID of the namespace that contains this type
8738 </para></entry>
8739 </row>
8741 <row>
8742 <entry role="catalog_table_entry"><para role="column_definition">
8743 <structfield>typowner</structfield> <type>oid</type>
8744 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8745 </para>
8746 <para>
8747 Owner of the type
8748 </para></entry>
8749 </row>
8751 <row>
8752 <entry role="catalog_table_entry"><para role="column_definition">
8753 <structfield>typlen</structfield> <type>int2</type>
8754 </para>
8755 <para>
8756 For a fixed-size type, <structfield>typlen</structfield> is the number
8757 of bytes in the internal representation of the type. But for a
8758 variable-length type, <structfield>typlen</structfield> is negative.
8759 -1 indicates a <quote>varlena</quote> type (one that has a length word),
8760 -2 indicates a null-terminated C string.
8761 </para></entry>
8762 </row>
8764 <row>
8765 <entry role="catalog_table_entry"><para role="column_definition">
8766 <structfield>typbyval</structfield> <type>bool</type>
8767 </para>
8768 <para>
8769 <structfield>typbyval</structfield> determines whether internal
8770 routines pass a value of this type by value or by reference.
8771 <structfield>typbyval</structfield> had better be false if
8772 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
8773 where Datum is 8 bytes).
8774 Variable-length types are always passed by reference. Note that
8775 <structfield>typbyval</structfield> can be false even if the
8776 length would allow pass-by-value.
8777 </para></entry>
8778 </row>
8780 <row>
8781 <entry role="catalog_table_entry"><para role="column_definition">
8782 <structfield>typtype</structfield> <type>char</type>
8783 </para>
8784 <para>
8785 <structfield>typtype</structfield> is
8786 <literal>b</literal> for a base type,
8787 <literal>c</literal> for a composite type (e.g., a table's row type),
8788 <literal>d</literal> for a domain,
8789 <literal>e</literal> for an enum type,
8790 <literal>p</literal> for a pseudo-type,
8791 <literal>r</literal> for a range type, or
8792 <literal>m</literal> for a multirange type.
8793 See also <structfield>typrelid</structfield> and
8794 <structfield>typbasetype</structfield>.
8795 </para></entry>
8796 </row>
8798 <row>
8799 <entry role="catalog_table_entry"><para role="column_definition">
8800 <structfield>typcategory</structfield> <type>char</type>
8801 </para>
8802 <para>
8803 <structfield>typcategory</structfield> is an arbitrary classification
8804 of data types that is used by the parser to determine which implicit
8805 casts should be <quote>preferred</quote>.
8806 See <xref linkend="catalog-typcategory-table"/>.
8807 </para></entry>
8808 </row>
8810 <row>
8811 <entry role="catalog_table_entry"><para role="column_definition">
8812 <structfield>typispreferred</structfield> <type>bool</type>
8813 </para>
8814 <para>
8815 True if the type is a preferred cast target within its
8816 <structfield>typcategory</structfield>
8817 </para></entry>
8818 </row>
8820 <row>
8821 <entry role="catalog_table_entry"><para role="column_definition">
8822 <structfield>typisdefined</structfield> <type>bool</type>
8823 </para>
8824 <para>
8825 True if the type is defined, false if this is a placeholder
8826 entry for a not-yet-defined type. When
8827 <structfield>typisdefined</structfield> is false, nothing
8828 except the type name, namespace, and OID can be relied on.
8829 </para></entry>
8830 </row>
8832 <row>
8833 <entry role="catalog_table_entry"><para role="column_definition">
8834 <structfield>typdelim</structfield> <type>char</type>
8835 </para>
8836 <para>
8837 Character that separates two values of this type when parsing
8838 array input. Note that the delimiter is associated with the array
8839 element data type, not the array data type.
8840 </para></entry>
8841 </row>
8843 <row>
8844 <entry role="catalog_table_entry"><para role="column_definition">
8845 <structfield>typrelid</structfield> <type>oid</type>
8846 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8847 </para>
8848 <para>
8849 If this is a composite type (see
8850 <structfield>typtype</structfield>), then this column points to
8851 the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry that defines the
8852 corresponding table. (For a free-standing composite type, the
8853 <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry doesn't really represent
8854 a table, but it is needed anyway for the type's
8855 <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link> entries to link to.)
8856 Zero for non-composite types.
8857 </para></entry>
8858 </row>
8860 <row>
8861 <entry role="catalog_table_entry"><para role="column_definition">
8862 <structfield>typsubscript</structfield> <type>regproc</type>
8863 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8864 </para>
8865 <para>
8866 Subscripting handler function's OID, or zero if this type doesn't
8867 support subscripting. Types that are <quote>true</quote> array
8868 types have <structfield>typsubscript</structfield>
8869 = <function>array_subscript_handler</function>, but other types may
8870 have other handler functions to implement specialized subscripting
8871 behavior.
8872 </para></entry>
8873 </row>
8875 <row>
8876 <entry role="catalog_table_entry"><para role="column_definition">
8877 <structfield>typelem</structfield> <type>oid</type>
8878 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
8879 </para>
8880 <para>
8881 If <structfield>typelem</structfield> is not zero then it
8882 identifies another row in <structname>pg_type</structname>,
8883 defining the type yielded by subscripting. This should be zero
8884 if <structfield>typsubscript</structfield> is zero. However, it can
8885 be zero when <structfield>typsubscript</structfield> isn't zero, if the
8886 handler doesn't need <structfield>typelem</structfield> to
8887 determine the subscripting result type.
8888 Note that a <structfield>typelem</structfield> dependency is
8889 considered to imply physical containment of the element type in
8890 this type; so DDL changes on the element type might be restricted
8891 by the presence of this type.
8892 </para></entry>
8893 </row>
8895 <row>
8896 <entry role="catalog_table_entry"><para role="column_definition">
8897 <structfield>typarray</structfield> <type>oid</type>
8898 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
8899 </para>
8900 <para>
8901 If <structfield>typarray</structfield> is not zero then it
8902 identifies another row in <structname>pg_type</structname>, which
8903 is the <quote>true</quote> array type having this type as element
8904 </para></entry>
8905 </row>
8907 <row>
8908 <entry role="catalog_table_entry"><para role="column_definition">
8909 <structfield>typinput</structfield> <type>regproc</type>
8910 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8911 </para>
8912 <para>
8913 Input conversion function (text format)
8914 </para></entry>
8915 </row>
8917 <row>
8918 <entry role="catalog_table_entry"><para role="column_definition">
8919 <structfield>typoutput</structfield> <type>regproc</type>
8920 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8921 </para>
8922 <para>
8923 Output conversion function (text format)
8924 </para></entry>
8925 </row>
8927 <row>
8928 <entry role="catalog_table_entry"><para role="column_definition">
8929 <structfield>typreceive</structfield> <type>regproc</type>
8930 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8931 </para>
8932 <para>
8933 Input conversion function (binary format), or zero if none
8934 </para></entry>
8935 </row>
8937 <row>
8938 <entry role="catalog_table_entry"><para role="column_definition">
8939 <structfield>typsend</structfield> <type>regproc</type>
8940 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8941 </para>
8942 <para>
8943 Output conversion function (binary format), or zero if none
8944 </para></entry>
8945 </row>
8947 <row>
8948 <entry role="catalog_table_entry"><para role="column_definition">
8949 <structfield>typmodin</structfield> <type>regproc</type>
8950 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8951 </para>
8952 <para>
8953 Type modifier input function, or zero if type does not support modifiers
8954 </para></entry>
8955 </row>
8957 <row>
8958 <entry role="catalog_table_entry"><para role="column_definition">
8959 <structfield>typmodout</structfield> <type>regproc</type>
8960 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8961 </para>
8962 <para>
8963 Type modifier output function, or zero to use the standard format
8964 </para></entry>
8965 </row>
8967 <row>
8968 <entry role="catalog_table_entry"><para role="column_definition">
8969 <structfield>typanalyze</structfield> <type>regproc</type>
8970 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8971 </para>
8972 <para>
8973 Custom <xref linkend="sql-analyze"/> function,
8974 or zero to use the standard function
8975 </para></entry>
8976 </row>
8978 <row>
8979 <entry role="catalog_table_entry"><para role="column_definition">
8980 <structfield>typalign</structfield> <type>char</type>
8981 </para>
8982 <para>
8983 <structfield>typalign</structfield> is the alignment required
8984 when storing a value of this type. It applies to storage on
8985 disk as well as most representations of the value inside
8986 <productname>PostgreSQL</productname>.
8987 When multiple values are stored consecutively, such
8988 as in the representation of a complete row on disk, padding is
8989 inserted before a datum of this type so that it begins on the
8990 specified boundary. The alignment reference is the beginning
8991 of the first datum in the sequence.
8992 Possible values are:
8993 <itemizedlist>
8994 <listitem>
8995 <para><literal>c</literal> = <type>char</type> alignment, i.e., no alignment needed.</para>
8996 </listitem>
8997 <listitem>
8998 <para><literal>s</literal> = <type>short</type> alignment (2 bytes on most machines).</para>
8999 </listitem>
9000 <listitem>
9001 <para><literal>i</literal> = <type>int</type> alignment (4 bytes on most machines).</para>
9002 </listitem>
9003 <listitem>
9004 <para><literal>d</literal> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
9005 </listitem>
9006 </itemizedlist>
9007 </para></entry>
9008 </row>
9010 <row>
9011 <entry role="catalog_table_entry"><para role="column_definition">
9012 <structfield>typstorage</structfield> <type>char</type>
9013 </para>
9014 <para>
9015 <structfield>typstorage</structfield> tells for varlena
9016 types (those with <structfield>typlen</structfield> = -1) if
9017 the type is prepared for toasting and what the default strategy
9018 for attributes of this type should be.
9019 Possible values are:
9020 <itemizedlist>
9021 <listitem>
9022 <para>
9023 <literal>p</literal> (plain): Values must always be stored plain
9024 (non-varlena types always use this value).
9025 </para>
9026 </listitem>
9027 <listitem>
9028 <para>
9029 <literal>e</literal> (external): Values can be stored in a
9030 secondary <quote>TOAST</quote> relation (if relation has one, see
9031 <literal>pg_class.reltoastrelid</literal>).
9032 </para>
9033 </listitem>
9034 <listitem>
9035 <para>
9036 <literal>m</literal> (main): Values can be compressed and stored
9037 inline.
9038 </para>
9039 </listitem>
9040 <listitem>
9041 <para>
9042 <literal>x</literal> (extended): Values can be compressed and/or
9043 moved to a secondary relation.
9044 </para>
9045 </listitem>
9046 </itemizedlist>
9047 <literal>x</literal> is the usual choice for toast-able types.
9048 Note that <literal>m</literal> values can also be moved out to
9049 secondary storage, but only as a last resort (<literal>e</literal>
9050 and <literal>x</literal> values are moved first).
9051 </para></entry>
9052 </row>
9054 <row>
9055 <entry role="catalog_table_entry"><para role="column_definition">
9056 <structfield>typnotnull</structfield> <type>bool</type>
9057 </para>
9058 <para>
9059 <structfield>typnotnull</structfield> represents a not-null
9060 constraint on a type. Used for domains only.
9061 </para></entry>
9062 </row>
9064 <row>
9065 <entry role="catalog_table_entry"><para role="column_definition">
9066 <structfield>typbasetype</structfield> <type>oid</type>
9067 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
9068 </para>
9069 <para>
9070 If this is a domain (see <structfield>typtype</structfield>), then
9071 <structfield>typbasetype</structfield> identifies the type that this
9072 one is based on. Zero if this type is not a domain.
9073 </para></entry>
9074 </row>
9076 <row>
9077 <entry role="catalog_table_entry"><para role="column_definition">
9078 <structfield>typtypmod</structfield> <type>int4</type>
9079 </para>
9080 <para>
9081 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</literal>
9082 to be applied to their base type (-1 if base type does not use a
9083 <literal>typmod</literal>). -1 if this type is not a domain.
9084 </para></entry>
9085 </row>
9087 <row>
9088 <entry role="catalog_table_entry"><para role="column_definition">
9089 <structfield>typndims</structfield> <type>int4</type>
9090 </para>
9091 <para>
9092 <structfield>typndims</structfield> is the number of array dimensions
9093 for a domain over an array (that is, <structfield>typbasetype</structfield> is
9094 an array type).
9095 Zero for types other than domains over array types.
9096 </para></entry>
9097 </row>
9099 <row>
9100 <entry role="catalog_table_entry"><para role="column_definition">
9101 <structfield>typcollation</structfield> <type>oid</type>
9102 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
9103 </para>
9104 <para>
9105 <structfield>typcollation</structfield> specifies the collation
9106 of the type. If the type does not support collations, this will
9107 be zero. A base type that supports collations will have a nonzero
9108 value here, typically <symbol>DEFAULT_COLLATION_OID</symbol>.
9109 A domain over a collatable type can have a collation OID different
9110 from its base type's, if one was specified for the domain.
9111 </para></entry>
9112 </row>
9114 <row>
9115 <entry role="catalog_table_entry"><para role="column_definition">
9116 <structfield>typdefaultbin</structfield> <type>pg_node_tree</type>
9117 </para>
9118 <para>
9119 If <structfield>typdefaultbin</structfield> is not null, it is the
9120 <function>nodeToString()</function>
9121 representation of a default expression for the type. This is
9122 only used for domains.
9123 </para></entry>
9124 </row>
9126 <row>
9127 <entry role="catalog_table_entry"><para role="column_definition">
9128 <structfield>typdefault</structfield> <type>text</type>
9129 </para>
9130 <para>
9131 <structfield>typdefault</structfield> is null if the type has no associated
9132 default value. If <structfield>typdefaultbin</structfield> is not null,
9133 <structfield>typdefault</structfield> must contain a human-readable version of the
9134 default expression represented by <structfield>typdefaultbin</structfield>. If
9135 <structfield>typdefaultbin</structfield> is null and <structfield>typdefault</structfield> is
9136 not, then <structfield>typdefault</structfield> is the external representation of
9137 the type's default value, which can be fed to the type's input
9138 converter to produce a constant.
9139 </para></entry>
9140 </row>
9142 <row>
9143 <entry role="catalog_table_entry"><para role="column_definition">
9144 <structfield>typacl</structfield> <type>aclitem[]</type>
9145 </para>
9146 <para>
9147 Access privileges; see <xref linkend="ddl-priv"/> for details
9148 </para></entry>
9149 </row>
9150 </tbody>
9151 </tgroup>
9152 </table>
9154 <note>
9155 <para>
9156 For fixed-width types used in system tables, it is critical that the size
9157 and alignment defined in <structname>pg_type</structname>
9158 agree with the way that the compiler will lay out the column in
9159 a structure representing a table row.
9160 </para>
9161 </note>
9163 <para>
9164 <xref linkend="catalog-typcategory-table"/> lists the system-defined values
9165 of <structfield>typcategory</structfield>. Any future additions to this list will
9166 also be upper-case ASCII letters. All other ASCII characters are reserved
9167 for user-defined categories.
9168 </para>
9170 <table id="catalog-typcategory-table">
9171 <title><structfield>typcategory</structfield> Codes</title>
9173 <tgroup cols="2">
9174 <thead>
9175 <row>
9176 <entry>Code</entry>
9177 <entry>Category</entry>
9178 </row>
9179 </thead>
9181 <tbody>
9182 <row>
9183 <entry><literal>A</literal></entry>
9184 <entry>Array types</entry>
9185 </row>
9186 <row>
9187 <entry><literal>B</literal></entry>
9188 <entry>Boolean types</entry>
9189 </row>
9190 <row>
9191 <entry><literal>C</literal></entry>
9192 <entry>Composite types</entry>
9193 </row>
9194 <row>
9195 <entry><literal>D</literal></entry>
9196 <entry>Date/time types</entry>
9197 </row>
9198 <row>
9199 <entry><literal>E</literal></entry>
9200 <entry>Enum types</entry>
9201 </row>
9202 <row>
9203 <entry><literal>G</literal></entry>
9204 <entry>Geometric types</entry>
9205 </row>
9206 <row>
9207 <entry><literal>I</literal></entry>
9208 <entry>Network address types</entry>
9209 </row>
9210 <row>
9211 <entry><literal>N</literal></entry>
9212 <entry>Numeric types</entry>
9213 </row>
9214 <row>
9215 <entry><literal>P</literal></entry>
9216 <entry>Pseudo-types</entry>
9217 </row>
9218 <row>
9219 <entry><literal>R</literal></entry>
9220 <entry>Range types</entry>
9221 </row>
9222 <row>
9223 <entry><literal>S</literal></entry>
9224 <entry>String types</entry>
9225 </row>
9226 <row>
9227 <entry><literal>T</literal></entry>
9228 <entry>Timespan types</entry>
9229 </row>
9230 <row>
9231 <entry><literal>U</literal></entry>
9232 <entry>User-defined types</entry>
9233 </row>
9234 <row>
9235 <entry><literal>V</literal></entry>
9236 <entry>Bit-string types</entry>
9237 </row>
9238 <row>
9239 <entry><literal>X</literal></entry>
9240 <entry><type>unknown</type> type</entry>
9241 </row>
9242 </tbody>
9243 </tgroup>
9244 </table>
9246 </sect1>
9249 <sect1 id="catalog-pg-user-mapping">
9250 <title><structname>pg_user_mapping</structname></title>
9252 <indexterm zone="catalog-pg-user-mapping">
9253 <primary>pg_user_mapping</primary>
9254 </indexterm>
9256 <para>
9257 The catalog <structname>pg_user_mapping</structname> stores
9258 the mappings from local user to remote. Access to this catalog is
9259 restricted from normal users, use the view
9260 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
9261 instead.
9262 </para>
9264 <table>
9265 <title><structname>pg_user_mapping</structname> Columns</title>
9266 <tgroup cols="1">
9267 <thead>
9268 <row>
9269 <entry role="catalog_table_entry"><para role="column_definition">
9270 Column Type
9271 </para>
9272 <para>
9273 Description
9274 </para></entry>
9275 </row>
9276 </thead>
9278 <tbody>
9279 <row>
9280 <entry role="catalog_table_entry"><para role="column_definition">
9281 <structfield>oid</structfield> <type>oid</type>
9282 </para>
9283 <para>
9284 Row identifier
9285 </para></entry>
9286 </row>
9288 <row>
9289 <entry role="catalog_table_entry"><para role="column_definition">
9290 <structfield>umuser</structfield> <type>oid</type>
9291 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
9292 </para>
9293 <para>
9294 OID of the local role being mapped, or zero if the user mapping is public
9295 </para></entry>
9296 </row>
9298 <row>
9299 <entry role="catalog_table_entry"><para role="column_definition">
9300 <structfield>umserver</structfield> <type>oid</type>
9301 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
9302 </para>
9303 <para>
9304 The OID of the foreign server that contains this mapping
9305 </para></entry>
9306 </row>
9308 <row>
9309 <entry role="catalog_table_entry"><para role="column_definition">
9310 <structfield>umoptions</structfield> <type>text[]</type>
9311 </para>
9312 <para>
9313 User mapping specific options, as <quote>keyword=value</quote> strings
9314 </para></entry>
9315 </row>
9316 </tbody>
9317 </tgroup>
9318 </table>
9319 </sect1>
9322 <sect1 id="views-overview">
9323 <title>System Views</title>
9325 <para>
9326 In addition to the system catalogs, <productname>PostgreSQL</productname>
9327 provides a number of built-in views. Some system views provide convenient
9328 access to some commonly used queries on the system catalogs. Other views
9329 provide access to internal server state.
9330 </para>
9332 <para>
9333 The information schema (<xref linkend="information-schema"/>) provides
9334 an alternative set of views which overlap the functionality of the system
9335 views. Since the information schema is SQL-standard whereas the views
9336 described here are <productname>PostgreSQL</productname>-specific,
9337 it's usually better to use the information schema if it provides all
9338 the information you need.
9339 </para>
9341 <para>
9342 <xref linkend="view-table"/> lists the system views described here.
9343 More detailed documentation of each view follows below.
9344 There are some additional views that provide access to the results of
9345 the statistics collector; they are described in <xref
9346 linkend="monitoring-stats-views-table"/>.
9347 </para>
9349 <para>
9350 Except where noted, all the views described here are read-only.
9351 </para>
9353 <table id="view-table">
9354 <title>System Views</title>
9356 <tgroup cols="2">
9357 <thead>
9358 <row>
9359 <entry>View Name</entry>
9360 <entry>Purpose</entry>
9361 </row>
9362 </thead>
9364 <tbody>
9365 <row>
9366 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
9367 <entry>available extensions</entry>
9368 </row>
9370 <row>
9371 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
9372 <entry>available versions of extensions</entry>
9373 </row>
9375 <row>
9376 <entry><link linkend="view-pg-backend-memory-contexts"><structname>pg_backend_memory_contexts</structname></link></entry>
9377 <entry>backend memory contexts</entry>
9378 </row>
9380 <row>
9381 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
9382 <entry>compile-time configuration parameters</entry>
9383 </row>
9385 <row>
9386 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
9387 <entry>open cursors</entry>
9388 </row>
9390 <row>
9391 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
9392 <entry>summary of configuration file contents</entry>
9393 </row>
9395 <row>
9396 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
9397 <entry>groups of database users</entry>
9398 </row>
9400 <row>
9401 <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
9402 <entry>summary of client authentication configuration file contents</entry>
9403 </row>
9405 <row>
9406 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
9407 <entry>indexes</entry>
9408 </row>
9410 <row>
9411 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
9412 <entry>locks currently held or awaited</entry>
9413 </row>
9415 <row>
9416 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
9417 <entry>materialized views</entry>
9418 </row>
9420 <row>
9421 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
9422 <entry>policies</entry>
9423 </row>
9425 <row>
9426 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
9427 <entry>prepared statements</entry>
9428 </row>
9430 <row>
9431 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
9432 <entry>prepared transactions</entry>
9433 </row>
9435 <row>
9436 <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
9437 <entry>publications and their associated tables</entry>
9438 </row>
9440 <row>
9441 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
9442 <entry>information about replication origins, including replication progress</entry>
9443 </row>
9445 <row>
9446 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
9447 <entry>replication slot information</entry>
9448 </row>
9450 <row>
9451 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
9452 <entry>database roles</entry>
9453 </row>
9455 <row>
9456 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
9457 <entry>rules</entry>
9458 </row>
9460 <row>
9461 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
9462 <entry>security labels</entry>
9463 </row>
9465 <row>
9466 <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
9467 <entry>sequences</entry>
9468 </row>
9470 <row>
9471 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
9472 <entry>parameter settings</entry>
9473 </row>
9475 <row>
9476 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
9477 <entry>database users</entry>
9478 </row>
9480 <row>
9481 <entry><link linkend="view-pg-shmem-allocations"><structname>pg_shmem_allocations</structname></link></entry>
9482 <entry>shared memory allocations</entry>
9483 </row>
9485 <row>
9486 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
9487 <entry>planner statistics</entry>
9488 </row>
9490 <row>
9491 <entry><link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link></entry>
9492 <entry>extended planner statistics</entry>
9493 </row>
9495 <row>
9496 <entry><link linkend="view-pg-stats-ext-exprs"><structname>pg_stats_ext_exprs</structname></link></entry>
9497 <entry>extended planner statistics for expressions</entry>
9498 </row>
9500 <row>
9501 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
9502 <entry>tables</entry>
9503 </row>
9505 <row>
9506 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
9507 <entry>time zone abbreviations</entry>
9508 </row>
9510 <row>
9511 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
9512 <entry>time zone names</entry>
9513 </row>
9515 <row>
9516 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
9517 <entry>database users</entry>
9518 </row>
9520 <row>
9521 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
9522 <entry>user mappings</entry>
9523 </row>
9525 <row>
9526 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
9527 <entry>views</entry>
9528 </row>
9530 </tbody>
9531 </tgroup>
9532 </table>
9533 </sect1>
9535 <sect1 id="view-pg-available-extensions">
9536 <title><structname>pg_available_extensions</structname></title>
9538 <indexterm zone="view-pg-available-extensions">
9539 <primary>pg_available_extensions</primary>
9540 </indexterm>
9542 <para>
9543 The <structname>pg_available_extensions</structname> view lists the
9544 extensions that are available for installation.
9545 See also the
9546 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
9547 catalog, which shows the extensions currently installed.
9548 </para>
9550 <table>
9551 <title><structname>pg_available_extensions</structname> Columns</title>
9552 <tgroup cols="1">
9553 <thead>
9554 <row>
9555 <entry role="catalog_table_entry"><para role="column_definition">
9556 Column Type
9557 </para>
9558 <para>
9559 Description
9560 </para></entry>
9561 </row>
9562 </thead>
9564 <tbody>
9565 <row>
9566 <entry role="catalog_table_entry"><para role="column_definition">
9567 <structfield>name</structfield> <type>name</type>
9568 </para>
9569 <para>
9570 Extension name
9571 </para></entry>
9572 </row>
9574 <row>
9575 <entry role="catalog_table_entry"><para role="column_definition">
9576 <structfield>default_version</structfield> <type>text</type>
9577 </para>
9578 <para>
9579 Name of default version, or <literal>NULL</literal> if none is
9580 specified
9581 </para></entry>
9582 </row>
9584 <row>
9585 <entry role="catalog_table_entry"><para role="column_definition">
9586 <structfield>installed_version</structfield> <type>text</type>
9587 </para>
9588 <para>
9589 Currently installed version of the extension,
9590 or <literal>NULL</literal> if not installed
9591 </para></entry>
9592 </row>
9594 <row>
9595 <entry role="catalog_table_entry"><para role="column_definition">
9596 <structfield>comment</structfield> <type>text</type>
9597 </para>
9598 <para>
9599 Comment string from the extension's control file
9600 </para></entry>
9601 </row>
9602 </tbody>
9603 </tgroup>
9604 </table>
9606 <para>
9607 The <structname>pg_available_extensions</structname> view is read-only.
9608 </para>
9609 </sect1>
9611 <sect1 id="view-pg-available-extension-versions">
9612 <title><structname>pg_available_extension_versions</structname></title>
9614 <indexterm zone="view-pg-available-extension-versions">
9615 <primary>pg_available_extension_versions</primary>
9616 </indexterm>
9618 <para>
9619 The <structname>pg_available_extension_versions</structname> view lists the
9620 specific extension versions that are available for installation.
9621 See also the <link
9622 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
9623 catalog, which shows the extensions currently installed.
9624 </para>
9626 <table>
9627 <title><structname>pg_available_extension_versions</structname> Columns</title>
9628 <tgroup cols="1">
9629 <thead>
9630 <row>
9631 <entry role="catalog_table_entry"><para role="column_definition">
9632 Column Type
9633 </para>
9634 <para>
9635 Description
9636 </para></entry>
9637 </row>
9638 </thead>
9640 <tbody>
9641 <row>
9642 <entry role="catalog_table_entry"><para role="column_definition">
9643 <structfield>name</structfield> <type>name</type>
9644 </para>
9645 <para>
9646 Extension name
9647 </para></entry>
9648 </row>
9650 <row>
9651 <entry role="catalog_table_entry"><para role="column_definition">
9652 <structfield>version</structfield> <type>text</type>
9653 </para>
9654 <para>
9655 Version name
9656 </para></entry>
9657 </row>
9659 <row>
9660 <entry role="catalog_table_entry"><para role="column_definition">
9661 <structfield>installed</structfield> <type>bool</type>
9662 </para>
9663 <para>
9664 True if this version of this extension is currently
9665 installed
9666 </para></entry>
9667 </row>
9669 <row>
9670 <entry role="catalog_table_entry"><para role="column_definition">
9671 <structfield>superuser</structfield> <type>bool</type>
9672 </para>
9673 <para>
9674 True if only superusers are allowed to install this extension
9675 (but see <structfield>trusted</structfield>)
9676 </para></entry>
9677 </row>
9679 <row>
9680 <entry role="catalog_table_entry"><para role="column_definition">
9681 <structfield>trusted</structfield> <type>bool</type>
9682 </para>
9683 <para>
9684 True if the extension can be installed by non-superusers
9685 with appropriate privileges
9686 </para></entry>
9687 </row>
9689 <row>
9690 <entry role="catalog_table_entry"><para role="column_definition">
9691 <structfield>relocatable</structfield> <type>bool</type>
9692 </para>
9693 <para>
9694 True if extension can be relocated to another schema
9695 </para></entry>
9696 </row>
9698 <row>
9699 <entry role="catalog_table_entry"><para role="column_definition">
9700 <structfield>schema</structfield> <type>name</type>
9701 </para>
9702 <para>
9703 Name of the schema that the extension must be installed into,
9704 or <literal>NULL</literal> if partially or fully relocatable
9705 </para></entry>
9706 </row>
9708 <row>
9709 <entry role="catalog_table_entry"><para role="column_definition">
9710 <structfield>requires</structfield> <type>name[]</type>
9711 </para>
9712 <para>
9713 Names of prerequisite extensions,
9714 or <literal>NULL</literal> if none
9715 </para></entry>
9716 </row>
9718 <row>
9719 <entry role="catalog_table_entry"><para role="column_definition">
9720 <structfield>comment</structfield> <type>text</type>
9721 </para>
9722 <para>
9723 Comment string from the extension's control file
9724 </para></entry>
9725 </row>
9726 </tbody>
9727 </tgroup>
9728 </table>
9730 <para>
9731 The <structname>pg_available_extension_versions</structname> view is
9732 read-only.
9733 </para>
9734 </sect1>
9736 <sect1 id="view-pg-backend-memory-contexts">
9737 <title><structname>pg_backend_memory_contexts</structname></title>
9739 <indexterm zone="view-pg-backend-memory-contexts">
9740 <primary>pg_backend_memory_contexts</primary>
9741 </indexterm>
9743 <para>
9744 The view <structname>pg_backend_memory_contexts</structname> displays all
9745 the memory contexts of the server process attached to the current session.
9746 </para>
9747 <para>
9748 <structname>pg_backend_memory_contexts</structname> contains one row
9749 for each memory context.
9750 </para>
9752 <table>
9753 <title><structname>pg_backend_memory_contexts</structname> Columns</title>
9754 <tgroup cols="1">
9755 <thead>
9756 <row>
9757 <entry role="catalog_table_entry"><para role="column_definition">
9758 Column Type
9759 </para>
9760 <para>
9761 Description
9762 </para></entry>
9763 </row>
9764 </thead>
9766 <tbody>
9767 <row>
9768 <entry role="catalog_table_entry"><para role="column_definition">
9769 <structfield>name</structfield> <type>text</type>
9770 </para>
9771 <para>
9772 Name of the memory context
9773 </para></entry>
9774 </row>
9776 <row>
9777 <entry role="catalog_table_entry"><para role="column_definition">
9778 <structfield>ident</structfield> <type>text</type>
9779 </para>
9780 <para>
9781 Identification information of the memory context. This field is truncated at 1024 bytes
9782 </para></entry>
9783 </row>
9785 <row>
9786 <entry role="catalog_table_entry"><para role="column_definition">
9787 <structfield>parent</structfield> <type>text</type>
9788 </para>
9789 <para>
9790 Name of the parent of this memory context
9791 </para></entry>
9792 </row>
9794 <row>
9795 <entry role="catalog_table_entry"><para role="column_definition">
9796 <structfield>level</structfield> <type>int4</type>
9797 </para>
9798 <para>
9799 Distance from TopMemoryContext in context tree
9800 </para></entry>
9801 </row>
9803 <row>
9804 <entry role="catalog_table_entry"><para role="column_definition">
9805 <structfield>total_bytes</structfield> <type>int8</type>
9806 </para>
9807 <para>
9808 Total bytes allocated for this memory context
9809 </para></entry>
9810 </row>
9812 <row>
9813 <entry role="catalog_table_entry"><para role="column_definition">
9814 <structfield>total_nblocks</structfield> <type>int8</type>
9815 </para>
9816 <para>
9817 Total number of blocks allocated for this memory context
9818 </para></entry>
9819 </row>
9821 <row>
9822 <entry role="catalog_table_entry"><para role="column_definition">
9823 <structfield>free_bytes</structfield> <type>int8</type>
9824 </para>
9825 <para>
9826 Free space in bytes
9827 </para></entry>
9828 </row>
9830 <row>
9831 <entry role="catalog_table_entry"><para role="column_definition">
9832 <structfield>free_chunks</structfield> <type>int8</type>
9833 </para>
9834 <para>
9835 Total number of free chunks
9836 </para></entry>
9837 </row>
9839 <row>
9840 <entry role="catalog_table_entry"><para role="column_definition">
9841 <structfield>used_bytes</structfield> <type>int8</type>
9842 </para>
9843 <para>
9844 Used space in bytes
9845 </para></entry>
9846 </row>
9847 </tbody>
9848 </tgroup>
9849 </table>
9851 <para>
9852 By default, the <structname>pg_backend_memory_contexts</structname> view can be
9853 read only by superusers.
9854 </para>
9855 </sect1>
9857 <sect1 id="view-pg-config">
9858 <title><structname>pg_config</structname></title>
9860 <indexterm zone="view-pg-config">
9861 <primary>pg_config</primary>
9862 </indexterm>
9864 <para>
9865 The view <structname>pg_config</structname> describes the
9866 compile-time configuration parameters of the currently installed
9867 version of <productname>PostgreSQL</productname>. It is intended, for example, to
9868 be used by software packages that want to interface to
9869 <productname>PostgreSQL</productname> to facilitate finding the required header
9870 files and libraries. It provides the same basic information as the
9871 <xref linkend="app-pgconfig"/> <productname>PostgreSQL</productname> client
9872 application.
9873 </para>
9875 <para>
9876 By default, the <structname>pg_config</structname> view can be read
9877 only by superusers.
9878 </para>
9880 <table>
9881 <title><structname>pg_config</structname> Columns</title>
9882 <tgroup cols="1">
9883 <thead>
9884 <row>
9885 <entry role="catalog_table_entry"><para role="column_definition">
9886 Column Type
9887 </para>
9888 <para>
9889 Description
9890 </para></entry>
9891 </row>
9892 </thead>
9894 <tbody>
9895 <row>
9896 <entry role="catalog_table_entry"><para role="column_definition">
9897 <structfield>name</structfield> <type>text</type>
9898 </para>
9899 <para>
9900 The parameter name
9901 </para></entry>
9902 </row>
9904 <row>
9905 <entry role="catalog_table_entry"><para role="column_definition">
9906 <structfield>setting</structfield> <type>text</type>
9907 </para>
9908 <para>
9909 The parameter value
9910 </para></entry>
9911 </row>
9912 </tbody>
9913 </tgroup>
9914 </table>
9916 </sect1>
9918 <sect1 id="view-pg-cursors">
9919 <title><structname>pg_cursors</structname></title>
9921 <indexterm zone="view-pg-cursors">
9922 <primary>pg_cursors</primary>
9923 </indexterm>
9925 <para>
9926 The <structname>pg_cursors</structname> view lists the cursors that
9927 are currently available. Cursors can be defined in several ways:
9928 <itemizedlist>
9929 <listitem>
9930 <para>
9931 via the <link linkend="sql-declare"><command>DECLARE</command></link>
9932 statement in SQL
9933 </para>
9934 </listitem>
9936 <listitem>
9937 <para>
9938 via the Bind message in the frontend/backend protocol, as
9939 described in <xref linkend="protocol-flow-ext-query"/>
9940 </para>
9941 </listitem>
9943 <listitem>
9944 <para>
9945 via the Server Programming Interface (SPI), as described in
9946 <xref linkend="spi-interface"/>
9947 </para>
9948 </listitem>
9949 </itemizedlist>
9951 The <structname>pg_cursors</structname> view displays cursors
9952 created by any of these means. Cursors only exist for the duration
9953 of the transaction that defines them, unless they have been
9954 declared <literal>WITH HOLD</literal>. Therefore non-holdable
9955 cursors are only present in the view until the end of their
9956 creating transaction.
9958 <note>
9959 <para>
9960 Cursors are used internally to implement some of the components
9961 of <productname>PostgreSQL</productname>, such as procedural languages.
9962 Therefore, the <structname>pg_cursors</structname> view might include cursors
9963 that have not been explicitly created by the user.
9964 </para>
9965 </note>
9966 </para>
9968 <table>
9969 <title><structname>pg_cursors</structname> Columns</title>
9970 <tgroup cols="1">
9971 <thead>
9972 <row>
9973 <entry role="catalog_table_entry"><para role="column_definition">
9974 Column Type
9975 </para>
9976 <para>
9977 Description
9978 </para></entry>
9979 </row>
9980 </thead>
9982 <tbody>
9983 <row>
9984 <entry role="catalog_table_entry"><para role="column_definition">
9985 <structfield>name</structfield> <type>text</type>
9986 </para>
9987 <para>
9988 The name of the cursor
9989 </para></entry>
9990 </row>
9992 <row>
9993 <entry role="catalog_table_entry"><para role="column_definition">
9994 <structfield>statement</structfield> <type>text</type>
9995 </para>
9996 <para>
9997 The verbatim query string submitted to declare this cursor
9998 </para></entry>
9999 </row>
10001 <row>
10002 <entry role="catalog_table_entry"><para role="column_definition">
10003 <structfield>is_holdable</structfield> <type>bool</type>
10004 </para>
10005 <para>
10006 <literal>true</literal> if the cursor is holdable (that is, it
10007 can be accessed after the transaction that declared the cursor
10008 has committed); <literal>false</literal> otherwise
10009 </para></entry>
10010 </row>
10012 <row>
10013 <entry role="catalog_table_entry"><para role="column_definition">
10014 <structfield>is_binary</structfield> <type>bool</type>
10015 </para>
10016 <para>
10017 <literal>true</literal> if the cursor was declared
10018 <literal>BINARY</literal>; <literal>false</literal>
10019 otherwise
10020 </para></entry>
10021 </row>
10023 <row>
10024 <entry role="catalog_table_entry"><para role="column_definition">
10025 <structfield>is_scrollable</structfield> <type>bool</type>
10026 </para>
10027 <para>
10028 <literal>true</literal> if the cursor is scrollable (that is, it
10029 allows rows to be retrieved in a nonsequential manner);
10030 <literal>false</literal> otherwise
10031 </para></entry>
10032 </row>
10034 <row>
10035 <entry role="catalog_table_entry"><para role="column_definition">
10036 <structfield>creation_time</structfield> <type>timestamptz</type>
10037 </para>
10038 <para>
10039 The time at which the cursor was declared
10040 </para></entry>
10041 </row>
10042 </tbody>
10043 </tgroup>
10044 </table>
10046 <para>
10047 The <structname>pg_cursors</structname> view is read-only.
10048 </para>
10050 </sect1>
10052 <sect1 id="view-pg-file-settings">
10053 <title><structname>pg_file_settings</structname></title>
10055 <indexterm zone="view-pg-file-settings">
10056 <primary>pg_file_settings</primary>
10057 </indexterm>
10059 <para>
10060 The view <structname>pg_file_settings</structname> provides a summary of
10061 the contents of the server's configuration file(s). A row appears in
10062 this view for each <quote>name = value</quote> entry appearing in the files,
10063 with annotations indicating whether the value could be applied
10064 successfully. Additional row(s) may appear for problems not linked to
10065 a <quote>name = value</quote> entry, such as syntax errors in the files.
10066 </para>
10068 <para>
10069 This view is helpful for checking whether planned changes in the
10070 configuration files will work, or for diagnosing a previous failure.
10071 Note that this view reports on the <emphasis>current</emphasis> contents of the
10072 files, not on what was last applied by the server. (The
10073 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
10074 view is usually sufficient to determine that.)
10075 </para>
10077 <para>
10078 By default, the <structname>pg_file_settings</structname> view can be read
10079 only by superusers.
10080 </para>
10082 <table>
10083 <title><structname>pg_file_settings</structname> Columns</title>
10084 <tgroup cols="1">
10085 <thead>
10086 <row>
10087 <entry role="catalog_table_entry"><para role="column_definition">
10088 Column Type
10089 </para>
10090 <para>
10091 Description
10092 </para></entry>
10093 </row>
10094 </thead>
10096 <tbody>
10097 <row>
10098 <entry role="catalog_table_entry"><para role="column_definition">
10099 <structfield>sourcefile</structfield> <type>text</type>
10100 </para>
10101 <para>
10102 Full path name of the configuration file
10103 </para></entry>
10104 </row>
10106 <row>
10107 <entry role="catalog_table_entry"><para role="column_definition">
10108 <structfield>sourceline</structfield> <type>int4</type>
10109 </para>
10110 <para>
10111 Line number within the configuration file where the entry appears
10112 </para></entry>
10113 </row>
10115 <row>
10116 <entry role="catalog_table_entry"><para role="column_definition">
10117 <structfield>seqno</structfield> <type>int4</type>
10118 </para>
10119 <para>
10120 Order in which the entries are processed (1..<replaceable>n</replaceable>)
10121 </para></entry>
10122 </row>
10124 <row>
10125 <entry role="catalog_table_entry"><para role="column_definition">
10126 <structfield>name</structfield> <type>text</type>
10127 </para>
10128 <para>
10129 Configuration parameter name
10130 </para></entry>
10131 </row>
10133 <row>
10134 <entry role="catalog_table_entry"><para role="column_definition">
10135 <structfield>setting</structfield> <type>text</type>
10136 </para>
10137 <para>
10138 Value to be assigned to the parameter
10139 </para></entry>
10140 </row>
10142 <row>
10143 <entry role="catalog_table_entry"><para role="column_definition">
10144 <structfield>applied</structfield> <type>bool</type>
10145 </para>
10146 <para>
10147 True if the value can be applied successfully
10148 </para></entry>
10149 </row>
10151 <row>
10152 <entry role="catalog_table_entry"><para role="column_definition">
10153 <structfield>error</structfield> <type>text</type>
10154 </para>
10155 <para>
10156 If not null, an error message indicating why this entry could
10157 not be applied
10158 </para></entry>
10159 </row>
10160 </tbody>
10161 </tgroup>
10162 </table>
10164 <para>
10165 If the configuration file contains syntax errors or invalid parameter
10166 names, the server will not attempt to apply any settings from it, and
10167 therefore all the <structfield>applied</structfield> fields will read as false.
10168 In such a case there will be one or more rows with
10169 non-null <structfield>error</structfield> fields indicating the
10170 problem(s). Otherwise, individual settings will be applied if possible.
10171 If an individual setting cannot be applied (e.g., invalid value, or the
10172 setting cannot be changed after server start) it will have an appropriate
10173 message in the <structfield>error</structfield> field. Another way that
10174 an entry might have <structfield>applied</structfield> = false is that it is
10175 overridden by a later entry for the same parameter name; this case is not
10176 considered an error so nothing appears in
10177 the <structfield>error</structfield> field.
10178 </para>
10180 <para>
10181 See <xref linkend="config-setting"/> for more information about the various
10182 ways to change run-time parameters.
10183 </para>
10185 </sect1>
10187 <sect1 id="view-pg-group">
10188 <title><structname>pg_group</structname></title>
10190 <indexterm zone="view-pg-group">
10191 <primary>pg_group</primary>
10192 </indexterm>
10194 <!-- Unlike information_schema.applicable_roles, this shows no members for
10195 pg_database_owner. The v8.1 catalog would have shown no members if
10196 that role had existed at the time. -->
10197 <para>
10198 The view <structname>pg_group</structname> exists for backwards
10199 compatibility: it emulates a catalog that existed in
10200 <productname>PostgreSQL</productname> before version 8.1.
10201 It shows the names and members of all roles that are marked as not
10202 <structfield>rolcanlogin</structfield>, which is an approximation to the set
10203 of roles that are being used as groups.
10204 </para>
10206 <table>
10207 <title><structname>pg_group</structname> Columns</title>
10208 <tgroup cols="1">
10209 <thead>
10210 <row>
10211 <entry role="catalog_table_entry"><para role="column_definition">
10212 Column Type
10213 </para>
10214 <para>
10215 Description
10216 </para></entry>
10217 </row>
10218 </thead>
10220 <tbody>
10221 <row>
10222 <entry role="catalog_table_entry"><para role="column_definition">
10223 <structfield>groname</structfield> <type>name</type>
10224 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
10225 </para>
10226 <para>
10227 Name of the group
10228 </para></entry>
10229 </row>
10231 <row>
10232 <entry role="catalog_table_entry"><para role="column_definition">
10233 <structfield>grosysid</structfield> <type>oid</type>
10234 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
10235 </para>
10236 <para>
10237 ID of this group
10238 </para></entry>
10239 </row>
10241 <row>
10242 <entry role="catalog_table_entry"><para role="column_definition">
10243 <structfield>grolist</structfield> <type>oid[]</type>
10244 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
10245 </para>
10246 <para>
10247 An array containing the IDs of the roles in this group
10248 </para></entry>
10249 </row>
10250 </tbody>
10251 </tgroup>
10252 </table>
10254 </sect1>
10256 <sect1 id="view-pg-hba-file-rules">
10257 <title><structname>pg_hba_file_rules</structname></title>
10259 <indexterm zone="view-pg-hba-file-rules">
10260 <primary>pg_hba_file_rules</primary>
10261 </indexterm>
10263 <para>
10264 The view <structname>pg_hba_file_rules</structname> provides a summary of
10265 the contents of the client authentication configuration file,
10266 <link linkend="auth-pg-hba-conf"><filename>pg_hba.conf</filename></link>.
10267 A row appears in this view for each
10268 non-empty, non-comment line in the file, with annotations indicating
10269 whether the rule could be applied successfully.
10270 </para>
10272 <para>
10273 This view can be helpful for checking whether planned changes in the
10274 authentication configuration file will work, or for diagnosing a previous
10275 failure. Note that this view reports on the <emphasis>current</emphasis> contents
10276 of the file, not on what was last loaded by the server.
10277 </para>
10279 <para>
10280 By default, the <structname>pg_hba_file_rules</structname> view can be read
10281 only by superusers.
10282 </para>
10284 <table>
10285 <title><structname>pg_hba_file_rules</structname> Columns</title>
10286 <tgroup cols="1">
10287 <thead>
10288 <row>
10289 <entry role="catalog_table_entry"><para role="column_definition">
10290 Column Type
10291 </para>
10292 <para>
10293 Description
10294 </para></entry>
10295 </row>
10296 </thead>
10298 <tbody>
10299 <row>
10300 <entry role="catalog_table_entry"><para role="column_definition">
10301 <structfield>line_number</structfield> <type>int4</type>
10302 </para>
10303 <para>
10304 Line number of this rule in <filename>pg_hba.conf</filename>
10305 </para></entry>
10306 </row>
10308 <row>
10309 <entry role="catalog_table_entry"><para role="column_definition">
10310 <structfield>type</structfield> <type>text</type>
10311 </para>
10312 <para>
10313 Type of connection
10314 </para></entry>
10315 </row>
10317 <row>
10318 <entry role="catalog_table_entry"><para role="column_definition">
10319 <structfield>database</structfield> <type>text[]</type>
10320 </para>
10321 <para>
10322 List of database name(s) to which this rule applies
10323 </para></entry>
10324 </row>
10326 <row>
10327 <entry role="catalog_table_entry"><para role="column_definition">
10328 <structfield>user_name</structfield> <type>text[]</type>
10329 </para>
10330 <para>
10331 List of user and group name(s) to which this rule applies
10332 </para></entry>
10333 </row>
10335 <row>
10336 <entry role="catalog_table_entry"><para role="column_definition">
10337 <structfield>address</structfield> <type>text</type>
10338 </para>
10339 <para>
10340 Host name or IP address, or one
10341 of <literal>all</literal>, <literal>samehost</literal>,
10342 or <literal>samenet</literal>, or null for local connections
10343 </para></entry>
10344 </row>
10346 <row>
10347 <entry role="catalog_table_entry"><para role="column_definition">
10348 <structfield>netmask</structfield> <type>text</type>
10349 </para>
10350 <para>
10351 IP address mask, or null if not applicable
10352 </para></entry>
10353 </row>
10355 <row>
10356 <entry role="catalog_table_entry"><para role="column_definition">
10357 <structfield>auth_method</structfield> <type>text</type>
10358 </para>
10359 <para>
10360 Authentication method
10361 </para></entry>
10362 </row>
10364 <row>
10365 <entry role="catalog_table_entry"><para role="column_definition">
10366 <structfield>options</structfield> <type>text[]</type>
10367 </para>
10368 <para>
10369 Options specified for authentication method, if any
10370 </para></entry>
10371 </row>
10373 <row>
10374 <entry role="catalog_table_entry"><para role="column_definition">
10375 <structfield>error</structfield> <type>text</type>
10376 </para>
10377 <para>
10378 If not null, an error message indicating why this
10379 line could not be processed
10380 </para></entry>
10381 </row>
10382 </tbody>
10383 </tgroup>
10384 </table>
10386 <para>
10387 Usually, a row reflecting an incorrect entry will have values for only
10388 the <structfield>line_number</structfield> and <structfield>error</structfield> fields.
10389 </para>
10391 <para>
10392 See <xref linkend="client-authentication"/> for more information about
10393 client authentication configuration.
10394 </para>
10395 </sect1>
10397 <sect1 id="view-pg-indexes">
10398 <title><structname>pg_indexes</structname></title>
10400 <indexterm zone="view-pg-indexes">
10401 <primary>pg_indexes</primary>
10402 </indexterm>
10404 <para>
10405 The view <structname>pg_indexes</structname> provides access to
10406 useful information about each index in the database.
10407 </para>
10409 <table>
10410 <title><structname>pg_indexes</structname> Columns</title>
10411 <tgroup cols="1">
10412 <thead>
10413 <row>
10414 <entry role="catalog_table_entry"><para role="column_definition">
10415 Column Type
10416 </para>
10417 <para>
10418 Description
10419 </para></entry>
10420 </row>
10421 </thead>
10423 <tbody>
10424 <row>
10425 <entry role="catalog_table_entry"><para role="column_definition">
10426 <structfield>schemaname</structfield> <type>name</type>
10427 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
10428 </para>
10429 <para>
10430 Name of schema containing table and index
10431 </para></entry>
10432 </row>
10434 <row>
10435 <entry role="catalog_table_entry"><para role="column_definition">
10436 <structfield>tablename</structfield> <type>name</type>
10437 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10438 </para>
10439 <para>
10440 Name of table the index is for
10441 </para></entry>
10442 </row>
10444 <row>
10445 <entry role="catalog_table_entry"><para role="column_definition">
10446 <structfield>indexname</structfield> <type>name</type>
10447 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10448 </para>
10449 <para>
10450 Name of index
10451 </para></entry>
10452 </row>
10454 <row>
10455 <entry role="catalog_table_entry"><para role="column_definition">
10456 <structfield>tablespace</structfield> <type>name</type>
10457 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
10458 </para>
10459 <para>
10460 Name of tablespace containing index (null if default for database)
10461 </para></entry>
10462 </row>
10464 <row>
10465 <entry role="catalog_table_entry"><para role="column_definition">
10466 <structfield>indexdef</structfield> <type>text</type>
10467 </para>
10468 <para>
10469 Index definition (a reconstructed <xref linkend="sql-createindex"/>
10470 command)
10471 </para></entry>
10472 </row>
10473 </tbody>
10474 </tgroup>
10475 </table>
10477 </sect1>
10479 <sect1 id="view-pg-locks">
10480 <title><structname>pg_locks</structname></title>
10482 <indexterm zone="view-pg-locks">
10483 <primary>pg_locks</primary>
10484 </indexterm>
10486 <para>
10487 The view <structname>pg_locks</structname> provides access to
10488 information about the locks held by active processes within the
10489 database server. See <xref linkend="mvcc"/> for more discussion
10490 of locking.
10491 </para>
10493 <para>
10494 <structname>pg_locks</structname> contains one row per active lockable
10495 object, requested lock mode, and relevant process. Thus, the same
10496 lockable object might
10497 appear many times, if multiple processes are holding or waiting
10498 for locks on it. However, an object that currently has no locks on it
10499 will not appear at all.
10500 </para>
10502 <para>
10503 There are several distinct types of lockable objects:
10504 whole relations (e.g., tables), individual pages of relations,
10505 individual tuples of relations,
10506 transaction IDs (both virtual and permanent IDs),
10507 and general database objects (identified by class OID and object OID,
10508 in the same way as in <link linkend="catalog-pg-description"><structname>pg_description</structname></link> or
10509 <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>). Also, the right to extend a
10510 relation is represented as a separate lockable object, as is the right to
10511 update <structname>pg_database</structname>.<structfield>datfrozenxid</structfield>.
10512 Also, <quote>advisory</quote> locks can be taken on numbers that have
10513 user-defined meanings.
10514 </para>
10516 <table>
10517 <title><structname>pg_locks</structname> Columns</title>
10518 <tgroup cols="1">
10519 <thead>
10520 <row>
10521 <entry role="catalog_table_entry"><para role="column_definition">
10522 Column Type
10523 </para>
10524 <para>
10525 Description
10526 </para></entry>
10527 </row>
10528 </thead>
10530 <tbody>
10531 <row>
10532 <entry role="catalog_table_entry"><para role="column_definition">
10533 <structfield>locktype</structfield> <type>text</type>
10534 </para>
10535 <para>
10536 Type of the lockable object:
10537 <literal>relation</literal>,
10538 <literal>extend</literal>,
10539 <literal>frozenid</literal>,
10540 <literal>page</literal>,
10541 <literal>tuple</literal>,
10542 <literal>transactionid</literal>,
10543 <literal>virtualxid</literal>,
10544 <literal>spectoken</literal>,
10545 <literal>object</literal>,
10546 <literal>userlock</literal>, or
10547 <literal>advisory</literal>.
10548 (See also <xref linkend="wait-event-lock-table"/>.)
10549 </para></entry>
10550 </row>
10552 <row>
10553 <entry role="catalog_table_entry"><para role="column_definition">
10554 <structfield>database</structfield> <type>oid</type>
10555 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
10556 </para>
10557 <para>
10558 OID of the database in which the lock target exists, or
10559 zero if the target is a shared object, or
10560 null if the target is a transaction ID
10561 </para></entry>
10562 </row>
10564 <row>
10565 <entry role="catalog_table_entry"><para role="column_definition">
10566 <structfield>relation</structfield> <type>oid</type>
10567 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
10568 </para>
10569 <para>
10570 OID of the relation targeted by the lock, or null if the target is not
10571 a relation or part of a relation
10572 </para></entry>
10573 </row>
10575 <row>
10576 <entry role="catalog_table_entry"><para role="column_definition">
10577 <structfield>page</structfield> <type>int4</type>
10578 </para>
10579 <para>
10580 Page number targeted by the lock within the relation,
10581 or null if the target is not a relation page or tuple
10582 </para></entry>
10583 </row>
10585 <row>
10586 <entry role="catalog_table_entry"><para role="column_definition">
10587 <structfield>tuple</structfield> <type>int2</type>
10588 </para>
10589 <para>
10590 Tuple number targeted by the lock within the page,
10591 or null if the target is not a tuple
10592 </para></entry>
10593 </row>
10595 <row>
10596 <entry role="catalog_table_entry"><para role="column_definition">
10597 <structfield>virtualxid</structfield> <type>text</type>
10598 </para>
10599 <para>
10600 Virtual ID of the transaction targeted by the lock,
10601 or null if the target is not a virtual transaction ID
10602 </para></entry>
10603 </row>
10605 <row>
10606 <entry role="catalog_table_entry"><para role="column_definition">
10607 <structfield>transactionid</structfield> <type>xid</type>
10608 </para>
10609 <para>
10610 ID of the transaction targeted by the lock,
10611 or null if the target is not a transaction ID
10612 </para></entry>
10613 </row>
10615 <row>
10616 <entry role="catalog_table_entry"><para role="column_definition">
10617 <structfield>classid</structfield> <type>oid</type>
10618 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
10619 </para>
10620 <para>
10621 OID of the system catalog containing the lock target, or null if the
10622 target is not a general database object
10623 </para></entry>
10624 </row>
10626 <row>
10627 <entry role="catalog_table_entry"><para role="column_definition">
10628 <structfield>objid</structfield> <type>oid</type>
10629 (references any OID column)
10630 </para>
10631 <para>
10632 OID of the lock target within its system catalog, or null if the
10633 target is not a general database object
10634 </para></entry>
10635 </row>
10637 <row>
10638 <entry role="catalog_table_entry"><para role="column_definition">
10639 <structfield>objsubid</structfield> <type>int2</type>
10640 </para>
10641 <para>
10642 Column number targeted by the lock (the
10643 <structfield>classid</structfield> and <structfield>objid</structfield> refer to the
10644 table itself),
10645 or zero if the target is some other general database object,
10646 or null if the target is not a general database object
10647 </para></entry>
10648 </row>
10650 <row>
10651 <entry role="catalog_table_entry"><para role="column_definition">
10652 <structfield>virtualtransaction</structfield> <type>text</type>
10653 </para>
10654 <para>
10655 Virtual ID of the transaction that is holding or awaiting this lock
10656 </para></entry>
10657 </row>
10659 <row>
10660 <entry role="catalog_table_entry"><para role="column_definition">
10661 <structfield>pid</structfield> <type>int4</type>
10662 </para>
10663 <para>
10664 Process ID of the server process holding or awaiting this
10665 lock, or null if the lock is held by a prepared transaction
10666 </para></entry>
10667 </row>
10669 <row>
10670 <entry role="catalog_table_entry"><para role="column_definition">
10671 <structfield>mode</structfield> <type>text</type>
10672 </para>
10673 <para>
10674 Name of the lock mode held or desired by this process (see <xref linkend="locking-tables"/> and <xref linkend="xact-serializable"/>)
10675 </para></entry>
10676 </row>
10678 <row>
10679 <entry role="catalog_table_entry"><para role="column_definition">
10680 <structfield>granted</structfield> <type>bool</type>
10681 </para>
10682 <para>
10683 True if lock is held, false if lock is awaited
10684 </para></entry>
10685 </row>
10687 <row>
10688 <entry role="catalog_table_entry"><para role="column_definition">
10689 <structfield>fastpath</structfield> <type>bool</type>
10690 </para>
10691 <para>
10692 True if lock was taken via fast path, false if taken via main
10693 lock table
10694 </para></entry>
10695 </row>
10697 <row>
10698 <entry role="catalog_table_entry"><para role="column_definition">
10699 <structfield>waitstart</structfield> <type>timestamptz</type>
10700 </para>
10701 <para>
10702 Time when the server process started waiting for this lock,
10703 or null if the lock is held.
10704 Note that this can be null for a very short period of time after
10705 the wait started even though <structfield>granted</structfield>
10706 is <literal>false</literal>.
10707 </para></entry>
10708 </row>
10709 </tbody>
10710 </tgroup>
10711 </table>
10713 <para>
10714 <structfield>granted</structfield> is true in a row representing a lock
10715 held by the indicated process. False indicates that this process is
10716 currently waiting to acquire this lock, which implies that at least one
10717 other process is holding or waiting for a conflicting lock mode on the same
10718 lockable object. The waiting process will sleep until the other lock is
10719 released (or a deadlock situation is detected). A single process can be
10720 waiting to acquire at most one lock at a time.
10721 </para>
10723 <para>
10724 Throughout running a transaction, a server process holds an exclusive lock
10725 on the transaction's virtual transaction ID. If a permanent ID is assigned
10726 to the transaction (which normally happens only if the transaction changes
10727 the state of the database), it also holds an exclusive lock on the
10728 transaction's permanent transaction ID until it ends. When a process finds
10729 it necessary to wait specifically for another transaction to end, it does
10730 so by attempting to acquire share lock on the other transaction's ID
10731 (either virtual or permanent ID depending on the situation). That will
10732 succeed only when the other transaction terminates and releases its locks.
10733 </para>
10735 <para>
10736 Although tuples are a lockable type of object,
10737 information about row-level locks is stored on disk, not in memory,
10738 and therefore row-level locks normally do not appear in this view.
10739 If a process is waiting for a
10740 row-level lock, it will usually appear in the view as waiting for the
10741 permanent transaction ID of the current holder of that row lock.
10742 </para>
10744 <para>
10745 Advisory locks can be acquired on keys consisting of either a single
10746 <type>bigint</type> value or two integer values.
10747 A <type>bigint</type> key is displayed with its
10748 high-order half in the <structfield>classid</structfield> column, its low-order half
10749 in the <structfield>objid</structfield> column, and <structfield>objsubid</structfield> equal
10750 to 1. The original <type>bigint</type> value can be reassembled with the
10751 expression <literal>(classid::bigint &lt;&lt; 32) |
10752 objid::bigint</literal>. Integer keys are displayed with the
10753 first key in the
10754 <structfield>classid</structfield> column, the second key in the <structfield>objid</structfield>
10755 column, and <structfield>objsubid</structfield> equal to 2. The actual meaning of
10756 the keys is up to the user. Advisory locks are local to each database,
10757 so the <structfield>database</structfield> column is meaningful for an advisory lock.
10758 </para>
10760 <para>
10761 <structname>pg_locks</structname> provides a global view of all locks
10762 in the database cluster, not only those relevant to the current database.
10763 Although its <structfield>relation</structfield> column can be joined
10764 against <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield> to identify locked
10765 relations, this will only work correctly for relations in the current
10766 database (those for which the <structfield>database</structfield> column
10767 is either the current database's OID or zero).
10768 </para>
10770 <para>
10771 The <structfield>pid</structfield> column can be joined to the
10772 <structfield>pid</structfield> column of the
10773 <link linkend="monitoring-pg-stat-activity-view">
10774 <structname>pg_stat_activity</structname></link>
10775 view to get more
10776 information on the session holding or awaiting each lock,
10777 for example
10778 <programlisting>
10779 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
10780 ON pl.pid = psa.pid;
10781 </programlisting>
10782 Also, if you are using prepared transactions, the
10783 <structfield>virtualtransaction</structfield> column can be joined to the
10784 <structfield>transaction</structfield> column of the <link
10785 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
10786 view to get more information on prepared transactions that hold locks.
10787 (A prepared transaction can never be waiting for a lock,
10788 but it continues to hold the locks it acquired while running.)
10789 For example:
10790 <programlisting>
10791 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
10792 ON pl.virtualtransaction = '-1/' || ppx.transaction;
10793 </programlisting>
10794 </para>
10796 <para>
10797 While it is possible to obtain information about which processes block
10798 which other processes by joining <structname>pg_locks</structname> against
10799 itself, this is very difficult to get right in detail. Such a query would
10800 have to encode knowledge about which lock modes conflict with which
10801 others. Worse, the <structname>pg_locks</structname> view does not expose
10802 information about which processes are ahead of which others in lock wait
10803 queues, nor information about which processes are parallel workers running
10804 on behalf of which other client sessions. It is better to use
10805 the <function>pg_blocking_pids()</function> function
10806 (see <xref linkend="functions-info-session-table"/>) to identify which
10807 process(es) a waiting process is blocked behind.
10808 </para>
10810 <para>
10811 The <structname>pg_locks</structname> view displays data from both the
10812 regular lock manager and the predicate lock manager, which are
10813 separate systems; in addition, the regular lock manager subdivides its
10814 locks into regular and <firstterm>fast-path</firstterm> locks.
10815 This data is not guaranteed to be entirely consistent.
10816 When the view is queried,
10817 data on fast-path locks (with <structfield>fastpath</structfield> = <literal>true</literal>)
10818 is gathered from each backend one at a time, without freezing the state of
10819 the entire lock manager, so it is possible for locks to be taken or
10820 released while information is gathered. Note, however, that these locks are
10821 known not to conflict with any other lock currently in place. After
10822 all backends have been queried for fast-path locks, the remainder of the
10823 regular lock manager is locked as a unit, and a consistent snapshot of all
10824 remaining locks is collected as an atomic action. After unlocking the
10825 regular lock manager, the predicate lock manager is similarly locked and all
10826 predicate locks are collected as an atomic action. Thus, with the exception
10827 of fast-path locks, each lock manager will deliver a consistent set of
10828 results, but as we do not lock both lock managers simultaneously, it is
10829 possible for locks to be taken or released after we interrogate the regular
10830 lock manager and before we interrogate the predicate lock manager.
10831 </para>
10833 <para>
10834 Locking the regular and/or predicate lock manager could have some
10835 impact on database performance if this view is very frequently accessed.
10836 The locks are held only for the minimum amount of time necessary to
10837 obtain data from the lock managers, but this does not completely eliminate
10838 the possibility of a performance impact.
10839 </para>
10841 </sect1>
10843 <sect1 id="view-pg-matviews">
10844 <title><structname>pg_matviews</structname></title>
10846 <indexterm zone="view-pg-matviews">
10847 <primary>pg_matviews</primary>
10848 </indexterm>
10850 <indexterm zone="view-pg-matviews">
10851 <primary>materialized views</primary>
10852 </indexterm>
10854 <para>
10855 The view <structname>pg_matviews</structname> provides access to
10856 useful information about each materialized view in the database.
10857 </para>
10859 <table>
10860 <title><structname>pg_matviews</structname> Columns</title>
10861 <tgroup cols="1">
10862 <thead>
10863 <row>
10864 <entry role="catalog_table_entry"><para role="column_definition">
10865 Column Type
10866 </para>
10867 <para>
10868 Description
10869 </para></entry>
10870 </row>
10871 </thead>
10873 <tbody>
10874 <row>
10875 <entry role="catalog_table_entry"><para role="column_definition">
10876 <structfield>schemaname</structfield> <type>name</type>
10877 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
10878 </para>
10879 <para>
10880 Name of schema containing materialized view
10881 </para></entry>
10882 </row>
10884 <row>
10885 <entry role="catalog_table_entry"><para role="column_definition">
10886 <structfield>matviewname</structfield> <type>name</type>
10887 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10888 </para>
10889 <para>
10890 Name of materialized view
10891 </para></entry>
10892 </row>
10894 <row>
10895 <entry role="catalog_table_entry"><para role="column_definition">
10896 <structfield>matviewowner</structfield> <type>name</type>
10897 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
10898 </para>
10899 <para>
10900 Name of materialized view's owner
10901 </para></entry>
10902 </row>
10904 <row>
10905 <entry role="catalog_table_entry"><para role="column_definition">
10906 <structfield>tablespace</structfield> <type>name</type>
10907 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
10908 </para>
10909 <para>
10910 Name of tablespace containing materialized view (null if default for database)
10911 </para></entry>
10912 </row>
10914 <row>
10915 <entry role="catalog_table_entry"><para role="column_definition">
10916 <structfield>hasindexes</structfield> <type>bool</type>
10917 </para>
10918 <para>
10919 True if materialized view has (or recently had) any indexes
10920 </para></entry>
10921 </row>
10923 <row>
10924 <entry role="catalog_table_entry"><para role="column_definition">
10925 <structfield>ispopulated</structfield> <type>bool</type>
10926 </para>
10927 <para>
10928 True if materialized view is currently populated
10929 </para></entry>
10930 </row>
10932 <row>
10933 <entry role="catalog_table_entry"><para role="column_definition">
10934 <structfield>definition</structfield> <type>text</type>
10935 </para>
10936 <para>
10937 Materialized view definition (a reconstructed <xref linkend="sql-select"/> query)
10938 </para></entry>
10939 </row>
10940 </tbody>
10941 </tgroup>
10942 </table>
10944 </sect1>
10946 <sect1 id="view-pg-policies">
10947 <title><structname>pg_policies</structname></title>
10949 <indexterm zone="view-pg-policies">
10950 <primary>pg_policies</primary>
10951 </indexterm>
10953 <para>
10954 The view <structname>pg_policies</structname> provides access to
10955 useful information about each row-level security policy in the database.
10956 </para>
10958 <table>
10959 <title><structname>pg_policies</structname> Columns</title>
10960 <tgroup cols="1">
10961 <thead>
10962 <row>
10963 <entry role="catalog_table_entry"><para role="column_definition">
10964 Column Type
10965 </para>
10966 <para>
10967 Description
10968 </para></entry>
10969 </row>
10970 </thead>
10972 <tbody>
10973 <row>
10974 <entry role="catalog_table_entry"><para role="column_definition">
10975 <structfield>schemaname</structfield> <type>name</type>
10976 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
10977 </para>
10978 <para>
10979 Name of schema containing table policy is on
10980 </para></entry>
10981 </row>
10983 <row>
10984 <entry role="catalog_table_entry"><para role="column_definition">
10985 <structfield>tablename</structfield> <type>name</type>
10986 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10987 </para>
10988 <para>
10989 Name of table policy is on
10990 </para></entry>
10991 </row>
10993 <row>
10994 <entry role="catalog_table_entry"><para role="column_definition">
10995 <structfield>policyname</structfield> <type>name</type>
10996 (references <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.<structfield>polname</structfield>)
10997 </para>
10998 <para>
10999 Name of policy
11000 </para></entry>
11001 </row>
11003 <row>
11004 <entry role="catalog_table_entry"><para role="column_definition">
11005 <structfield>permissive</structfield> <type>text</type>
11006 </para>
11007 <para>
11008 Is the policy permissive or restrictive?
11009 </para></entry>
11010 </row>
11012 <row>
11013 <entry role="catalog_table_entry"><para role="column_definition">
11014 <structfield>roles</structfield> <type>name[]</type>
11015 </para>
11016 <para>
11017 The roles to which this policy applies
11018 </para></entry>
11019 </row>
11021 <row>
11022 <entry role="catalog_table_entry"><para role="column_definition">
11023 <structfield>cmd</structfield> <type>text</type>
11024 </para>
11025 <para>
11026 The command type to which the policy is applied
11027 </para></entry>
11028 </row>
11030 <row>
11031 <entry role="catalog_table_entry"><para role="column_definition">
11032 <structfield>qual</structfield> <type>text</type>
11033 </para>
11034 <para>
11035 The expression added to the security barrier qualifications for
11036 queries that this policy applies to
11037 </para></entry>
11038 </row>
11040 <row>
11041 <entry role="catalog_table_entry"><para role="column_definition">
11042 <structfield>with_check</structfield> <type>text</type>
11043 </para>
11044 <para>
11045 The expression added to the WITH CHECK qualifications for
11046 queries that attempt to add rows to this table
11047 </para></entry>
11048 </row>
11049 </tbody>
11050 </tgroup>
11051 </table>
11053 </sect1>
11055 <sect1 id="view-pg-prepared-statements">
11056 <title><structname>pg_prepared_statements</structname></title>
11058 <indexterm zone="view-pg-prepared-statements">
11059 <primary>pg_prepared_statements</primary>
11060 </indexterm>
11062 <para>
11063 The <structname>pg_prepared_statements</structname> view displays
11064 all the prepared statements that are available in the current
11065 session. See <xref linkend="sql-prepare"/> for more information about prepared
11066 statements.
11067 </para>
11069 <para>
11070 <structname>pg_prepared_statements</structname> contains one row
11071 for each prepared statement. Rows are added to the view when a new
11072 prepared statement is created and removed when a prepared statement
11073 is released (for example, via the <link linkend="sql-deallocate"><command>DEALLOCATE</command></link> command).
11074 </para>
11076 <table>
11077 <title><structname>pg_prepared_statements</structname> Columns</title>
11078 <tgroup cols="1">
11079 <thead>
11080 <row>
11081 <entry role="catalog_table_entry"><para role="column_definition">
11082 Column Type
11083 </para>
11084 <para>
11085 Description
11086 </para></entry>
11087 </row>
11088 </thead>
11090 <tbody>
11091 <row>
11092 <entry role="catalog_table_entry"><para role="column_definition">
11093 <structfield>name</structfield> <type>text</type>
11094 </para>
11095 <para>
11096 The identifier of the prepared statement
11097 </para></entry>
11098 </row>
11100 <row>
11101 <entry role="catalog_table_entry"><para role="column_definition">
11102 <structfield>statement</structfield> <type>text</type>
11103 </para>
11104 <para>
11105 The query string submitted by the client to create this
11106 prepared statement. For prepared statements created via SQL,
11107 this is the <command>PREPARE</command> statement submitted by
11108 the client. For prepared statements created via the
11109 frontend/backend protocol, this is the text of the prepared
11110 statement itself.
11111 </para></entry>
11112 </row>
11114 <row>
11115 <entry role="catalog_table_entry"><para role="column_definition">
11116 <structfield>prepare_time</structfield> <type>timestamptz</type>
11117 </para>
11118 <para>
11119 The time at which the prepared statement was created
11120 </para></entry>
11121 </row>
11123 <row>
11124 <entry role="catalog_table_entry"><para role="column_definition">
11125 <structfield>parameter_types</structfield> <type>regtype[]</type>
11126 </para>
11127 <para>
11128 The expected parameter types for the prepared statement in the
11129 form of an array of <type>regtype</type>. The OID corresponding
11130 to an element of this array can be obtained by casting the
11131 <type>regtype</type> value to <type>oid</type>.
11132 </para></entry>
11133 </row>
11135 <row>
11136 <entry role="catalog_table_entry"><para role="column_definition">
11137 <structfield>from_sql</structfield> <type>bool</type>
11138 </para>
11139 <para>
11140 <literal>true</literal> if the prepared statement was created
11141 via the <command>PREPARE</command> SQL command;
11142 <literal>false</literal> if the statement was prepared via the
11143 frontend/backend protocol
11144 </para></entry>
11145 </row>
11147 <row>
11148 <entry role="catalog_table_entry"><para role="column_definition">
11149 <structfield>generic_plans</structfield> <type>int8</type>
11150 </para>
11151 <para>
11152 Number of times generic plan was chosen
11153 </para></entry>
11154 </row>
11156 <row>
11157 <entry role="catalog_table_entry"><para role="column_definition">
11158 <structfield>custom_plans</structfield> <type>int8</type>
11159 </para>
11160 <para>
11161 Number of times custom plan was chosen
11162 </para></entry>
11163 </row>
11164 </tbody>
11165 </tgroup>
11166 </table>
11168 <para>
11169 The <structname>pg_prepared_statements</structname> view is read-only.
11170 </para>
11171 </sect1>
11173 <sect1 id="view-pg-prepared-xacts">
11174 <title><structname>pg_prepared_xacts</structname></title>
11176 <indexterm zone="view-pg-prepared-xacts">
11177 <primary>pg_prepared_xacts</primary>
11178 </indexterm>
11180 <para>
11181 The view <structname>pg_prepared_xacts</structname> displays
11182 information about transactions that are currently prepared for two-phase
11183 commit (see <xref linkend="sql-prepare-transaction"/> for details).
11184 </para>
11186 <para>
11187 <structname>pg_prepared_xacts</structname> contains one row per prepared
11188 transaction. An entry is removed when the transaction is committed or
11189 rolled back.
11190 </para>
11192 <table>
11193 <title><structname>pg_prepared_xacts</structname> Columns</title>
11194 <tgroup cols="1">
11195 <thead>
11196 <row>
11197 <entry role="catalog_table_entry"><para role="column_definition">
11198 Column Type
11199 </para>
11200 <para>
11201 Description
11202 </para></entry>
11203 </row>
11204 </thead>
11206 <tbody>
11207 <row>
11208 <entry role="catalog_table_entry"><para role="column_definition">
11209 <structfield>transaction</structfield> <type>xid</type>
11210 </para>
11211 <para>
11212 Numeric transaction identifier of the prepared transaction
11213 </para></entry>
11214 </row>
11216 <row>
11217 <entry role="catalog_table_entry"><para role="column_definition">
11218 <structfield>gid</structfield> <type>text</type>
11219 </para>
11220 <para>
11221 Global transaction identifier that was assigned to the transaction
11222 </para></entry>
11223 </row>
11225 <row>
11226 <entry role="catalog_table_entry"><para role="column_definition">
11227 <structfield>prepared</structfield> <type>timestamptz</type>
11228 </para>
11229 <para>
11230 Time at which the transaction was prepared for commit
11231 </para></entry>
11232 </row>
11234 <row>
11235 <entry role="catalog_table_entry"><para role="column_definition">
11236 <structfield>owner</structfield> <type>name</type>
11237 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
11238 </para>
11239 <para>
11240 Name of the user that executed the transaction
11241 </para></entry>
11242 </row>
11244 <row>
11245 <entry role="catalog_table_entry"><para role="column_definition">
11246 <structfield>database</structfield> <type>name</type>
11247 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>datname</structfield>)
11248 </para>
11249 <para>
11250 Name of the database in which the transaction was executed
11251 </para></entry>
11252 </row>
11253 </tbody>
11254 </tgroup>
11255 </table>
11257 <para>
11258 When the <structname>pg_prepared_xacts</structname> view is accessed, the
11259 internal transaction manager data structures are momentarily locked, and
11260 a copy is made for the view to display. This ensures that the
11261 view produces a consistent set of results, while not blocking
11262 normal operations longer than necessary. Nonetheless
11263 there could be some impact on database performance if this view is
11264 frequently accessed.
11265 </para>
11267 </sect1>
11269 <sect1 id="view-pg-publication-tables">
11270 <title><structname>pg_publication_tables</structname></title>
11272 <indexterm zone="view-pg-publication-tables">
11273 <primary>pg_publication_tables</primary>
11274 </indexterm>
11276 <para>
11277 The view <structname>pg_publication_tables</structname> provides
11278 information about the mapping between publications and the tables they
11279 contain. Unlike the underlying catalog
11280 <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>,
11281 this view expands
11282 publications defined as <literal>FOR ALL TABLES</literal>, so for such
11283 publications there will be a row for each eligible table.
11284 </para>
11286 <table>
11287 <title><structname>pg_publication_tables</structname> Columns</title>
11288 <tgroup cols="1">
11289 <thead>
11290 <row>
11291 <entry role="catalog_table_entry"><para role="column_definition">
11292 Column Type
11293 </para>
11294 <para>
11295 Description
11296 </para></entry>
11297 </row>
11298 </thead>
11300 <tbody>
11301 <row>
11302 <entry role="catalog_table_entry"><para role="column_definition">
11303 <structfield>pubname</structfield> <type>name</type>
11304 (references <link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.<structfield>pubname</structfield>)
11305 </para>
11306 <para>
11307 Name of publication
11308 </para></entry>
11309 </row>
11311 <row>
11312 <entry role="catalog_table_entry"><para role="column_definition">
11313 <structfield>schemaname</structfield> <type>name</type>
11314 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
11315 </para>
11316 <para>
11317 Name of schema containing table
11318 </para></entry>
11319 </row>
11321 <row>
11322 <entry role="catalog_table_entry"><para role="column_definition">
11323 <structfield>tablename</structfield> <type>name</type>
11324 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
11325 </para>
11326 <para>
11327 Name of table
11328 </para></entry>
11329 </row>
11330 </tbody>
11331 </tgroup>
11332 </table>
11333 </sect1>
11335 <sect1 id="view-pg-replication-origin-status">
11336 <title><structname>pg_replication_origin_status</structname></title>
11338 <indexterm zone="view-pg-replication-origin-status">
11339 <primary>pg_replication_origin_status</primary>
11340 </indexterm>
11342 <para>
11343 The <structname>pg_replication_origin_status</structname> view
11344 contains information about how far replay for a certain origin has
11345 progressed. For more on replication origins
11346 see <xref linkend="replication-origins"/>.
11347 </para>
11349 <table>
11350 <title><structname>pg_replication_origin_status</structname> Columns</title>
11351 <tgroup cols="1">
11352 <thead>
11353 <row>
11354 <entry role="catalog_table_entry"><para role="column_definition">
11355 Column Type
11356 </para>
11357 <para>
11358 Description
11359 </para></entry>
11360 </row>
11361 </thead>
11363 <tbody>
11364 <row>
11365 <entry role="catalog_table_entry"><para role="column_definition">
11366 <structfield>local_id</structfield> <type>oid</type>
11367 (references <link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.<structfield>roident</structfield>)
11368 </para>
11369 <para>
11370 internal node identifier
11371 </para></entry>
11372 </row>
11374 <row>
11375 <entry role="catalog_table_entry"><para role="column_definition">
11376 <structfield>external_id</structfield> <type>text</type>
11377 (references <link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.<structfield>roname</structfield>)
11378 </para>
11379 <para>
11380 external node identifier
11381 </para></entry>
11382 </row>
11384 <row>
11385 <entry role="catalog_table_entry"><para role="column_definition">
11386 <structfield>remote_lsn</structfield> <type>pg_lsn</type>
11387 </para>
11388 <para>
11389 The origin node's LSN up to which data has been replicated.
11390 </para></entry>
11391 </row>
11393 <row>
11394 <entry role="catalog_table_entry"><para role="column_definition">
11395 <structfield>local_lsn</structfield> <type>pg_lsn</type>
11396 </para>
11397 <para>
11398 This node's LSN at which <literal>remote_lsn</literal> has
11399 been replicated. Used to flush commit records before persisting
11400 data to disk when using asynchronous commits.
11401 </para></entry>
11402 </row>
11403 </tbody>
11404 </tgroup>
11405 </table>
11406 </sect1>
11408 <sect1 id="view-pg-replication-slots">
11409 <title><structname>pg_replication_slots</structname></title>
11411 <indexterm zone="view-pg-replication-slots">
11412 <primary>pg_replication_slots</primary>
11413 </indexterm>
11415 <para>
11416 The <structname>pg_replication_slots</structname> view provides a listing
11417 of all replication slots that currently exist on the database cluster,
11418 along with their current state.
11419 </para>
11421 <para>
11422 For more on replication slots,
11423 see <xref linkend="streaming-replication-slots"/> and <xref linkend="logicaldecoding"/>.
11424 </para>
11426 <table>
11427 <title><structname>pg_replication_slots</structname> Columns</title>
11428 <tgroup cols="1">
11429 <thead>
11430 <row>
11431 <entry role="catalog_table_entry"><para role="column_definition">
11432 Column Type
11433 </para>
11434 <para>
11435 Description
11436 </para></entry>
11437 </row>
11438 </thead>
11440 <tbody>
11441 <row>
11442 <entry role="catalog_table_entry"><para role="column_definition">
11443 <structfield>slot_name</structfield> <type>name</type>
11444 </para>
11445 <para>
11446 A unique, cluster-wide identifier for the replication slot
11447 </para></entry>
11448 </row>
11450 <row>
11451 <entry role="catalog_table_entry"><para role="column_definition">
11452 <structfield>plugin</structfield> <type>name</type>
11453 </para>
11454 <para>
11455 The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.
11456 </para></entry>
11457 </row>
11459 <row>
11460 <entry role="catalog_table_entry"><para role="column_definition">
11461 <structfield>slot_type</structfield> <type>text</type>
11462 </para>
11463 <para>
11464 The slot type: <literal>physical</literal> or <literal>logical</literal>
11465 </para></entry>
11466 </row>
11468 <row>
11469 <entry role="catalog_table_entry"><para role="column_definition">
11470 <structfield>datoid</structfield> <type>oid</type>
11471 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
11472 </para>
11473 <para>
11474 The OID of the database this slot is associated with, or
11475 null. Only logical slots have an associated database.
11476 </para></entry>
11477 </row>
11479 <row>
11480 <entry role="catalog_table_entry"><para role="column_definition">
11481 <structfield>database</structfield> <type>name</type>
11482 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>datname</structfield>)
11483 </para>
11484 <para>
11485 The name of the database this slot is associated with, or
11486 null. Only logical slots have an associated database.
11487 </para></entry>
11488 </row>
11490 <row>
11491 <entry role="catalog_table_entry"><para role="column_definition">
11492 <structfield>temporary</structfield> <type>bool</type>
11493 </para>
11494 <para>
11495 True if this is a temporary replication slot. Temporary slots are
11496 not saved to disk and are automatically dropped on error or when
11497 the session has finished.
11498 </para></entry>
11499 </row>
11501 <row>
11502 <entry role="catalog_table_entry"><para role="column_definition">
11503 <structfield>active</structfield> <type>bool</type>
11504 </para>
11505 <para>
11506 True if this slot is currently actively being used
11507 </para></entry>
11508 </row>
11510 <row>
11511 <entry role="catalog_table_entry"><para role="column_definition">
11512 <structfield>active_pid</structfield> <type>int4</type>
11513 </para>
11514 <para>
11515 The process ID of the session using this slot if the slot
11516 is currently actively being used. <literal>NULL</literal> if
11517 inactive.
11518 </para></entry>
11519 </row>
11521 <row>
11522 <entry role="catalog_table_entry"><para role="column_definition">
11523 <structfield>xmin</structfield> <type>xid</type>
11524 </para>
11525 <para>
11526 The oldest transaction that this slot needs the database to
11527 retain. <literal>VACUUM</literal> cannot remove tuples deleted
11528 by any later transaction.
11529 </para></entry>
11530 </row>
11532 <row>
11533 <entry role="catalog_table_entry"><para role="column_definition">
11534 <structfield>catalog_xmin</structfield> <type>xid</type>
11535 </para>
11536 <para>
11537 The oldest transaction affecting the system catalogs that this
11538 slot needs the database to retain. <literal>VACUUM</literal> cannot
11539 remove catalog tuples deleted by any later transaction.
11540 </para></entry>
11541 </row>
11543 <row>
11544 <entry role="catalog_table_entry"><para role="column_definition">
11545 <structfield>restart_lsn</structfield> <type>pg_lsn</type>
11546 </para>
11547 <para>
11548 The address (<literal>LSN</literal>) of oldest WAL which still
11549 might be required by the consumer of this slot and thus won't be
11550 automatically removed during checkpoints unless this LSN
11551 gets behind more than <xref linkend="guc-max-slot-wal-keep-size"/>
11552 from the current LSN. <literal>NULL</literal>
11553 if the <literal>LSN</literal> of this slot has never been reserved.
11554 </para></entry>
11555 </row>
11557 <row>
11558 <entry role="catalog_table_entry"><para role="column_definition">
11559 <structfield>confirmed_flush_lsn</structfield> <type>pg_lsn</type>
11560 </para>
11561 <para>
11562 The address (<literal>LSN</literal>) up to which the logical
11563 slot's consumer has confirmed receiving data. Data older than this is
11564 not available anymore. <literal>NULL</literal> for physical slots.
11565 </para></entry>
11566 </row>
11568 <row>
11569 <entry role="catalog_table_entry"><para role="column_definition">
11570 <structfield>wal_status</structfield> <type>text</type>
11571 </para>
11572 <para>
11573 Availability of WAL files claimed by this slot.
11574 Possible values are:
11575 <itemizedlist>
11576 <listitem>
11577 <para><literal>reserved</literal> means that the claimed files
11578 are within <varname>max_wal_size</varname>.</para>
11579 </listitem>
11580 <listitem>
11581 <para><literal>extended</literal> means
11582 that <varname>max_wal_size</varname> is exceeded but the files are
11583 still retained, either by the replication slot or
11584 by <varname>wal_keep_size</varname>.
11585 </para>
11586 </listitem>
11587 <listitem>
11588 <para>
11589 <literal>unreserved</literal> means that the slot no longer
11590 retains the required WAL files and some of them are to be removed at
11591 the next checkpoint. This state can return
11592 to <literal>reserved</literal> or <literal>extended</literal>.
11593 </para>
11594 </listitem>
11595 <listitem>
11596 <para>
11597 <literal>lost</literal> means that some required WAL files have
11598 been removed and this slot is no longer usable.
11599 </para>
11600 </listitem>
11601 </itemizedlist>
11602 The last two states are seen only when
11603 <xref linkend="guc-max-slot-wal-keep-size"/> is
11604 non-negative. If <structfield>restart_lsn</structfield> is NULL, this
11605 field is null.
11606 </para></entry>
11607 </row>
11609 <row>
11610 <entry role="catalog_table_entry"><para role="column_definition">
11611 <structfield>safe_wal_size</structfield> <type>int8</type>
11612 </para>
11613 <para>
11614 The number of bytes that can be written to WAL such that this slot
11615 is not in danger of getting in state "lost". It is NULL for lost
11616 slots, as well as if <varname>max_slot_wal_keep_size</varname>
11617 is <literal>-1</literal>.
11618 </para></entry>
11619 </row>
11621 <row>
11622 <entry role="catalog_table_entry"><para role="column_definition">
11623 <structfield>two_phase</structfield> <type>bool</type>
11624 </para>
11625 <para>
11626 True if the slot is enabled for decoding prepared transactions. Always
11627 false for physical slots.
11628 </para></entry>
11629 </row>
11630 </tbody>
11631 </tgroup>
11632 </table>
11633 </sect1>
11635 <sect1 id="view-pg-roles">
11636 <title><structname>pg_roles</structname></title>
11638 <indexterm zone="view-pg-roles">
11639 <primary>pg_roles</primary>
11640 </indexterm>
11642 <para>
11643 The view <structname>pg_roles</structname> provides access to
11644 information about database roles. This is simply a publicly
11645 readable view of
11646 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
11647 that blanks out the password field.
11648 </para>
11650 <table>
11651 <title><structname>pg_roles</structname> Columns</title>
11652 <tgroup cols="1">
11653 <thead>
11654 <row>
11655 <entry role="catalog_table_entry"><para role="column_definition">
11656 Column Type
11657 </para>
11658 <para>
11659 Description
11660 </para></entry>
11661 </row>
11662 </thead>
11664 <tbody>
11665 <row>
11666 <entry role="catalog_table_entry"><para role="column_definition">
11667 <structfield>rolname</structfield> <type>name</type>
11668 </para>
11669 <para>
11670 Role name
11671 </para></entry>
11672 </row>
11674 <row>
11675 <entry role="catalog_table_entry"><para role="column_definition">
11676 <structfield>rolsuper</structfield> <type>bool</type>
11677 </para>
11678 <para>
11679 Role has superuser privileges
11680 </para></entry>
11681 </row>
11683 <row>
11684 <entry role="catalog_table_entry"><para role="column_definition">
11685 <structfield>rolinherit</structfield> <type>bool</type>
11686 </para>
11687 <para>
11688 Role automatically inherits privileges of roles it is a
11689 member of
11690 </para></entry>
11691 </row>
11693 <row>
11694 <entry role="catalog_table_entry"><para role="column_definition">
11695 <structfield>rolcreaterole</structfield> <type>bool</type>
11696 </para>
11697 <para>
11698 Role can create more roles
11699 </para></entry>
11700 </row>
11702 <row>
11703 <entry role="catalog_table_entry"><para role="column_definition">
11704 <structfield>rolcreatedb</structfield> <type>bool</type>
11705 </para>
11706 <para>
11707 Role can create databases
11708 </para></entry>
11709 </row>
11711 <row>
11712 <entry role="catalog_table_entry"><para role="column_definition">
11713 <structfield>rolcanlogin</structfield> <type>bool</type>
11714 </para>
11715 <para>
11716 Role can log in. That is, this role can be given as the initial
11717 session authorization identifier
11718 </para></entry>
11719 </row>
11721 <row>
11722 <entry role="catalog_table_entry"><para role="column_definition">
11723 <structfield>rolreplication</structfield> <type>bool</type>
11724 </para>
11725 <para>
11726 Role is a replication role. A replication role can initiate replication
11727 connections and create and drop replication slots.
11728 </para></entry>
11729 </row>
11731 <row>
11732 <entry role="catalog_table_entry"><para role="column_definition">
11733 <structfield>rolconnlimit</structfield> <type>int4</type>
11734 </para>
11735 <para>
11736 For roles that can log in, this sets maximum number of concurrent
11737 connections this role can make. -1 means no limit.
11738 </para></entry>
11739 </row>
11741 <row>
11742 <entry role="catalog_table_entry"><para role="column_definition">
11743 <structfield>rolpassword</structfield> <type>text</type>
11744 </para>
11745 <para>
11746 Not the password (always reads as <literal>********</literal>)
11747 </para></entry>
11748 </row>
11750 <row>
11751 <entry role="catalog_table_entry"><para role="column_definition">
11752 <structfield>rolvaliduntil</structfield> <type>timestamptz</type>
11753 </para>
11754 <para>
11755 Password expiry time (only used for password authentication);
11756 null if no expiration
11757 </para></entry>
11758 </row>
11760 <row>
11761 <entry role="catalog_table_entry"><para role="column_definition">
11762 <structfield>rolbypassrls</structfield> <type>bool</type>
11763 </para>
11764 <para>
11765 Role bypasses every row-level security policy, see
11766 <xref linkend="ddl-rowsecurity"/> for more information.
11767 </para></entry>
11768 </row>
11770 <row>
11771 <entry role="catalog_table_entry"><para role="column_definition">
11772 <structfield>rolconfig</structfield> <type>text[]</type>
11773 </para>
11774 <para>
11775 Role-specific defaults for run-time configuration variables
11776 </para></entry>
11777 </row>
11779 <row>
11780 <entry role="catalog_table_entry"><para role="column_definition">
11781 <structfield>oid</structfield> <type>oid</type>
11782 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
11783 </para>
11784 <para>
11785 ID of role
11786 </para></entry>
11787 </row>
11788 </tbody>
11789 </tgroup>
11790 </table>
11792 </sect1>
11794 <sect1 id="view-pg-rules">
11795 <title><structname>pg_rules</structname></title>
11797 <indexterm zone="view-pg-rules">
11798 <primary>pg_rules</primary>
11799 </indexterm>
11801 <para>
11802 The view <structname>pg_rules</structname> provides access to
11803 useful information about query rewrite rules.
11804 </para>
11806 <table>
11807 <title><structname>pg_rules</structname> Columns</title>
11808 <tgroup cols="1">
11809 <thead>
11810 <row>
11811 <entry role="catalog_table_entry"><para role="column_definition">
11812 Column Type
11813 </para>
11814 <para>
11815 Description
11816 </para></entry>
11817 </row>
11818 </thead>
11820 <tbody>
11821 <row>
11822 <entry role="catalog_table_entry"><para role="column_definition">
11823 <structfield>schemaname</structfield> <type>name</type>
11824 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
11825 </para>
11826 <para>
11827 Name of schema containing table
11828 </para></entry>
11829 </row>
11831 <row>
11832 <entry role="catalog_table_entry"><para role="column_definition">
11833 <structfield>tablename</structfield> <type>name</type>
11834 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
11835 </para>
11836 <para>
11837 Name of table the rule is for
11838 </para></entry>
11839 </row>
11841 <row>
11842 <entry role="catalog_table_entry"><para role="column_definition">
11843 <structfield>rulename</structfield> <type>name</type>
11844 (references <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.<structfield>rulename</structfield>)
11845 </para>
11846 <para>
11847 Name of rule
11848 </para></entry>
11849 </row>
11851 <row>
11852 <entry role="catalog_table_entry"><para role="column_definition">
11853 <structfield>definition</structfield> <type>text</type>
11854 </para>
11855 <para>
11856 Rule definition (a reconstructed creation command)
11857 </para></entry>
11858 </row>
11859 </tbody>
11860 </tgroup>
11861 </table>
11863 <para>
11864 The <structname>pg_rules</structname> view excludes the <literal>ON SELECT</literal> rules
11865 of views and materialized views; those can be seen in
11866 <link linkend="view-pg-views"><structname>pg_views</structname></link> and <link linkend="view-pg-matviews"><structname>pg_matviews</structname></link>.
11867 </para>
11869 </sect1>
11871 <sect1 id="view-pg-seclabels">
11872 <title><structname>pg_seclabels</structname></title>
11874 <indexterm zone="view-pg-seclabels">
11875 <primary>pg_seclabels</primary>
11876 </indexterm>
11878 <para>
11879 The view <structname>pg_seclabels</structname> provides information about
11880 security labels. It as an easier-to-query version of the
11881 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link> catalog.
11882 </para>
11884 <table>
11885 <title><structname>pg_seclabels</structname> Columns</title>
11886 <tgroup cols="1">
11887 <thead>
11888 <row>
11889 <entry role="catalog_table_entry"><para role="column_definition">
11890 Column Type
11891 </para>
11892 <para>
11893 Description
11894 </para></entry>
11895 </row>
11896 </thead>
11898 <tbody>
11899 <row>
11900 <entry role="catalog_table_entry"><para role="column_definition">
11901 <structfield>objoid</structfield> <type>oid</type>
11902 (references any OID column)
11903 </para>
11904 <para>
11905 The OID of the object this security label pertains to
11906 </para></entry>
11907 </row>
11909 <row>
11910 <entry role="catalog_table_entry"><para role="column_definition">
11911 <structfield>classoid</structfield> <type>oid</type>
11912 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
11913 </para>
11914 <para>
11915 The OID of the system catalog this object appears in
11916 </para></entry>
11917 </row>
11919 <row>
11920 <entry role="catalog_table_entry"><para role="column_definition">
11921 <structfield>objsubid</structfield> <type>int4</type>
11922 </para>
11923 <para>
11924 For a security label on a table column, this is the column number (the
11925 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
11926 the table itself). For all other object types, this column is
11927 zero.
11928 </para></entry>
11929 </row>
11931 <row>
11932 <entry role="catalog_table_entry"><para role="column_definition">
11933 <structfield>objtype</structfield> <type>text</type>
11934 </para>
11935 <para>
11936 The type of object to which this label applies, as text.
11937 </para></entry>
11938 </row>
11940 <row>
11941 <entry role="catalog_table_entry"><para role="column_definition">
11942 <structfield>objnamespace</structfield> <type>oid</type>
11943 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
11944 </para>
11945 <para>
11946 The OID of the namespace for this object, if applicable;
11947 otherwise NULL.
11948 </para></entry>
11949 </row>
11951 <row>
11952 <entry role="catalog_table_entry"><para role="column_definition">
11953 <structfield>objname</structfield> <type>text</type>
11954 </para>
11955 <para>
11956 The name of the object to which this label applies, as text.
11957 </para></entry>
11958 </row>
11960 <row>
11961 <entry role="catalog_table_entry"><para role="column_definition">
11962 <structfield>provider</structfield> <type>text</type>
11963 (references <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.<structfield>provider</structfield>)
11964 </para>
11965 <para>
11966 The label provider associated with this label.
11967 </para></entry>
11968 </row>
11970 <row>
11971 <entry role="catalog_table_entry"><para role="column_definition">
11972 <structfield>label</structfield> <type>text</type>
11973 (references <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.<structfield>label</structfield>)
11974 </para>
11975 <para>
11976 The security label applied to this object.
11977 </para></entry>
11978 </row>
11979 </tbody>
11980 </tgroup>
11981 </table>
11982 </sect1>
11984 <sect1 id="view-pg-sequences">
11985 <title><structname>pg_sequences</structname></title>
11987 <indexterm zone="view-pg-sequences">
11988 <primary>pg_sequences</primary>
11989 </indexterm>
11991 <para>
11992 The view <structname>pg_sequences</structname> provides access to
11993 useful information about each sequence in the database.
11994 </para>
11996 <table>
11997 <title><structname>pg_sequences</structname> Columns</title>
11998 <tgroup cols="1">
11999 <thead>
12000 <row>
12001 <entry role="catalog_table_entry"><para role="column_definition">
12002 Column Type
12003 </para>
12004 <para>
12005 Description
12006 </para></entry>
12007 </row>
12008 </thead>
12010 <tbody>
12011 <row>
12012 <entry role="catalog_table_entry"><para role="column_definition">
12013 <structfield>schemaname</structfield> <type>name</type>
12014 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12015 </para>
12016 <para>
12017 Name of schema containing sequence
12018 </para></entry>
12019 </row>
12021 <row>
12022 <entry role="catalog_table_entry"><para role="column_definition">
12023 <structfield>sequencename</structfield> <type>name</type>
12024 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
12025 </para>
12026 <para>
12027 Name of sequence
12028 </para></entry>
12029 </row>
12031 <row>
12032 <entry role="catalog_table_entry"><para role="column_definition">
12033 <structfield>sequenceowner</structfield> <type>name</type>
12034 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
12035 </para>
12036 <para>
12037 Name of sequence's owner
12038 </para></entry>
12039 </row>
12041 <row>
12042 <entry role="catalog_table_entry"><para role="column_definition">
12043 <structfield>data_type</structfield> <type>regtype</type>
12044 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
12045 </para>
12046 <para>
12047 Data type of the sequence
12048 </para></entry>
12049 </row>
12051 <row>
12052 <entry role="catalog_table_entry"><para role="column_definition">
12053 <structfield>start_value</structfield> <type>int8</type>
12054 </para>
12055 <para>
12056 Start value of the sequence
12057 </para></entry>
12058 </row>
12060 <row>
12061 <entry role="catalog_table_entry"><para role="column_definition">
12062 <structfield>min_value</structfield> <type>int8</type>
12063 </para>
12064 <para>
12065 Minimum value of the sequence
12066 </para></entry>
12067 </row>
12069 <row>
12070 <entry role="catalog_table_entry"><para role="column_definition">
12071 <structfield>max_value</structfield> <type>int8</type>
12072 </para>
12073 <para>
12074 Maximum value of the sequence
12075 </para></entry>
12076 </row>
12078 <row>
12079 <entry role="catalog_table_entry"><para role="column_definition">
12080 <structfield>increment_by</structfield> <type>int8</type>
12081 </para>
12082 <para>
12083 Increment value of the sequence
12084 </para></entry>
12085 </row>
12087 <row>
12088 <entry role="catalog_table_entry"><para role="column_definition">
12089 <structfield>cycle</structfield> <type>bool</type>
12090 </para>
12091 <para>
12092 Whether the sequence cycles
12093 </para></entry>
12094 </row>
12096 <row>
12097 <entry role="catalog_table_entry"><para role="column_definition">
12098 <structfield>cache_size</structfield> <type>int8</type>
12099 </para>
12100 <para>
12101 Cache size of the sequence
12102 </para></entry>
12103 </row>
12105 <row>
12106 <entry role="catalog_table_entry"><para role="column_definition">
12107 <structfield>last_value</structfield> <type>int8</type>
12108 </para>
12109 <para>
12110 The last sequence value written to disk. If caching is used,
12111 this value can be greater than the last value handed out from the
12112 sequence. Null if the sequence has not been read from yet. Also, if
12113 the current user does not have <literal>USAGE</literal>
12114 or <literal>SELECT</literal> privilege on the sequence, the value is
12115 null.
12116 </para></entry>
12117 </row>
12118 </tbody>
12119 </tgroup>
12120 </table>
12121 </sect1>
12123 <sect1 id="view-pg-settings">
12124 <title><structname>pg_settings</structname></title>
12126 <indexterm zone="view-pg-settings">
12127 <primary>pg_settings</primary>
12128 </indexterm>
12130 <para>
12131 The view <structname>pg_settings</structname> provides access to
12132 run-time parameters of the server. It is essentially an alternative
12133 interface to the <link linkend="sql-show"><command>SHOW</command></link>
12134 and <link linkend="sql-set"><command>SET</command></link> commands.
12135 It also provides access to some facts about each parameter that are
12136 not directly available from <link linkend="sql-show"><command>SHOW</command></link>, such as minimum and
12137 maximum values.
12138 </para>
12140 <table>
12141 <title><structname>pg_settings</structname> Columns</title>
12142 <tgroup cols="1">
12143 <thead>
12144 <row>
12145 <entry role="catalog_table_entry"><para role="column_definition">
12146 Column Type
12147 </para>
12148 <para>
12149 Description
12150 </para></entry>
12151 </row>
12152 </thead>
12154 <tbody>
12155 <row>
12156 <entry role="catalog_table_entry"><para role="column_definition">
12157 <structfield>name</structfield> <type>text</type>
12158 </para>
12159 <para>
12160 Run-time configuration parameter name
12161 </para></entry>
12162 </row>
12164 <row>
12165 <entry role="catalog_table_entry"><para role="column_definition">
12166 <structfield>setting</structfield> <type>text</type>
12167 </para>
12168 <para>
12169 Current value of the parameter
12170 </para></entry>
12171 </row>
12173 <row>
12174 <entry role="catalog_table_entry"><para role="column_definition">
12175 <structfield>unit</structfield> <type>text</type>
12176 </para>
12177 <para>
12178 Implicit unit of the parameter
12179 </para></entry>
12180 </row>
12182 <row>
12183 <entry role="catalog_table_entry"><para role="column_definition">
12184 <structfield>category</structfield> <type>text</type>
12185 </para>
12186 <para>
12187 Logical group of the parameter
12188 </para></entry>
12189 </row>
12191 <row>
12192 <entry role="catalog_table_entry"><para role="column_definition">
12193 <structfield>short_desc</structfield> <type>text</type>
12194 </para>
12195 <para>
12196 A brief description of the parameter
12197 </para></entry>
12198 </row>
12200 <row>
12201 <entry role="catalog_table_entry"><para role="column_definition">
12202 <structfield>extra_desc</structfield> <type>text</type>
12203 </para>
12204 <para>
12205 Additional, more detailed, description of the parameter
12206 </para></entry>
12207 </row>
12209 <row>
12210 <entry role="catalog_table_entry"><para role="column_definition">
12211 <structfield>context</structfield> <type>text</type>
12212 </para>
12213 <para>
12214 Context required to set the parameter's value (see below)
12215 </para></entry>
12216 </row>
12218 <row>
12219 <entry role="catalog_table_entry"><para role="column_definition">
12220 <structfield>vartype</structfield> <type>text</type>
12221 </para>
12222 <para>
12223 Parameter type (<literal>bool</literal>, <literal>enum</literal>,
12224 <literal>integer</literal>, <literal>real</literal>, or <literal>string</literal>)
12225 </para></entry>
12226 </row>
12228 <row>
12229 <entry role="catalog_table_entry"><para role="column_definition">
12230 <structfield>source</structfield> <type>text</type>
12231 </para>
12232 <para>
12233 Source of the current parameter value
12234 </para></entry>
12235 </row>
12237 <row>
12238 <entry role="catalog_table_entry"><para role="column_definition">
12239 <structfield>min_val</structfield> <type>text</type>
12240 </para>
12241 <para>
12242 Minimum allowed value of the parameter (null for non-numeric
12243 values)
12244 </para></entry>
12245 </row>
12247 <row>
12248 <entry role="catalog_table_entry"><para role="column_definition">
12249 <structfield>max_val</structfield> <type>text</type>
12250 </para>
12251 <para>
12252 Maximum allowed value of the parameter (null for non-numeric
12253 values)
12254 </para></entry>
12255 </row>
12257 <row>
12258 <entry role="catalog_table_entry"><para role="column_definition">
12259 <structfield>enumvals</structfield> <type>text[]</type>
12260 </para>
12261 <para>
12262 Allowed values of an enum parameter (null for non-enum
12263 values)
12264 </para></entry>
12265 </row>
12267 <row>
12268 <entry role="catalog_table_entry"><para role="column_definition">
12269 <structfield>boot_val</structfield> <type>text</type>
12270 </para>
12271 <para>
12272 Parameter value assumed at server startup if the parameter is
12273 not otherwise set
12274 </para></entry>
12275 </row>
12277 <row>
12278 <entry role="catalog_table_entry"><para role="column_definition">
12279 <structfield>reset_val</structfield> <type>text</type>
12280 </para>
12281 <para>
12282 Value that <link linkend="sql-reset"><command>RESET</command></link> would reset the parameter to
12283 in the current session
12284 </para></entry>
12285 </row>
12287 <row>
12288 <entry role="catalog_table_entry"><para role="column_definition">
12289 <structfield>sourcefile</structfield> <type>text</type>
12290 </para>
12291 <para>
12292 Configuration file the current value was set in (null for
12293 values set from sources other than configuration files, or when
12294 examined by a user who is neither a superuser or a member of
12295 <literal>pg_read_all_settings</literal>); helpful when using
12296 <literal>include</literal> directives in configuration files
12297 </para></entry>
12298 </row>
12300 <row>
12301 <entry role="catalog_table_entry"><para role="column_definition">
12302 <structfield>sourceline</structfield> <type>int4</type>
12303 </para>
12304 <para>
12305 Line number within the configuration file the current value was
12306 set at (null for values set from sources other than configuration files,
12307 or when examined by a user who is neither a superuser or a member of
12308 <literal>pg_read_all_settings</literal>).
12309 </para></entry>
12310 </row>
12312 <row>
12313 <entry role="catalog_table_entry"><para role="column_definition">
12314 <structfield>pending_restart</structfield> <type>bool</type>
12315 </para>
12316 <para>
12317 <literal>true</literal> if the value has been changed in the
12318 configuration file but needs a restart; or <literal>false</literal>
12319 otherwise.
12320 </para></entry>
12321 </row>
12322 </tbody>
12323 </tgroup>
12324 </table>
12326 <para>
12327 There are several possible values of <structfield>context</structfield>.
12328 In order of decreasing difficulty of changing the setting, they are:
12329 </para>
12331 <variablelist>
12332 <varlistentry>
12333 <!-- PGC_INTERNAL -->
12334 <term><literal>internal</literal></term>
12335 <listitem>
12336 <para>
12337 These settings cannot be changed directly; they reflect internally
12338 determined values. Some of them may be adjustable by rebuilding the
12339 server with different configuration options, or by changing options
12340 supplied to <application>initdb</application>.
12341 </para>
12342 </listitem>
12343 </varlistentry>
12344 <varlistentry>
12345 <!-- PGC_POSTMASTER -->
12346 <term><literal>postmaster</literal></term>
12347 <listitem>
12348 <para>
12349 These settings can only be applied when the server starts, so any change
12350 requires restarting the server. Values for these settings are typically
12351 stored in the <filename>postgresql.conf</filename> file, or passed on
12352 the command line when starting the server. Of course, settings with any
12353 of the lower <structfield>context</structfield> types can also be
12354 set at server start time.
12355 </para>
12356 </listitem>
12357 </varlistentry>
12358 <varlistentry>
12359 <!-- PGC_SIGHUP -->
12360 <term><literal>sighup</literal></term>
12361 <listitem>
12362 <para>
12363 Changes to these settings can be made in
12364 <filename>postgresql.conf</filename> without restarting the server.
12365 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
12366 cause it to re-read <filename>postgresql.conf</filename> and apply
12367 the changes. The postmaster will also forward the
12368 <systemitem>SIGHUP</systemitem> signal to its child processes so that
12369 they all pick up the new value.
12370 </para>
12371 </listitem>
12372 </varlistentry>
12373 <varlistentry>
12374 <!-- PGC_SU_BACKEND -->
12375 <term><literal>superuser-backend</literal></term>
12376 <listitem>
12377 <para>
12378 Changes to these settings can be made in
12379 <filename>postgresql.conf</filename> without restarting the server.
12380 They can also be set for a particular session in the connection request
12381 packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
12382 environment variable), but only if the connecting user is a superuser.
12383 However, these settings never change in a session after it is started.
12384 If you change them in <filename>postgresql.conf</filename>, send a
12385 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
12386 re-read <filename>postgresql.conf</filename>. The new values will only
12387 affect subsequently-launched sessions.
12388 </para>
12389 </listitem>
12390 </varlistentry>
12391 <varlistentry>
12392 <!-- PGC_BACKEND -->
12393 <term><literal>backend</literal></term>
12394 <listitem>
12395 <para>
12396 Changes to these settings can be made in
12397 <filename>postgresql.conf</filename> without restarting the server.
12398 They can also be set for a particular session in the connection request
12399 packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
12400 environment variable); any user can make such a change for their session.
12401 However, these settings never change in a session after it is started.
12402 If you change them in <filename>postgresql.conf</filename>, send a
12403 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
12404 re-read <filename>postgresql.conf</filename>. The new values will only
12405 affect subsequently-launched sessions.
12406 </para>
12407 </listitem>
12408 </varlistentry>
12409 <varlistentry>
12410 <!-- PGC_SUSET -->
12411 <term><literal>superuser</literal></term>
12412 <listitem>
12413 <para>
12414 These settings can be set from <filename>postgresql.conf</filename>,
12415 or within a session via the <command>SET</command> command; but only superusers
12416 can change them via <command>SET</command>. Changes in
12417 <filename>postgresql.conf</filename> will affect existing sessions
12418 only if no session-local value has been established with <command>SET</command>.
12419 </para>
12420 </listitem>
12421 </varlistentry>
12422 <varlistentry>
12423 <!-- PGC_USERSET -->
12424 <term><literal>user</literal></term>
12425 <listitem>
12426 <para>
12427 These settings can be set from <filename>postgresql.conf</filename>,
12428 or within a session via the <command>SET</command> command. Any user is
12429 allowed to change their session-local value. Changes in
12430 <filename>postgresql.conf</filename> will affect existing sessions
12431 only if no session-local value has been established with <command>SET</command>.
12432 </para>
12433 </listitem>
12434 </varlistentry>
12435 </variablelist>
12437 <para>
12438 See <xref linkend="config-setting"/> for more information about the various
12439 ways to change these parameters.
12440 </para>
12442 <para>
12443 This view does not display <link linkend="runtime-config-custom">customized options</link>
12444 until the extension module that defines them has been loaded.
12445 </para>
12447 <para>
12448 This view cannot be inserted into or deleted from, but it can be updated. An
12449 <command>UPDATE</command> applied to a row of <structname>pg_settings</structname>
12450 is equivalent to executing the <command>SET</command> command on that named
12451 parameter. The change only affects the value used by the current
12452 session. If an <command>UPDATE</command> is issued within a transaction
12453 that is later aborted, the effects of the <command>UPDATE</command> command
12454 disappear when the transaction is rolled back. Once the surrounding
12455 transaction is committed, the effects will persist until the end of the
12456 session, unless overridden by another <command>UPDATE</command> or
12457 <command>SET</command>.
12458 </para>
12460 </sect1>
12462 <sect1 id="view-pg-shadow">
12463 <title><structname>pg_shadow</structname></title>
12465 <indexterm zone="view-pg-shadow">
12466 <primary>pg_shadow</primary>
12467 </indexterm>
12469 <para>
12470 The view <structname>pg_shadow</structname> exists for backwards
12471 compatibility: it emulates a catalog that existed in
12472 <productname>PostgreSQL</productname> before version 8.1.
12473 It shows properties of all roles that are marked as
12474 <structfield>rolcanlogin</structfield> in
12475 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
12476 </para>
12478 <para>
12479 The name stems from the fact that this table
12480 should not be readable by the public since it contains passwords.
12481 <link linkend="view-pg-user"><structname>pg_user</structname></link>
12482 is a publicly readable view on
12483 <structname>pg_shadow</structname> that blanks out the password field.
12484 </para>
12486 <table>
12487 <title><structname>pg_shadow</structname> Columns</title>
12488 <tgroup cols="1">
12489 <thead>
12490 <row>
12491 <entry role="catalog_table_entry"><para role="column_definition">
12492 Column Type
12493 </para>
12494 <para>
12495 Description
12496 </para></entry>
12497 </row>
12498 </thead>
12500 <tbody>
12501 <row>
12502 <entry role="catalog_table_entry"><para role="column_definition">
12503 <structfield>usename</structfield> <type>name</type>
12504 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
12505 </para>
12506 <para>
12507 User name
12508 </para></entry>
12509 </row>
12511 <row>
12512 <entry role="catalog_table_entry"><para role="column_definition">
12513 <structfield>usesysid</structfield> <type>oid</type>
12514 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
12515 </para>
12516 <para>
12517 ID of this user
12518 </para></entry>
12519 </row>
12521 <row>
12522 <entry role="catalog_table_entry"><para role="column_definition">
12523 <structfield>usecreatedb</structfield> <type>bool</type>
12524 </para>
12525 <para>
12526 User can create databases
12527 </para></entry>
12528 </row>
12530 <row>
12531 <entry role="catalog_table_entry"><para role="column_definition">
12532 <structfield>usesuper</structfield> <type>bool</type>
12533 </para>
12534 <para>
12535 User is a superuser
12536 </para></entry>
12537 </row>
12539 <row>
12540 <entry role="catalog_table_entry"><para role="column_definition">
12541 <structfield>userepl</structfield> <type>bool</type>
12542 </para>
12543 <para>
12544 User can initiate streaming replication and put the system in and
12545 out of backup mode.
12546 </para></entry>
12547 </row>
12549 <row>
12550 <entry role="catalog_table_entry"><para role="column_definition">
12551 <structfield>usebypassrls</structfield> <type>bool</type>
12552 </para>
12553 <para>
12554 User bypasses every row-level security policy, see
12555 <xref linkend="ddl-rowsecurity"/> for more information.
12556 </para></entry>
12557 </row>
12559 <row>
12560 <entry role="catalog_table_entry"><para role="column_definition">
12561 <structfield>passwd</structfield> <type>text</type>
12562 </para>
12563 <para>
12564 Password (possibly encrypted); null if none. See
12565 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
12566 for details of how encrypted passwords are stored.
12567 </para></entry>
12568 </row>
12570 <row>
12571 <entry role="catalog_table_entry"><para role="column_definition">
12572 <structfield>valuntil</structfield> <type>timestamptz</type>
12573 </para>
12574 <para>
12575 Password expiry time (only used for password authentication)
12576 </para></entry>
12577 </row>
12579 <row>
12580 <entry role="catalog_table_entry"><para role="column_definition">
12581 <structfield>useconfig</structfield> <type>text[]</type>
12582 </para>
12583 <para>
12584 Session defaults for run-time configuration variables
12585 </para></entry>
12586 </row>
12587 </tbody>
12588 </tgroup>
12589 </table>
12591 </sect1>
12593 <sect1 id="view-pg-shmem-allocations">
12594 <title><structname>pg_shmem_allocations</structname></title>
12596 <indexterm zone="view-pg-shmem-allocations">
12597 <primary>pg_shmem_allocations</primary>
12598 </indexterm>
12600 <para>
12601 The <structname>pg_shmem_allocations</structname> view shows allocations
12602 made from the server's main shared memory segment. This includes both
12603 memory allocated by <productname>postgres</productname> itself and memory
12604 allocated by extensions using the mechanisms detailed in
12605 <xref linkend="xfunc-shared-addin" />.
12606 </para>
12608 <para>
12609 Note that this view does not include memory allocated using the dynamic
12610 shared memory infrastructure.
12611 </para>
12613 <table>
12614 <title><structname>pg_shmem_allocations</structname> Columns</title>
12615 <tgroup cols="1">
12616 <thead>
12617 <row>
12618 <entry role="catalog_table_entry"><para role="column_definition">
12619 Column Type
12620 </para>
12621 <para>
12622 Description
12623 </para></entry>
12624 </row>
12625 </thead>
12627 <tbody>
12628 <row>
12629 <entry role="catalog_table_entry"><para role="column_definition">
12630 <structfield>name</structfield> <type>text</type>
12631 </para>
12632 <para>
12633 The name of the shared memory allocation. NULL for unused memory
12634 and <literal>&lt;anonymous&gt;</literal> for anonymous
12635 allocations.
12636 </para></entry>
12637 </row>
12639 <row>
12640 <entry role="catalog_table_entry"><para role="column_definition">
12641 <structfield>off</structfield> <type>int8</type>
12642 </para>
12643 <para>
12644 The offset at which the allocation starts. NULL for anonymous
12645 allocations, since details related to them are not known.
12646 </para></entry>
12647 </row>
12649 <row>
12650 <entry role="catalog_table_entry"><para role="column_definition">
12651 <structfield>size</structfield> <type>int8</type>
12652 </para>
12653 <para>
12654 Size of the allocation
12655 </para></entry>
12656 </row>
12658 <row>
12659 <entry role="catalog_table_entry"><para role="column_definition">
12660 <structfield>allocated_size</structfield> <type>int8</type>
12661 </para>
12662 <para>
12663 Size of the allocation including padding. For anonymous
12664 allocations, no information about padding is available, so the
12665 <literal>size</literal> and <literal>allocated_size</literal> columns
12666 will always be equal. Padding is not meaningful for free memory, so
12667 the columns will be equal in that case also.
12668 </para></entry>
12669 </row>
12670 </tbody>
12671 </tgroup>
12672 </table>
12674 <para>
12675 Anonymous allocations are allocations that have been made
12676 with <literal>ShmemAlloc()</literal> directly, rather than via
12677 <literal>ShmemInitStruct()</literal> or
12678 <literal>ShmemInitHash()</literal>.
12679 </para>
12681 <para>
12682 By default, the <structname>pg_shmem_allocations</structname> view can be
12683 read only by superusers.
12684 </para>
12685 </sect1>
12687 <sect1 id="view-pg-stats">
12688 <title><structname>pg_stats</structname></title>
12690 <indexterm zone="view-pg-stats">
12691 <primary>pg_stats</primary>
12692 </indexterm>
12694 <para>
12695 The view <structname>pg_stats</structname> provides access to
12696 the information stored in the <link
12697 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
12698 catalog. This view allows access only to rows of
12699 <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> that correspond to tables the
12700 user has permission to read, and therefore it is safe to allow public
12701 read access to this view.
12702 </para>
12704 <para>
12705 <structname>pg_stats</structname> is also designed to present the
12706 information in a more readable format than the underlying catalog
12707 &mdash; at the cost that its schema must be extended whenever new slot types
12708 are defined for <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>.
12709 </para>
12711 <table>
12712 <title><structname>pg_stats</structname> Columns</title>
12713 <tgroup cols="1">
12714 <thead>
12715 <row>
12716 <entry role="catalog_table_entry"><para role="column_definition">
12717 Column Type
12718 </para>
12719 <para>
12720 Description
12721 </para></entry>
12722 </row>
12723 </thead>
12725 <tbody>
12726 <row>
12727 <entry role="catalog_table_entry"><para role="column_definition">
12728 <structfield>schemaname</structfield> <type>name</type>
12729 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12730 </para>
12731 <para>
12732 Name of schema containing table
12733 </para></entry>
12734 </row>
12736 <row>
12737 <entry role="catalog_table_entry"><para role="column_definition">
12738 <structfield>tablename</structfield> <type>name</type>
12739 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
12740 </para>
12741 <para>
12742 Name of table
12743 </para></entry>
12744 </row>
12746 <row>
12747 <entry role="catalog_table_entry"><para role="column_definition">
12748 <structfield>attname</structfield> <type>name</type>
12749 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
12750 </para>
12751 <para>
12752 Name of column described by this row
12753 </para></entry>
12754 </row>
12756 <row>
12757 <entry role="catalog_table_entry"><para role="column_definition">
12758 <structfield>inherited</structfield> <type>bool</type>
12759 </para>
12760 <para>
12761 If true, this row includes inheritance child columns, not just the
12762 values in the specified table
12763 </para></entry>
12764 </row>
12766 <row>
12767 <entry role="catalog_table_entry"><para role="column_definition">
12768 <structfield>null_frac</structfield> <type>float4</type>
12769 </para>
12770 <para>
12771 Fraction of column entries that are null
12772 </para></entry>
12773 </row>
12775 <row>
12776 <entry role="catalog_table_entry"><para role="column_definition">
12777 <structfield>avg_width</structfield> <type>int4</type>
12778 </para>
12779 <para>
12780 Average width in bytes of column's entries
12781 </para></entry>
12782 </row>
12784 <row>
12785 <entry role="catalog_table_entry"><para role="column_definition">
12786 <structfield>n_distinct</structfield> <type>float4</type>
12787 </para>
12788 <para>
12789 If greater than zero, the estimated number of distinct values in the
12790 column. If less than zero, the negative of the number of distinct
12791 values divided by the number of rows. (The negated form is used when
12792 <command>ANALYZE</command> believes that the number of distinct values is
12793 likely to increase as the table grows; the positive form is used when
12794 the column seems to have a fixed number of possible values.) For
12795 example, -1 indicates a unique column in which the number of distinct
12796 values is the same as the number of rows.
12797 </para></entry>
12798 </row>
12800 <row>
12801 <entry role="catalog_table_entry"><para role="column_definition">
12802 <structfield>most_common_vals</structfield> <type>anyarray</type>
12803 </para>
12804 <para>
12805 A list of the most common values in the column. (Null if
12806 no values seem to be more common than any others.)
12807 </para></entry>
12808 </row>
12810 <row>
12811 <entry role="catalog_table_entry"><para role="column_definition">
12812 <structfield>most_common_freqs</structfield> <type>float4[]</type>
12813 </para>
12814 <para>
12815 A list of the frequencies of the most common values,
12816 i.e., number of occurrences of each divided by total number of rows.
12817 (Null when <structfield>most_common_vals</structfield> is.)
12818 </para></entry>
12819 </row>
12821 <row>
12822 <entry role="catalog_table_entry"><para role="column_definition">
12823 <structfield>histogram_bounds</structfield> <type>anyarray</type>
12824 </para>
12825 <para>
12826 A list of values that divide the column's values into groups of
12827 approximately equal population. The values in
12828 <structfield>most_common_vals</structfield>, if present, are omitted from this
12829 histogram calculation. (This column is null if the column data type
12830 does not have a <literal>&lt;</literal> operator or if the
12831 <structfield>most_common_vals</structfield> list accounts for the entire
12832 population.)
12833 </para></entry>
12834 </row>
12836 <row>
12837 <entry role="catalog_table_entry"><para role="column_definition">
12838 <structfield>correlation</structfield> <type>float4</type>
12839 </para>
12840 <para>
12841 Statistical correlation between physical row ordering and
12842 logical ordering of the column values. This ranges from -1 to +1.
12843 When the value is near -1 or +1, an index scan on the column will
12844 be estimated to be cheaper than when it is near zero, due to reduction
12845 of random access to the disk. (This column is null if the column data
12846 type does not have a <literal>&lt;</literal> operator.)
12847 </para></entry>
12848 </row>
12850 <row>
12851 <entry role="catalog_table_entry"><para role="column_definition">
12852 <structfield>most_common_elems</structfield> <type>anyarray</type>
12853 </para>
12854 <para>
12855 A list of non-null element values most often appearing within values of
12856 the column. (Null for scalar types.)
12857 </para></entry>
12858 </row>
12860 <row>
12861 <entry role="catalog_table_entry"><para role="column_definition">
12862 <structfield>most_common_elem_freqs</structfield> <type>float4[]</type>
12863 </para>
12864 <para>
12865 A list of the frequencies of the most common element values, i.e., the
12866 fraction of rows containing at least one instance of the given value.
12867 Two or three additional values follow the per-element frequencies;
12868 these are the minimum and maximum of the preceding per-element
12869 frequencies, and optionally the frequency of null elements.
12870 (Null when <structfield>most_common_elems</structfield> is.)
12871 </para></entry>
12872 </row>
12874 <row>
12875 <entry role="catalog_table_entry"><para role="column_definition">
12876 <structfield>elem_count_histogram</structfield> <type>float4[]</type>
12877 </para>
12878 <para>
12879 A histogram of the counts of distinct non-null element values within the
12880 values of the column, followed by the average number of distinct
12881 non-null elements. (Null for scalar types.)
12882 </para></entry>
12883 </row>
12884 </tbody>
12885 </tgroup>
12886 </table>
12888 <para>
12889 The maximum number of entries in the array fields can be controlled on a
12890 column-by-column basis using the <link linkend="sql-altertable"><command>ALTER
12891 TABLE SET STATISTICS</command></link>
12892 command, or globally by setting the
12893 <xref linkend="guc-default-statistics-target"/> run-time parameter.
12894 </para>
12896 </sect1>
12898 <sect1 id="view-pg-stats-ext">
12899 <title><structname>pg_stats_ext</structname></title>
12901 <indexterm zone="view-pg-stats-ext">
12902 <primary>pg_stats_ext</primary>
12903 </indexterm>
12905 <para>
12906 The view <structname>pg_stats_ext</structname> provides access to
12907 information about each extended statistics object in the database,
12908 combining information stored in the <link
12909 linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>
12910 and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
12911 catalogs. This view allows access only to rows of
12912 <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link> and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
12913 that correspond to tables the user has permission to read, and therefore
12914 it is safe to allow public read access to this view.
12915 </para>
12917 <para>
12918 <structname>pg_stats_ext</structname> is also designed to present the
12919 information in a more readable format than the underlying catalogs
12920 &mdash; at the cost that its schema must be extended whenever new types
12921 of extended statistics are added to <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.
12922 </para>
12924 <table>
12925 <title><structname>pg_stats_ext</structname> Columns</title>
12926 <tgroup cols="1">
12927 <thead>
12928 <row>
12929 <entry role="catalog_table_entry"><para role="column_definition">
12930 Column Type
12931 </para>
12932 <para>
12933 Description
12934 </para></entry>
12935 </row>
12936 </thead>
12938 <tbody>
12939 <row>
12940 <entry role="catalog_table_entry"><para role="column_definition">
12941 <structfield>schemaname</structfield> <type>name</type>
12942 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12943 </para>
12944 <para>
12945 Name of schema containing table
12946 </para></entry>
12947 </row>
12949 <row>
12950 <entry role="catalog_table_entry"><para role="column_definition">
12951 <structfield>tablename</structfield> <type>name</type>
12952 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
12953 </para>
12954 <para>
12955 Name of table
12956 </para></entry>
12957 </row>
12959 <row>
12960 <entry role="catalog_table_entry"><para role="column_definition">
12961 <structfield>statistics_schemaname</structfield> <type>name</type>
12962 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12963 </para>
12964 <para>
12965 Name of schema containing extended statistics object
12966 </para></entry>
12967 </row>
12969 <row>
12970 <entry role="catalog_table_entry"><para role="column_definition">
12971 <structfield>statistics_name</structfield> <type>name</type>
12972 (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>stxname</structfield>)
12973 </para>
12974 <para>
12975 Name of extended statistics object
12976 </para></entry>
12977 </row>
12979 <row>
12980 <entry role="catalog_table_entry"><para role="column_definition">
12981 <structfield>statistics_owner</structfield> <type>name</type>
12982 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
12983 </para>
12984 <para>
12985 Owner of the extended statistics object
12986 </para></entry>
12987 </row>
12989 <row>
12990 <entry role="catalog_table_entry"><para role="column_definition">
12991 <structfield>attnames</structfield> <type>name[]</type>
12992 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
12993 </para>
12994 <para>
12995 Names of the columns included in the extended statistics object
12996 </para></entry>
12997 </row>
12999 <row>
13000 <entry role="catalog_table_entry"><para role="column_definition">
13001 <structfield>exprs</structfield> <type>text[]</type>
13002 </para>
13003 <para>
13004 Expressions included in the extended statistics object
13005 </para></entry>
13006 </row>
13008 <row>
13009 <entry role="catalog_table_entry"><para role="column_definition">
13010 <structfield>kinds</structfield> <type>char[]</type>
13011 </para>
13012 <para>
13013 Types of extended statistics object enabled for this record
13014 </para></entry>
13015 </row>
13017 <row>
13018 <entry role="catalog_table_entry"><para role="column_definition">
13019 <structfield>n_distinct</structfield> <type>pg_ndistinct</type>
13020 </para>
13021 <para>
13022 N-distinct counts for combinations of column values. If greater
13023 than zero, the estimated number of distinct values in the combination.
13024 If less than zero, the negative of the number of distinct values divided
13025 by the number of rows.
13026 (The negated form is used when <command>ANALYZE</command> believes that
13027 the number of distinct values is likely to increase as the table grows;
13028 the positive form is used when the column seems to have a fixed number
13029 of possible values.) For example, -1 indicates a unique combination of
13030 columns in which the number of distinct combinations is the same as the
13031 number of rows.
13032 </para></entry>
13033 </row>
13035 <row>
13036 <entry role="catalog_table_entry"><para role="column_definition">
13037 <structfield>dependencies</structfield> <type>pg_dependencies</type>
13038 </para>
13039 <para>
13040 Functional dependency statistics
13041 </para></entry>
13042 </row>
13044 <row>
13045 <entry role="catalog_table_entry"><para role="column_definition">
13046 <structfield>most_common_vals</structfield> <type>text[]</type>
13047 </para>
13048 <para>
13049 A list of the most common combinations of values in the columns.
13050 (Null if no combinations seem to be more common than any others.)
13051 </para></entry>
13052 </row>
13054 <row>
13055 <entry role="catalog_table_entry"><para role="column_definition">
13056 <structfield>most_common_val_nulls</structfield> <type>bool[]</type>
13057 </para>
13058 <para>
13059 A list of NULL flags for the most common combinations of values.
13060 (Null when <structfield>most_common_vals</structfield> is.)
13061 </para></entry>
13062 </row>
13064 <row>
13065 <entry role="catalog_table_entry"><para role="column_definition">
13066 <structfield>most_common_freqs</structfield> <type>float8[]</type>
13067 </para>
13068 <para>
13069 A list of the frequencies of the most common combinations,
13070 i.e., number of occurrences of each divided by total number of rows.
13071 (Null when <structfield>most_common_vals</structfield> is.)
13072 </para></entry>
13073 </row>
13075 <row>
13076 <entry role="catalog_table_entry"><para role="column_definition">
13077 <structfield>most_common_base_freqs</structfield> <type>float8[]</type>
13078 </para>
13079 <para>
13080 A list of the base frequencies of the most common combinations,
13081 i.e., product of per-value frequencies.
13082 (Null when <structfield>most_common_vals</structfield> is.)
13083 </para></entry>
13084 </row>
13085 </tbody>
13086 </tgroup>
13087 </table>
13089 <para>
13090 The maximum number of entries in the array fields can be controlled on a
13091 column-by-column basis using the <link linkend="sql-altertable"><command>ALTER
13092 TABLE SET STATISTICS</command></link> command, or globally by setting the
13093 <xref linkend="guc-default-statistics-target"/> run-time parameter.
13094 </para>
13096 </sect1>
13098 <sect1 id="view-pg-stats-ext-exprs">
13099 <title><structname>pg_stats_ext_exprs</structname></title>
13101 <indexterm zone="view-pg-stats-ext-exprs">
13102 <primary>pg_stats_ext_exprs</primary>
13103 </indexterm>
13105 <para>
13106 The view <structname>pg_stats_ext_exprs</structname> provides access to
13107 information about all expressions included in extended statistics objects,
13108 combining information stored in the <link
13109 linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>
13110 and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
13111 catalogs. This view allows access only to rows of
13112 <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link> and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
13113 that correspond to tables the user has permission to read, and therefore
13114 it is safe to allow public read access to this view.
13115 </para>
13117 <para>
13118 <structname>pg_stats_ext_exprs</structname> is also designed to present
13119 the information in a more readable format than the underlying catalogs
13120 &mdash; at the cost that its schema must be extended whenever the structure
13121 of statistics in <structname>pg_statistic_ext</structname> changes.
13122 </para>
13124 <table>
13125 <title><structname>pg_stats_ext_exprs</structname> Columns</title>
13126 <tgroup cols="1">
13127 <thead>
13128 <row>
13129 <entry role="catalog_table_entry"><para role="column_definition">
13130 Column Type
13131 </para>
13132 <para>
13133 Description
13134 </para></entry>
13135 </row>
13136 </thead>
13138 <tbody>
13139 <row>
13140 <entry role="catalog_table_entry"><para role="column_definition">
13141 <structfield>schemaname</structfield> <type>name</type>
13142 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
13143 </para>
13144 <para>
13145 Name of schema containing table
13146 </para></entry>
13147 </row>
13149 <row>
13150 <entry role="catalog_table_entry"><para role="column_definition">
13151 <structfield>tablename</structfield> <type>name</type>
13152 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
13153 </para>
13154 <para>
13155 Name of table the statistics object is defined on
13156 </para></entry>
13157 </row>
13159 <row>
13160 <entry role="catalog_table_entry"><para role="column_definition">
13161 <structfield>statistics_schemaname</structfield> <type>name</type>
13162 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
13163 </para>
13164 <para>
13165 Name of schema containing extended statistics object
13166 </para></entry>
13167 </row>
13169 <row>
13170 <entry role="catalog_table_entry"><para role="column_definition">
13171 <structfield>statistics_name</structfield> <type>name</type>
13172 (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>stxname</structfield>)
13173 </para>
13174 <para>
13175 Name of extended statistics object
13176 </para></entry>
13177 </row>
13179 <row>
13180 <entry role="catalog_table_entry"><para role="column_definition">
13181 <structfield>statistics_owner</structfield> <type>name</type>
13182 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
13183 </para>
13184 <para>
13185 Owner of the extended statistics object
13186 </para></entry>
13187 </row>
13189 <row>
13190 <entry role="catalog_table_entry"><para role="column_definition">
13191 <structfield>expr</structfield> <type>text</type>
13192 </para>
13193 <para>
13194 Expression included in the extended statistics object
13195 </para></entry>
13196 </row>
13198 <row>
13199 <entry role="catalog_table_entry"><para role="column_definition">
13200 <structfield>null_frac</structfield> <type>float4</type>
13201 </para>
13202 <para>
13203 Fraction of expression entries that are null
13204 </para></entry>
13205 </row>
13207 <row>
13208 <entry role="catalog_table_entry"><para role="column_definition">
13209 <structfield>avg_width</structfield> <type>int4</type>
13210 </para>
13211 <para>
13212 Average width in bytes of expression's entries
13213 </para></entry>
13214 </row>
13216 <row>
13217 <entry role="catalog_table_entry"><para role="column_definition">
13218 <structfield>n_distinct</structfield> <type>float4</type>
13219 </para>
13220 <para>
13221 If greater than zero, the estimated number of distinct values in the
13222 expression. If less than zero, the negative of the number of distinct
13223 values divided by the number of rows. (The negated form is used when
13224 <command>ANALYZE</command> believes that the number of distinct values is
13225 likely to increase as the table grows; the positive form is used when
13226 the expression seems to have a fixed number of possible values.) For
13227 example, -1 indicates a unique expression in which the number of distinct
13228 values is the same as the number of rows.
13229 </para></entry>
13230 </row>
13232 <row>
13233 <entry role="catalog_table_entry"><para role="column_definition">
13234 <structfield>most_common_vals</structfield> <type>anyarray</type>
13235 </para>
13236 <para>
13237 A list of the most common values in the expression. (Null if
13238 no values seem to be more common than any others.)
13239 </para></entry>
13240 </row>
13242 <row>
13243 <entry role="catalog_table_entry"><para role="column_definition">
13244 <structfield>most_common_freqs</structfield> <type>float4[]</type>
13245 </para>
13246 <para>
13247 A list of the frequencies of the most common values,
13248 i.e., number of occurrences of each divided by total number of rows.
13249 (Null when <structfield>most_common_vals</structfield> is.)
13250 </para></entry>
13251 </row>
13253 <row>
13254 <entry role="catalog_table_entry"><para role="column_definition">
13255 <structfield>histogram_bounds</structfield> <type>anyarray</type>
13256 </para>
13257 <para>
13258 A list of values that divide the expression's values into groups of
13259 approximately equal population. The values in
13260 <structfield>most_common_vals</structfield>, if present, are omitted from this
13261 histogram calculation. (This expression is null if the expression data type
13262 does not have a <literal>&lt;</literal> operator or if the
13263 <structfield>most_common_vals</structfield> list accounts for the entire
13264 population.)
13265 </para></entry>
13266 </row>
13268 <row>
13269 <entry role="catalog_table_entry"><para role="column_definition">
13270 <structfield>correlation</structfield> <type>float4</type>
13271 </para>
13272 <para>
13273 Statistical correlation between physical row ordering and
13274 logical ordering of the expression values. This ranges from -1 to +1.
13275 When the value is near -1 or +1, an index scan on the expression will
13276 be estimated to be cheaper than when it is near zero, due to reduction
13277 of random access to the disk. (This expression is null if the expression's
13278 data type does not have a <literal>&lt;</literal> operator.)
13279 </para></entry>
13280 </row>
13282 <row>
13283 <entry role="catalog_table_entry"><para role="column_definition">
13284 <structfield>most_common_elems</structfield> <type>anyarray</type>
13285 </para>
13286 <para>
13287 A list of non-null element values most often appearing within values of
13288 the expression. (Null for scalar types.)
13289 </para></entry>
13290 </row>
13292 <row>
13293 <entry role="catalog_table_entry"><para role="column_definition">
13294 <structfield>most_common_elem_freqs</structfield> <type>float4[]</type>
13295 </para>
13296 <para>
13297 A list of the frequencies of the most common element values, i.e., the
13298 fraction of rows containing at least one instance of the given value.
13299 Two or three additional values follow the per-element frequencies;
13300 these are the minimum and maximum of the preceding per-element
13301 frequencies, and optionally the frequency of null elements.
13302 (Null when <structfield>most_common_elems</structfield> is.)
13303 </para></entry>
13304 </row>
13306 <row>
13307 <entry role="catalog_table_entry"><para role="column_definition">
13308 <structfield>elem_count_histogram</structfield> <type>float4[]</type>
13309 </para>
13310 <para>
13311 A histogram of the counts of distinct non-null element values within the
13312 values of the expression, followed by the average number of distinct
13313 non-null elements. (Null for scalar types.)
13314 </para></entry>
13315 </row>
13316 </tbody>
13317 </tgroup>
13318 </table>
13320 <para>
13321 The maximum number of entries in the array fields can be controlled on a
13322 column-by-column basis using the <link linkend="sql-altertable"><command>ALTER
13323 TABLE SET STATISTICS</command></link> command, or globally by setting the
13324 <xref linkend="guc-default-statistics-target"/> run-time parameter.
13325 </para>
13327 </sect1>
13329 <sect1 id="view-pg-tables">
13330 <title><structname>pg_tables</structname></title>
13332 <indexterm zone="view-pg-tables">
13333 <primary>pg_tables</primary>
13334 </indexterm>
13336 <para>
13337 The view <structname>pg_tables</structname> provides access to
13338 useful information about each table in the database.
13339 </para>
13341 <table>
13342 <title><structname>pg_tables</structname> Columns</title>
13343 <tgroup cols="1">
13344 <thead>
13345 <row>
13346 <entry role="catalog_table_entry"><para role="column_definition">
13347 Column Type
13348 </para>
13349 <para>
13350 Description
13351 </para></entry>
13352 </row>
13353 </thead>
13355 <tbody>
13356 <row>
13357 <entry role="catalog_table_entry"><para role="column_definition">
13358 <structfield>schemaname</structfield> <type>name</type>
13359 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
13360 </para>
13361 <para>
13362 Name of schema containing table
13363 </para></entry>
13364 </row>
13366 <row>
13367 <entry role="catalog_table_entry"><para role="column_definition">
13368 <structfield>tablename</structfield> <type>name</type>
13369 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
13370 </para>
13371 <para>
13372 Name of table
13373 </para></entry>
13374 </row>
13376 <row>
13377 <entry role="catalog_table_entry"><para role="column_definition">
13378 <structfield>tableowner</structfield> <type>name</type>
13379 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
13380 </para>
13381 <para>
13382 Name of table's owner
13383 </para></entry>
13384 </row>
13386 <row>
13387 <entry role="catalog_table_entry"><para role="column_definition">
13388 <structfield>tablespace</structfield> <type>name</type>
13389 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
13390 </para>
13391 <para>
13392 Name of tablespace containing table (null if default for database)
13393 </para></entry>
13394 </row>
13396 <row>
13397 <entry role="catalog_table_entry"><para role="column_definition">
13398 <structfield>hasindexes</structfield> <type>bool</type>
13399 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhasindex</structfield>)
13400 </para>
13401 <para>
13402 True if table has (or recently had) any indexes
13403 </para></entry>
13404 </row>
13406 <row>
13407 <entry role="catalog_table_entry"><para role="column_definition">
13408 <structfield>hasrules</structfield> <type>bool</type>
13409 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhasrules</structfield>)
13410 </para>
13411 <para>
13412 True if table has (or once had) rules
13413 </para></entry>
13414 </row>
13416 <row>
13417 <entry role="catalog_table_entry"><para role="column_definition">
13418 <structfield>hastriggers</structfield> <type>bool</type>
13419 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhastriggers</structfield>)
13420 </para>
13421 <para>
13422 True if table has (or once had) triggers
13423 </para></entry>
13424 </row>
13426 <row>
13427 <entry role="catalog_table_entry"><para role="column_definition">
13428 <structfield>rowsecurity</structfield> <type>bool</type>
13429 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relrowsecurity</structfield>)
13430 </para>
13431 <para>
13432 True if row security is enabled on the table
13433 </para></entry>
13434 </row>
13435 </tbody>
13436 </tgroup>
13437 </table>
13439 </sect1>
13441 <sect1 id="view-pg-timezone-abbrevs">
13442 <title><structname>pg_timezone_abbrevs</structname></title>
13444 <indexterm zone="view-pg-timezone-abbrevs">
13445 <primary>pg_timezone_abbrevs</primary>
13446 </indexterm>
13448 <para>
13449 The view <structname>pg_timezone_abbrevs</structname> provides a list
13450 of time zone abbreviations that are currently recognized by the datetime
13451 input routines. The contents of this view change when the
13452 <xref linkend="guc-timezone-abbreviations"/> run-time parameter is modified.
13453 </para>
13455 <table>
13456 <title><structname>pg_timezone_abbrevs</structname> Columns</title>
13457 <tgroup cols="1">
13458 <thead>
13459 <row>
13460 <entry role="catalog_table_entry"><para role="column_definition">
13461 Column Type
13462 </para>
13463 <para>
13464 Description
13465 </para></entry>
13466 </row>
13467 </thead>
13469 <tbody>
13470 <row>
13471 <entry role="catalog_table_entry"><para role="column_definition">
13472 <structfield>abbrev</structfield> <type>text</type>
13473 </para>
13474 <para>
13475 Time zone abbreviation
13476 </para></entry>
13477 </row>
13479 <row>
13480 <entry role="catalog_table_entry"><para role="column_definition">
13481 <structfield>utc_offset</structfield> <type>interval</type>
13482 </para>
13483 <para>
13484 Offset from UTC (positive means east of Greenwich)
13485 </para></entry>
13486 </row>
13488 <row>
13489 <entry role="catalog_table_entry"><para role="column_definition">
13490 <structfield>is_dst</structfield> <type>bool</type>
13491 </para>
13492 <para>
13493 True if this is a daylight-savings abbreviation
13494 </para></entry>
13495 </row>
13496 </tbody>
13497 </tgroup>
13498 </table>
13500 <para>
13501 While most timezone abbreviations represent fixed offsets from UTC,
13502 there are some that have historically varied in value
13503 (see <xref linkend="datetime-config-files"/> for more information).
13504 In such cases this view presents their current meaning.
13505 </para>
13507 </sect1>
13509 <sect1 id="view-pg-timezone-names">
13510 <title><structname>pg_timezone_names</structname></title>
13512 <indexterm zone="view-pg-timezone-names">
13513 <primary>pg_timezone_names</primary>
13514 </indexterm>
13516 <para>
13517 The view <structname>pg_timezone_names</structname> provides a list
13518 of time zone names that are recognized by <command>SET TIMEZONE</command>,
13519 along with their associated abbreviations, UTC offsets,
13520 and daylight-savings status. (Technically,
13521 <productname>PostgreSQL</productname> does not use UTC because leap
13522 seconds are not handled.)
13523 Unlike the abbreviations shown in <link
13524 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
13525 date rules. Therefore, the associated information changes across local DST
13526 boundaries. The displayed information is computed based on the current
13527 value of <function>CURRENT_TIMESTAMP</function>.
13528 </para>
13530 <table>
13531 <title><structname>pg_timezone_names</structname> Columns</title>
13532 <tgroup cols="1">
13533 <thead>
13534 <row>
13535 <entry role="catalog_table_entry"><para role="column_definition">
13536 Column Type
13537 </para>
13538 <para>
13539 Description
13540 </para></entry>
13541 </row>
13542 </thead>
13544 <tbody>
13545 <row>
13546 <entry role="catalog_table_entry"><para role="column_definition">
13547 <structfield>name</structfield> <type>text</type>
13548 </para>
13549 <para>
13550 Time zone name
13551 </para></entry>
13552 </row>
13554 <row>
13555 <entry role="catalog_table_entry"><para role="column_definition">
13556 <structfield>abbrev</structfield> <type>text</type>
13557 </para>
13558 <para>
13559 Time zone abbreviation
13560 </para></entry>
13561 </row>
13563 <row>
13564 <entry role="catalog_table_entry"><para role="column_definition">
13565 <structfield>utc_offset</structfield> <type>interval</type>
13566 </para>
13567 <para>
13568 Offset from UTC (positive means east of Greenwich)
13569 </para></entry>
13570 </row>
13572 <row>
13573 <entry role="catalog_table_entry"><para role="column_definition">
13574 <structfield>is_dst</structfield> <type>bool</type>
13575 </para>
13576 <para>
13577 True if currently observing daylight savings
13578 </para></entry>
13579 </row>
13580 </tbody>
13581 </tgroup>
13582 </table>
13584 </sect1>
13586 <sect1 id="view-pg-user">
13587 <title><structname>pg_user</structname></title>
13589 <indexterm zone="view-pg-user">
13590 <primary>pg_user</primary>
13591 </indexterm>
13593 <para>
13594 The view <structname>pg_user</structname> provides access to
13595 information about database users. This is simply a publicly
13596 readable view of
13597 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
13598 that blanks out the password field.
13599 </para>
13601 <table>
13602 <title><structname>pg_user</structname> Columns</title>
13603 <tgroup cols="1">
13604 <thead>
13605 <row>
13606 <entry role="catalog_table_entry"><para role="column_definition">
13607 Column Type
13608 </para>
13609 <para>
13610 Description
13611 </para></entry>
13612 </row>
13613 </thead>
13615 <tbody>
13616 <row>
13617 <entry role="catalog_table_entry"><para role="column_definition">
13618 <structfield>usename</structfield> <type>name</type>
13619 </para>
13620 <para>
13621 User name
13622 </para></entry>
13623 </row>
13625 <row>
13626 <entry role="catalog_table_entry"><para role="column_definition">
13627 <structfield>usesysid</structfield> <type>oid</type>
13628 </para>
13629 <para>
13630 ID of this user
13631 </para></entry>
13632 </row>
13634 <row>
13635 <entry role="catalog_table_entry"><para role="column_definition">
13636 <structfield>usecreatedb</structfield> <type>bool</type>
13637 </para>
13638 <para>
13639 User can create databases
13640 </para></entry>
13641 </row>
13643 <row>
13644 <entry role="catalog_table_entry"><para role="column_definition">
13645 <structfield>usesuper</structfield> <type>bool</type>
13646 </para>
13647 <para>
13648 User is a superuser
13649 </para></entry>
13650 </row>
13652 <row>
13653 <entry role="catalog_table_entry"><para role="column_definition">
13654 <structfield>userepl</structfield> <type>bool</type>
13655 </para>
13656 <para>
13657 User can initiate streaming replication and put the system in and
13658 out of backup mode.
13659 </para></entry>
13660 </row>
13662 <row>
13663 <entry role="catalog_table_entry"><para role="column_definition">
13664 <structfield>usebypassrls</structfield> <type>bool</type>
13665 </para>
13666 <para>
13667 User bypasses every row-level security policy, see
13668 <xref linkend="ddl-rowsecurity"/> for more information.
13669 </para></entry>
13670 </row>
13672 <row>
13673 <entry role="catalog_table_entry"><para role="column_definition">
13674 <structfield>passwd</structfield> <type>text</type>
13675 </para>
13676 <para>
13677 Not the password (always reads as <literal>********</literal>)
13678 </para></entry>
13679 </row>
13681 <row>
13682 <entry role="catalog_table_entry"><para role="column_definition">
13683 <structfield>valuntil</structfield> <type>timestamptz</type>
13684 </para>
13685 <para>
13686 Password expiry time (only used for password authentication)
13687 </para></entry>
13688 </row>
13690 <row>
13691 <entry role="catalog_table_entry"><para role="column_definition">
13692 <structfield>useconfig</structfield> <type>text[]</type>
13693 </para>
13694 <para>
13695 Session defaults for run-time configuration variables
13696 </para></entry>
13697 </row>
13698 </tbody>
13699 </tgroup>
13700 </table>
13702 </sect1>
13704 <sect1 id="view-pg-user-mappings">
13705 <title><structname>pg_user_mappings</structname></title>
13707 <indexterm zone="view-pg-user-mappings">
13708 <primary>pg_user_mappings</primary>
13709 </indexterm>
13711 <para>
13712 The view <structname>pg_user_mappings</structname> provides access
13713 to information about user mappings. This is essentially a publicly
13714 readable view of
13715 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
13716 that leaves out the options field if the user has no rights to use
13718 </para>
13720 <table>
13721 <title><structname>pg_user_mappings</structname> Columns</title>
13722 <tgroup cols="1">
13723 <thead>
13724 <row>
13725 <entry role="catalog_table_entry"><para role="column_definition">
13726 Column Type
13727 </para>
13728 <para>
13729 Description
13730 </para></entry>
13731 </row>
13732 </thead>
13734 <tbody>
13735 <row>
13736 <entry role="catalog_table_entry"><para role="column_definition">
13737 <structfield>umid</structfield> <type>oid</type>
13738 (references <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.<structfield>oid</structfield>)
13739 </para>
13740 <para>
13741 OID of the user mapping
13742 </para></entry>
13743 </row>
13745 <row>
13746 <entry role="catalog_table_entry"><para role="column_definition">
13747 <structfield>srvid</structfield> <type>oid</type>
13748 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
13749 </para>
13750 <para>
13751 The OID of the foreign server that contains this mapping
13752 </para></entry>
13753 </row>
13755 <row>
13756 <entry role="catalog_table_entry"><para role="column_definition">
13757 <structfield>srvname</structfield> <type>name</type>
13758 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>srvname</structfield>)
13759 </para>
13760 <para>
13761 Name of the foreign server
13762 </para></entry>
13763 </row>
13765 <row>
13766 <entry role="catalog_table_entry"><para role="column_definition">
13767 <structfield>umuser</structfield> <type>oid</type>
13768 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
13769 </para>
13770 <para>
13771 OID of the local role being mapped, or zero if the user mapping is public
13772 </para></entry>
13773 </row>
13775 <row>
13776 <entry role="catalog_table_entry"><para role="column_definition">
13777 <structfield>usename</structfield> <type>name</type>
13778 </para>
13779 <para>
13780 Name of the local user to be mapped
13781 </para></entry>
13782 </row>
13784 <row>
13785 <entry role="catalog_table_entry"><para role="column_definition">
13786 <structfield>umoptions</structfield> <type>text[]</type>
13787 </para>
13788 <para>
13789 User mapping specific options, as <quote>keyword=value</quote> strings
13790 </para></entry>
13791 </row>
13792 </tbody>
13793 </tgroup>
13794 </table>
13796 <para>
13797 To protect password information stored as a user mapping option,
13798 the <structfield>umoptions</structfield> column will read as null
13799 unless one of the following applies:
13800 <itemizedlist>
13801 <listitem>
13802 <para>
13803 current user is the user being mapped, and owns the server or
13804 holds <literal>USAGE</literal> privilege on it
13805 </para>
13806 </listitem>
13807 <listitem>
13808 <para>
13809 current user is the server owner and mapping is for <literal>PUBLIC</literal>
13810 </para>
13811 </listitem>
13812 <listitem>
13813 <para>
13814 current user is a superuser
13815 </para>
13816 </listitem>
13817 </itemizedlist>
13818 </para>
13820 </sect1>
13823 <sect1 id="view-pg-views">
13824 <title><structname>pg_views</structname></title>
13826 <indexterm zone="view-pg-views">
13827 <primary>pg_views</primary>
13828 </indexterm>
13830 <para>
13831 The view <structname>pg_views</structname> provides access to
13832 useful information about each view in the database.
13833 </para>
13835 <table>
13836 <title><structname>pg_views</structname> Columns</title>
13837 <tgroup cols="1">
13838 <thead>
13839 <row>
13840 <entry role="catalog_table_entry"><para role="column_definition">
13841 Column Type
13842 </para>
13843 <para>
13844 Description
13845 </para></entry>
13846 </row>
13847 </thead>
13849 <tbody>
13850 <row>
13851 <entry role="catalog_table_entry"><para role="column_definition">
13852 <structfield>schemaname</structfield> <type>name</type>
13853 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
13854 </para>
13855 <para>
13856 Name of schema containing view
13857 </para></entry>
13858 </row>
13860 <row>
13861 <entry role="catalog_table_entry"><para role="column_definition">
13862 <structfield>viewname</structfield> <type>name</type>
13863 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
13864 </para>
13865 <para>
13866 Name of view
13867 </para></entry>
13868 </row>
13870 <row>
13871 <entry role="catalog_table_entry"><para role="column_definition">
13872 <structfield>viewowner</structfield> <type>name</type>
13873 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
13874 </para>
13875 <para>
13876 Name of view's owner
13877 </para></entry>
13878 </row>
13880 <row>
13881 <entry role="catalog_table_entry"><para role="column_definition">
13882 <structfield>definition</structfield> <type>text</type>
13883 </para>
13884 <para>
13885 View definition (a reconstructed <xref linkend="sql-select"/> query)
13886 </para></entry>
13887 </row>
13888 </tbody>
13889 </tgroup>
13890 </table>
13892 </sect1>
13894 </chapter>