Debian Codegraph @

doc/src/sgml/catalogs.sgml

raw
1 <!-- doc/src/sgml/catalogs.sgml -->
2 <!--
3 Documentation of the system catalogs, directed toward PostgreSQL developers
4 -->
5
6 <chapter id="catalogs">
7 <title>System Catalogs</title>
8
9 <para>
10 The system catalogs are the place where a relational database
11 management system stores schema metadata, such as information about
12 tables and columns, and internal bookkeeping information.
13 <productname>PostgreSQL</productname>'s system catalogs are regular
14 tables. You can drop and recreate the tables, add columns, insert
15 and update values, and severely mess up your system that way.
16 Normally, one should not change the system catalogs by hand, there
17 are 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>
25
26 <sect1 id="catalogs-overview">
27 <title>Overview</title>
28
29 <para>
30 <xref linkend="catalog-table"/> lists the system catalogs.
31 More detailed documentation of each catalog follows below.
32 </para>
33
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>
40
41 <table id="catalog-table">
42 <title>System Catalogs</title>
43
44 <tgroup cols="2">
45 <thead>
46 <row>
47 <entry>Catalog Name</entry>
48 <entry>Purpose</entry>
49 </row>
50 </thead>
51
52 <tbody>
53 <row>
54 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
55 <entry>aggregate functions</entry>
56 </row>
57
58 <row>
59 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
60 <entry>relation access methods</entry>
61 </row>
62
63 <row>
64 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
65 <entry>access method operators</entry>
66 </row>
67
68 <row>
69 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
70 <entry>access method support functions</entry>
71 </row>
72
73 <row>
74 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75 <entry>column default values</entry>
76 </row>
77
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>
82
83 <row>
84 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85 <entry>authorization identifiers (roles)</entry>
86 </row>
87
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>
92
93 <row>
94 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95 <entry>casts (data type conversions)</entry>
96 </row>
97
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>
102
103 <row>
104 <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105 <entry>collations (locale information)</entry>
106 </row>
107
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>
112
113 <row>
114 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115 <entry>encoding conversion information</entry>
116 </row>
117
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>
122
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>
127
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>
132
133 <row>
134 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135 <entry>dependencies between database objects</entry>
136 </row>
137
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>
142
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>
147
148 <row>
149 <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150 <entry>event triggers</entry>
151 </row>
152
153 <row>
154 <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155 <entry>installed extensions</entry>
156 </row>
157
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>
162
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>
167
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>
172
173 <row>
174 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175 <entry>additional index information</entry>
176 </row>
177
178 <row>
179 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180 <entry>table inheritance hierarchy</entry>
181 </row>
182
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>
187
188 <row>
189 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190 <entry>languages for writing functions</entry>
191 </row>
192
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>
197
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>
202
203 <row>
204 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205 <entry>schemas</entry>
206 </row>
207
208 <row>
209 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210 <entry>access method operator classes</entry>
211 </row>
212
213 <row>
214 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215 <entry>operators</entry>
216 </row>
217
218 <row>
219 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220 <entry>access method operator families</entry>
221 </row>
222
223 <row>
224 <entry><link linkend="catalog-pg-parameter-acl"><structname>pg_parameter_acl</structname></link></entry>
225 <entry>configuration parameters for which privileges have been granted</entry>
226 </row>
227
228 <row>
229 <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
230 <entry>information about partition key of tables</entry>
231 </row>
232
233 <row>
234 <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
235 <entry>row-security policies</entry>
236 </row>
237
238 <row>
239 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
240 <entry>functions and procedures</entry>
241 </row>
242
243 <row>
244 <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
245 <entry>publications for logical replication</entry>
246 </row>
247
248 <row>
249 <entry><link linkend="catalog-pg-publication-namespace"><structname>pg_publication_namespace</structname></link></entry>
250 <entry>schema to publication mapping</entry>
251 </row>
252
253 <row>
254 <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
255 <entry>relation to publication mapping</entry>
256 </row>
257
258 <row>
259 <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
260 <entry>information about range types</entry>
261 </row>
262
263 <row>
264 <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
265 <entry>registered replication origins</entry>
266 </row>
267
268 <row>
269 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
270 <entry>query rewrite rules</entry>
271 </row>
272
273 <row>
274 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
275 <entry>security labels on database objects</entry>
276 </row>
277
278 <row>
279 <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
280 <entry>information about sequences</entry>
281 </row>
282
283 <row>
284 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
285 <entry>dependencies on shared objects</entry>
286 </row>
287
288 <row>
289 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
290 <entry>comments on shared objects</entry>
291 </row>
292
293 <row>
294 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
295 <entry>security labels on shared database objects</entry>
296 </row>
297
298 <row>
299 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
300 <entry>planner statistics</entry>
301 </row>
302
303 <row>
304 <entry><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link></entry>
305 <entry>extended planner statistics (definition)</entry>
306 </row>
307
308 <row>
309 <entry><link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link></entry>
310 <entry>extended planner statistics (built statistics)</entry>
311 </row>
312
313 <row>
314 <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
315 <entry>logical replication subscriptions</entry>
316 </row>
317
318 <row>
319 <entry><link linkend="catalog-pg-subscription-rel"><structname>pg_subscription_rel</structname></link></entry>
320 <entry>relation state for subscriptions</entry>
321 </row>
322
323 <row>
324 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
325 <entry>tablespaces within this database cluster</entry>
326 </row>
327
328 <row>
329 <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
330 <entry>transforms (data type to procedural language conversions)</entry>
331 </row>
332
333 <row>
334 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
335 <entry>triggers</entry>
336 </row>
337
338 <row>
339 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
340 <entry>text search configurations</entry>
341 </row>
342
343 <row>
344 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
345 <entry>text search configurations' token mappings</entry>
346 </row>
347
348 <row>
349 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
350 <entry>text search dictionaries</entry>
351 </row>
352
353 <row>
354 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
355 <entry>text search parsers</entry>
356 </row>
357
358 <row>
359 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
360 <entry>text search templates</entry>
361 </row>
362
363 <row>
364 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
365 <entry>data types</entry>
366 </row>
367
368 <row>
369 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
370 <entry>mappings of users to foreign servers</entry>
371 </row>
372 </tbody>
373 </tgroup>
374 </table>
375 </sect1>
376
377
378 <sect1 id="catalog-pg-aggregate">
379 <title><structname>pg_aggregate</structname></title>
380
381 <indexterm zone="catalog-pg-aggregate">
382 <primary>pg_aggregate</primary>
383 </indexterm>
384
385 <para>
386 The catalog <structname>pg_aggregate</structname> stores information about
387 aggregate functions. An aggregate function is a function that
388 operates on a set of values (typically one column from each row
389 that matches a query condition) and returns a single value computed
390 from all these values. Typical aggregate functions are
391 <function>sum</function>, <function>count</function>, and
392 <function>max</function>. Each entry in
393 <structname>pg_aggregate</structname> is an extension of an entry
394 in <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.
395 The <structname>pg_proc</structname> entry carries the aggregate's name,
396 input and output data types, and other information that is similar to
397 ordinary functions.
398 </para>
399
400 <table>
401 <title><structname>pg_aggregate</structname> Columns</title>
402 <tgroup cols="1">
403 <thead>
404 <row>
405 <entry role="catalog_table_entry"><para role="column_definition">
406 Column Type
407 </para>
408 <para>
409 Description
410 </para></entry>
411 </row>
412 </thead>
413
414 <tbody>
415 <row>
416 <entry role="catalog_table_entry"><para role="column_definition">
417 <structfield>aggfnoid</structfield> <type>regproc</type>
418 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
419 </para>
420 <para>
421 <structname>pg_proc</structname> OID of the aggregate function
422 </para></entry>
423 </row>
424
425 <row>
426 <entry role="catalog_table_entry"><para role="column_definition">
427 <structfield>aggkind</structfield> <type>char</type>
428 </para>
429 <para>
430 Aggregate kind:
431 <literal>n</literal> for <quote>normal</quote> aggregates,
432 <literal>o</literal> for <quote>ordered-set</quote> aggregates, or
433 <literal>h</literal> for <quote>hypothetical-set</quote> aggregates
434 </para></entry>
435 </row>
436
437 <row>
438 <entry role="catalog_table_entry"><para role="column_definition">
439 <structfield>aggnumdirectargs</structfield> <type>int2</type>
440 </para>
441 <para>
442 Number of direct (non-aggregated) arguments of an ordered-set or
443 hypothetical-set aggregate, counting a variadic array as one argument.
444 If equal to <structfield>pronargs</structfield>, the aggregate must be variadic
445 and the variadic array describes the aggregated arguments as well as
446 the final direct arguments.
447 Always zero for normal aggregates.
448 </para></entry>
449 </row>
450
451 <row>
452 <entry role="catalog_table_entry"><para role="column_definition">
453 <structfield>aggtransfn</structfield> <type>regproc</type>
454 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
455 </para>
456 <para>
457 Transition function
458 </para></entry>
459 </row>
460
461 <row>
462 <entry role="catalog_table_entry"><para role="column_definition">
463 <structfield>aggfinalfn</structfield> <type>regproc</type>
464 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
465 </para>
466 <para>
467 Final function (zero if none)
468 </para></entry>
469 </row>
470
471 <row>
472 <entry role="catalog_table_entry"><para role="column_definition">
473 <structfield>aggcombinefn</structfield> <type>regproc</type>
474 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
475 </para>
476 <para>
477 Combine function (zero if none)
478 </para></entry>
479 </row>
480
481 <row>
482 <entry role="catalog_table_entry"><para role="column_definition">
483 <structfield>aggserialfn</structfield> <type>regproc</type>
484 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
485 </para>
486 <para>
487 Serialization function (zero if none)
488 </para></entry>
489 </row>
490
491 <row>
492 <entry role="catalog_table_entry"><para role="column_definition">
493 <structfield>aggdeserialfn</structfield> <type>regproc</type>
494 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
495 </para>
496 <para>
497 Deserialization function (zero if none)
498 </para></entry>
499 </row>
500
501 <row>
502 <entry role="catalog_table_entry"><para role="column_definition">
503 <structfield>aggmtransfn</structfield> <type>regproc</type>
504 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
505 </para>
506 <para>
507 Forward transition function for moving-aggregate mode (zero if none)
508 </para></entry>
509 </row>
510
511 <row>
512 <entry role="catalog_table_entry"><para role="column_definition">
513 <structfield>aggminvtransfn</structfield> <type>regproc</type>
514 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
515 </para>
516 <para>
517 Inverse transition function for moving-aggregate mode (zero if none)
518 </para></entry>
519 </row>
520
521 <row>
522 <entry role="catalog_table_entry"><para role="column_definition">
523 <structfield>aggmfinalfn</structfield> <type>regproc</type>
524 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
525 </para>
526 <para>
527 Final function for moving-aggregate mode (zero if none)
528 </para></entry>
529 </row>
530
531 <row>
532 <entry role="catalog_table_entry"><para role="column_definition">
533 <structfield>aggfinalextra</structfield> <type>bool</type>
534 </para>
535 <para>
536 True to pass extra dummy arguments to <structfield>aggfinalfn</structfield>
537 </para></entry>
538 </row>
539
540 <row>
541 <entry role="catalog_table_entry"><para role="column_definition">
542 <structfield>aggmfinalextra</structfield> <type>bool</type>
543 </para>
544 <para>
545 True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield>
546 </para></entry>
547 </row>
548
549 <row>
550 <entry role="catalog_table_entry"><para role="column_definition">
551 <structfield>aggfinalmodify</structfield> <type>char</type>
552 </para>
553 <para>
554 Whether <structfield>aggfinalfn</structfield> modifies the
555 transition state value:
556 <literal>r</literal> if it is read-only,
557 <literal>s</literal> if the <structfield>aggtransfn</structfield>
558 cannot be applied after the <structfield>aggfinalfn</structfield>, or
559 <literal>w</literal> if it writes on the value
560 </para></entry>
561 </row>
562
563 <row>
564 <entry role="catalog_table_entry"><para role="column_definition">
565 <structfield>aggmfinalmodify</structfield> <type>char</type>
566 </para>
567 <para>
568 Like <structfield>aggfinalmodify</structfield>, but for
569 the <structfield>aggmfinalfn</structfield>
570 </para></entry>
571 </row>
572
573 <row>
574 <entry role="catalog_table_entry"><para role="column_definition">
575 <structfield>aggsortop</structfield> <type>oid</type>
576 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
577 </para>
578 <para>
579 Associated sort operator (zero if none)
580 </para></entry>
581 </row>
582
583 <row>
584 <entry role="catalog_table_entry"><para role="column_definition">
585 <structfield>aggtranstype</structfield> <type>oid</type>
586 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
587 </para>
588 <para>
589 Data type of the aggregate function's internal transition (state) data
590 </para></entry>
591 </row>
592
593 <row>
594 <entry role="catalog_table_entry"><para role="column_definition">
595 <structfield>aggtransspace</structfield> <type>int4</type>
596 </para>
597 <para>
598 Approximate average size (in bytes) of the transition state
599 data, or zero to use a default estimate
600 </para></entry>
601 </row>
602
603 <row>
604 <entry role="catalog_table_entry"><para role="column_definition">
605 <structfield>aggmtranstype</structfield> <type>oid</type>
606 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
607 </para>
608 <para>
609 Data type of the aggregate function's internal transition (state)
610 data for moving-aggregate mode (zero if none)
611 </para></entry>
612 </row>
613
614 <row>
615 <entry role="catalog_table_entry"><para role="column_definition">
616 <structfield>aggmtransspace</structfield> <type>int4</type>
617 </para>
618 <para>
619 Approximate average size (in bytes) of the transition state data
620 for moving-aggregate mode, or zero to use a default estimate
621 </para></entry>
622 </row>
623
624 <row>
625 <entry role="catalog_table_entry"><para role="column_definition">
626 <structfield>agginitval</structfield> <type>text</type>
627 </para>
628 <para>
629 The initial value of the transition state. This is a text
630 field containing the initial value in its external string
631 representation. If this field is null, the transition state
632 value starts out null.
633 </para></entry>
634 </row>
635
636 <row>
637 <entry role="catalog_table_entry"><para role="column_definition">
638 <structfield>aggminitval</structfield> <type>text</type>
639 </para>
640 <para>
641 The initial value of the transition state for moving-aggregate mode.
642 This is a text field containing the initial value in its external
643 string representation. If this field is null, the transition state
644 value starts out null.
645 </para></entry>
646 </row>
647 </tbody>
648 </tgroup>
649 </table>
650
651 <para>
652 New aggregate functions are registered with the <link
653 linkend="sql-createaggregate"><command>CREATE AGGREGATE</command></link>
654 command. See <xref linkend="xaggr"/> for more information about
655 writing aggregate functions and the meaning of the transition
656 functions, etc.
657 </para>
658
659 </sect1>
660
661
662 <sect1 id="catalog-pg-am">
663 <title><structname>pg_am</structname></title>
664
665 <indexterm zone="catalog-pg-am">
666 <primary>pg_am</primary>
667 </indexterm>
668
669 <para>
670 The catalog <structname>pg_am</structname> stores information about
671 relation access methods. There is one row for each access method supported
672 by the system.
673 Currently, only tables and indexes have access methods. The requirements for table
674 and index access methods are discussed in detail in <xref linkend="tableam"/> and
675 <xref linkend="indexam"/> respectively.
676 </para>
677
678 <table>
679 <title><structname>pg_am</structname> Columns</title>
680 <tgroup cols="1">
681 <thead>
682 <row>
683 <entry role="catalog_table_entry"><para role="column_definition">
684 Column Type
685 </para>
686 <para>
687 Description
688 </para></entry>
689 </row>
690 </thead>
691
692 <tbody>
693 <row>
694 <entry role="catalog_table_entry"><para role="column_definition">
695 <structfield>oid</structfield> <type>oid</type>
696 </para>
697 <para>
698 Row identifier
699 </para></entry>
700 </row>
701
702 <row>
703 <entry role="catalog_table_entry"><para role="column_definition">
704 <structfield>amname</structfield> <type>name</type>
705 </para>
706 <para>
707 Name of the access method
708 </para></entry>
709 </row>
710
711 <row>
712 <entry role="catalog_table_entry"><para role="column_definition">
713 <structfield>amhandler</structfield> <type>regproc</type>
714 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
715 </para>
716 <para>
717 OID of a handler function that is responsible for supplying information
718 about the access method
719 </para></entry>
720 </row>
721
722 <row>
723 <entry role="catalog_table_entry"><para role="column_definition">
724 <structfield>amtype</structfield> <type>char</type>
725 </para>
726 <para>
727 <literal>t</literal> = table (including materialized views),
728 <literal>i</literal> = index.
729 </para></entry>
730 </row>
731 </tbody>
732 </tgroup>
733 </table>
734
735 <note>
736 <para>
737 Before <productname>PostgreSQL</productname> 9.6, <structname>pg_am</structname>
738 contained many additional columns representing properties of index access
739 methods. That data is now only directly visible at the C code level.
740 However, <function>pg_index_column_has_property()</function> and related
741 functions have been added to allow SQL queries to inspect index access
742 method properties; see <xref linkend="functions-info-catalog-table"/>.
743 </para>
744 </note>
745
746 </sect1>
747
748
749 <sect1 id="catalog-pg-amop">
750 <title><structname>pg_amop</structname></title>
751
752 <indexterm zone="catalog-pg-amop">
753 <primary>pg_amop</primary>
754 </indexterm>
755
756 <para>
757 The catalog <structname>pg_amop</structname> stores information about
758 operators associated with access method operator families. There is one
759 row for each operator that is a member of an operator family. A family
760 member can be either a <firstterm>search</firstterm> operator or an
761 <firstterm>ordering</firstterm> operator. An operator
762 can appear in more than one family, but cannot appear in more than one
763 search position nor more than one ordering position within a family.
764 (It is allowed, though unlikely, for an operator to be used for both
765 search and ordering purposes.)
766 </para>
767
768 <table>
769 <title><structname>pg_amop</structname> Columns</title>
770 <tgroup cols="1">
771 <thead>
772 <row>
773 <entry role="catalog_table_entry"><para role="column_definition">
774 Column Type
775 </para>
776 <para>
777 Description
778 </para></entry>
779 </row>
780 </thead>
781
782 <tbody>
783 <row>
784 <entry role="catalog_table_entry"><para role="column_definition">
785 <structfield>oid</structfield> <type>oid</type>
786 </para>
787 <para>
788 Row identifier
789 </para></entry>
790 </row>
791
792 <row>
793 <entry role="catalog_table_entry"><para role="column_definition">
794 <structfield>amopfamily</structfield> <type>oid</type>
795 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
796 </para>
797 <para>
798 The operator family this entry is for
799 </para></entry>
800 </row>
801
802 <row>
803 <entry role="catalog_table_entry"><para role="column_definition">
804 <structfield>amoplefttype</structfield> <type>oid</type>
805 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
806 </para>
807 <para>
808 Left-hand input data type of operator
809 </para></entry>
810 </row>
811
812 <row>
813 <entry role="catalog_table_entry"><para role="column_definition">
814 <structfield>amoprighttype</structfield> <type>oid</type>
815 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
816 </para>
817 <para>
818 Right-hand input data type of operator
819 </para></entry>
820 </row>
821
822 <row>
823 <entry role="catalog_table_entry"><para role="column_definition">
824 <structfield>amopstrategy</structfield> <type>int2</type>
825 </para>
826 <para>
827 Operator strategy number
828 </para></entry>
829 </row>
830
831 <row>
832 <entry role="catalog_table_entry"><para role="column_definition">
833 <structfield>amoppurpose</structfield> <type>char</type>
834 </para>
835 <para>
836 Operator purpose, either <literal>s</literal> for search or
837 <literal>o</literal> for ordering
838 </para></entry>
839 </row>
840
841 <row>
842 <entry role="catalog_table_entry"><para role="column_definition">
843 <structfield>amopopr</structfield> <type>oid</type>
844 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
845 </para>
846 <para>
847 OID of the operator
848 </para></entry>
849 </row>
850
851 <row>
852 <entry role="catalog_table_entry"><para role="column_definition">
853 <structfield>amopmethod</structfield> <type>oid</type>
854 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
855 </para>
856 <para>
857 Index access method operator family is for
858 </para></entry>
859 </row>
860
861 <row>
862 <entry role="catalog_table_entry"><para role="column_definition">
863 <structfield>amopsortfamily</structfield> <type>oid</type>
864 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
865 </para>
866 <para>
867 The B-tree operator family this entry sorts according to, if an
868 ordering operator; zero if a search operator
869 </para></entry>
870 </row>
871 </tbody>
872 </tgroup>
873 </table>
874
875 <para>
876 A <quote>search</quote> operator entry indicates that an index of this operator
877 family can be searched to find all rows satisfying
878 <literal>WHERE</literal>
879 <replaceable>indexed_column</replaceable>
880 <replaceable>operator</replaceable>
881 <replaceable>constant</replaceable>.
882 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
883 type must match the index's column data type.
884 </para>
885
886 <para>
887 An <quote>ordering</quote> operator entry indicates that an index of this
888 operator family can be scanned to return rows in the order represented by
889 <literal>ORDER BY</literal>
890 <replaceable>indexed_column</replaceable>
891 <replaceable>operator</replaceable>
892 <replaceable>constant</replaceable>.
893 Such an operator could return any sortable data type, though again
894 its left-hand input type must match the index's column data type.
895 The exact semantics of the <literal>ORDER BY</literal> are specified by the
896 <structfield>amopsortfamily</structfield> column, which must reference
897 a B-tree operator family for the operator's result type.
898 </para>
899
900 <note>
901 <para>
902 At present, it's assumed that the sort order for an ordering operator
903 is the default for the referenced operator family, i.e., <literal>ASC NULLS
904 LAST</literal>. This might someday be relaxed by adding additional columns
905 to specify sort options explicitly.
906 </para>
907 </note>
908
909 <para>
910 An entry's <structfield>amopmethod</structfield> must match the
911 <structfield>opfmethod</structfield> of its containing operator family (including
912 <structfield>amopmethod</structfield> here is an intentional denormalization of the
913 catalog structure for performance reasons). Also,
914 <structfield>amoplefttype</structfield> and <structfield>amoprighttype</structfield> must match
915 the <structfield>oprleft</structfield> and <structfield>oprright</structfield> fields of the
916 referenced <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link> entry.
917 </para>
918
919 </sect1>
920
921
922 <sect1 id="catalog-pg-amproc">
923 <title><structname>pg_amproc</structname></title>
924
925 <indexterm zone="catalog-pg-amproc">
926 <primary>pg_amproc</primary>
927 </indexterm>
928
929 <para>
930 The catalog <structname>pg_amproc</structname> stores information about
931 support functions associated with access method operator families. There
932 is one row for each support function belonging to an operator family.
933 </para>
934
935 <table>
936 <title><structname>pg_amproc</structname> Columns</title>
937 <tgroup cols="1">
938 <thead>
939 <row>
940 <entry role="catalog_table_entry"><para role="column_definition">
941 Column Type
942 </para>
943 <para>
944 Description
945 </para></entry>
946 </row>
947 </thead>
948
949 <tbody>
950 <row>
951 <entry role="catalog_table_entry"><para role="column_definition">
952 <structfield>oid</structfield> <type>oid</type>
953 </para>
954 <para>
955 Row identifier
956 </para></entry>
957 </row>
958
959 <row>
960 <entry role="catalog_table_entry"><para role="column_definition">
961 <structfield>amprocfamily</structfield> <type>oid</type>
962 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
963 </para>
964 <para>
965 The operator family this entry is for
966 </para></entry>
967 </row>
968
969 <row>
970 <entry role="catalog_table_entry"><para role="column_definition">
971 <structfield>amproclefttype</structfield> <type>oid</type>
972 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
973 </para>
974 <para>
975 Left-hand input data type of associated operator
976 </para></entry>
977 </row>
978
979 <row>
980 <entry role="catalog_table_entry"><para role="column_definition">
981 <structfield>amprocrighttype</structfield> <type>oid</type>
982 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
983 </para>
984 <para>
985 Right-hand input data type of associated operator
986 </para></entry>
987 </row>
988
989 <row>
990 <entry role="catalog_table_entry"><para role="column_definition">
991 <structfield>amprocnum</structfield> <type>int2</type>
992 </para>
993 <para>
994 Support function number
995 </para></entry>
996 </row>
997
998 <row>
999 <entry role="catalog_table_entry"><para role="column_definition">
1000 <structfield>amproc</structfield> <type>regproc</type>
1001 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
1002 </para>
1003 <para>
1004 OID of the function
1005 </para></entry>
1006 </row>
1007 </tbody>
1008 </tgroup>
1009 </table>
1010
1011 <para>
1012 The usual interpretation of the
1013 <structfield>amproclefttype</structfield> and <structfield>amprocrighttype</structfield> fields
1014 is that they identify the left and right input types of the operator(s)
1015 that a particular support function supports. For some access methods
1016 these match the input data type(s) of the support function itself, for
1017 others not. There is a notion of <quote>default</quote> support functions for
1018 an index, which are those with <structfield>amproclefttype</structfield> and
1019 <structfield>amprocrighttype</structfield> both equal to the index operator class's
1020 <structfield>opcintype</structfield>.
1021 </para>
1022
1023 </sect1>
1024
1025
1026 <sect1 id="catalog-pg-attrdef">
1027 <title><structname>pg_attrdef</structname></title>
1028
1029 <indexterm zone="catalog-pg-attrdef">
1030 <primary>pg_attrdef</primary>
1031 </indexterm>
1032
1033 <para>
1034 The catalog <structname>pg_attrdef</structname> stores column default
1035 expressions and generation expressions. The main information about columns
1036 is stored in <link
1037 linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.
1038 Only columns for which a default expression or generation expression has
1039 been explicitly set will have an entry here.
1040 </para>
1041
1042 <table>
1043 <title><structname>pg_attrdef</structname> Columns</title>
1044 <tgroup cols="1">
1045 <thead>
1046 <row>
1047 <entry role="catalog_table_entry"><para role="column_definition">
1048 Column Type
1049 </para>
1050 <para>
1051 Description
1052 </para></entry>
1053 </row>
1054 </thead>
1055
1056 <tbody>
1057 <row>
1058 <entry role="catalog_table_entry"><para role="column_definition">
1059 <structfield>oid</structfield> <type>oid</type>
1060 </para>
1061 <para>
1062 Row identifier
1063 </para></entry>
1064 </row>
1065
1066 <row>
1067 <entry role="catalog_table_entry"><para role="column_definition">
1068 <structfield>adrelid</structfield> <type>oid</type>
1069 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1070 </para>
1071 <para>
1072 The table this column belongs to
1073 </para></entry>
1074 </row>
1075
1076 <row>
1077 <entry role="catalog_table_entry"><para role="column_definition">
1078 <structfield>adnum</structfield> <type>int2</type>
1079 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
1080 </para>
1081 <para>
1082 The number of the column
1083 </para></entry>
1084 </row>
1085
1086 <row>
1087 <entry role="catalog_table_entry"><para role="column_definition">
1088 <structfield>adbin</structfield> <type>pg_node_tree</type>
1089 </para>
1090 <para>
1091 The column default or generation expression, in <function>nodeToString()</function>
1092 representation. Use <literal>pg_get_expr(adbin, adrelid)</literal> to
1093 convert it to an SQL expression.
1094 </para></entry>
1095 </row>
1096 </tbody>
1097 </tgroup>
1098 </table>
1099 </sect1>
1100
1101
1102 <sect1 id="catalog-pg-attribute">
1103 <title><structname>pg_attribute</structname></title>
1104
1105 <indexterm zone="catalog-pg-attribute">
1106 <primary>pg_attribute</primary>
1107 </indexterm>
1108
1109 <para>
1110 The catalog <structname>pg_attribute</structname> stores information about
1111 table columns. There will be exactly one
1112 <structname>pg_attribute</structname> row for every column in every
1113 table in the database. (There will also be attribute entries for
1114 indexes, and indeed all objects that have
1115 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>
1116 entries.)
1117 </para>
1118
1119 <para>
1120 The term attribute is equivalent to column and is used for
1121 historical reasons.
1122 </para>
1123
1124 <table>
1125 <title><structname>pg_attribute</structname> Columns</title>
1126 <tgroup cols="1">
1127 <thead>
1128 <row>
1129 <entry role="catalog_table_entry"><para role="column_definition">
1130 Column Type
1131 </para>
1132 <para>
1133 Description
1134 </para></entry>
1135 </row>
1136 </thead>
1137
1138 <tbody>
1139 <row>
1140 <entry role="catalog_table_entry"><para role="column_definition">
1141 <structfield>attrelid</structfield> <type>oid</type>
1142 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1143 </para>
1144 <para>
1145 The table this column belongs to
1146 </para></entry>
1147 </row>
1148
1149 <row>
1150 <entry role="catalog_table_entry"><para role="column_definition">
1151 <structfield>attname</structfield> <type>name</type>
1152 </para>
1153 <para>
1154 The column name
1155 </para></entry>
1156 </row>
1157
1158 <row>
1159 <entry role="catalog_table_entry"><para role="column_definition">
1160 <structfield>atttypid</structfield> <type>oid</type>
1161 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1162 </para>
1163 <para>
1164 The data type of this column (zero for a dropped column)
1165 </para></entry>
1166 </row>
1167
1168 <row>
1169 <entry role="catalog_table_entry"><para role="column_definition">
1170 <structfield>attlen</structfield> <type>int2</type>
1171 </para>
1172 <para>
1173 A copy of <literal>pg_type.typlen</literal> of this column's
1174 type
1175 </para></entry>
1176 </row>
1177
1178 <row>
1179 <entry role="catalog_table_entry"><para role="column_definition">
1180 <structfield>attnum</structfield> <type>int2</type>
1181 </para>
1182 <para>
1183 The number of the column. Ordinary columns are numbered from 1
1184 up. System columns, such as <structfield>ctid</structfield>,
1185 have (arbitrary) negative numbers.
1186 </para></entry>
1187 </row>
1188
1189 <row>
1190 <entry role="catalog_table_entry"><para role="column_definition">
1191 <structfield>atttypmod</structfield> <type>int4</type>
1192 </para>
1193 <para>
1194 <structfield>atttypmod</structfield> records type-specific data
1195 supplied at table creation time (for example, the maximum
1196 length of a <type>varchar</type> column). It is passed to
1197 type-specific input functions and length coercion functions.
1198 The value will generally be -1 for types that do not need <structfield>atttypmod</structfield>.
1199 </para></entry>
1200 </row>
1201
1202 <row>
1203 <entry role="catalog_table_entry"><para role="column_definition">
1204 <structfield>attndims</structfield> <type>int2</type>
1205 </para>
1206 <para>
1207 Number of dimensions, if the column is an array type; otherwise 0.
1208 (Presently, the number of dimensions of an array is not enforced,
1209 so any nonzero value effectively means <quote>it's an array</quote>.)
1210 </para></entry>
1211 </row>
1212
1213 <row>
1214 <entry role="catalog_table_entry"><para role="column_definition">
1215 <structfield>attbyval</structfield> <type>bool</type>
1216 </para>
1217 <para>
1218 A copy of <literal>pg_type.typbyval</literal> of this column's type
1219 </para></entry>
1220 </row>
1221
1222 <row>
1223 <entry role="catalog_table_entry"><para role="column_definition">
1224 <structfield>attalign</structfield> <type>char</type>
1225 </para>
1226 <para>
1227 A copy of <literal>pg_type.typalign</literal> of this column's type
1228 </para></entry>
1229 </row>
1230
1231 <row>
1232 <entry role="catalog_table_entry"><para role="column_definition">
1233 <structfield>attstorage</structfield> <type>char</type>
1234 </para>
1235 <para>
1236 Normally a copy of <literal>pg_type.typstorage</literal> of this
1237 column's type. For TOAST-able data types, this can be altered
1238 after column creation to control storage policy.
1239 </para></entry>
1240 </row>
1241
1242 <row>
1243 <entry role="catalog_table_entry"><para role="column_definition">
1244 <structfield>attcompression</structfield> <type>char</type>
1245 </para>
1246 <para>
1247 The current compression method of the column. Typically this is
1248 <literal>'\0'</literal> to specify use of the current default setting
1249 (see <xref linkend="guc-default-toast-compression"/>). Otherwise,
1250 <literal>'p'</literal> selects pglz compression, while
1251 <literal>'l'</literal> selects <productname>LZ4</productname>
1252 compression. However, this field is ignored
1253 whenever <structfield>attstorage</structfield> does not allow
1254 compression.
1255 </para></entry>
1256 </row>
1257
1258 <row>
1259 <entry role="catalog_table_entry"><para role="column_definition">
1260 <structfield>attnotnull</structfield> <type>bool</type>
1261 </para>
1262 <para>
1263 This column has a (possibly invalid) not-null constraint.
1264 </para></entry>
1265 </row>
1266
1267 <row>
1268 <entry role="catalog_table_entry"><para role="column_definition">
1269 <structfield>atthasdef</structfield> <type>bool</type>
1270 </para>
1271 <para>
1272 This column has a default expression or generation expression, in which
1273 case there will be a corresponding entry in the
1274 <link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link> catalog that actually defines the
1275 expression. (Check <structfield>attgenerated</structfield> to
1276 determine whether this is a default or a generation expression.)
1277 </para></entry>
1278 </row>
1279
1280 <row>
1281 <entry role="catalog_table_entry"><para role="column_definition">
1282 <structfield>atthasmissing</structfield> <type>bool</type>
1283 </para>
1284 <para>
1285 This column has a value which is used where the column is entirely
1286 missing from the row, as happens when a column is added with a
1287 non-volatile <literal>DEFAULT</literal> value after the row is created.
1288 The actual value used is stored in the
1289 <structfield>attmissingval</structfield> column.
1290 </para></entry>
1291 </row>
1292
1293 <row>
1294 <entry role="catalog_table_entry"><para role="column_definition">
1295 <structfield>attidentity</structfield> <type>char</type>
1296 </para>
1297 <para>
1298 If a zero byte (<literal>''</literal>), then not an identity column.
1299 Otherwise, <literal>a</literal> = generated
1300 always, <literal>d</literal> = generated by default.
1301 </para></entry>
1302 </row>
1303
1304 <row>
1305 <entry role="catalog_table_entry"><para role="column_definition">
1306 <structfield>attgenerated</structfield> <type>char</type>
1307 </para>
1308 <para>
1309 If a zero byte (<literal>''</literal>), then not a generated column.
1310 Otherwise, <literal>s</literal> = stored, <literal>v</literal> =
1311 virtual. A stored generated column is physically stored like a normal
1312 column. A virtual generated column is physically stored as a null
1313 value, with the actual value being computed at run time.
1314 </para></entry>
1315 </row>
1316
1317 <row>
1318 <entry role="catalog_table_entry"><para role="column_definition">
1319 <structfield>attisdropped</structfield> <type>bool</type>
1320 </para>
1321 <para>
1322 This column has been dropped and is no longer valid. A dropped
1323 column is still physically present in the table, but is
1324 ignored by the parser and so cannot be accessed via SQL.
1325 </para></entry>
1326 </row>
1327
1328 <row>
1329 <entry role="catalog_table_entry"><para role="column_definition">
1330 <structfield>attislocal</structfield> <type>bool</type>
1331 </para>
1332 <para>
1333 This column is defined locally in the relation. Note that a column can
1334 be locally defined and inherited simultaneously.
1335 </para></entry>
1336 </row>
1337
1338 <row>
1339 <entry role="catalog_table_entry"><para role="column_definition">
1340 <structfield>attinhcount</structfield> <type>int2</type>
1341 </para>
1342 <para>
1343 The number of direct ancestors this column has. A column with a
1344 nonzero number of ancestors cannot be dropped nor renamed.
1345 </para></entry>
1346 </row>
1347
1348 <row>
1349 <entry role="catalog_table_entry"><para role="column_definition">
1350 <structfield>attcollation</structfield> <type>oid</type>
1351 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
1352 </para>
1353 <para>
1354 The defined collation of the column, or zero if the column is
1355 not of a collatable data type
1356 </para></entry>
1357 </row>
1358
1359 <row>
1360 <entry role="catalog_table_entry"><para role="column_definition">
1361 <structfield>attstattarget</structfield> <type>int2</type>
1362 </para>
1363 <para>
1364 <structfield>attstattarget</structfield> controls the level of detail
1365 of statistics accumulated for this column by
1366 <link linkend="sql-analyze"><command>ANALYZE</command></link>.
1367 A zero value indicates that no statistics should be collected.
1368 A null value says to use the system default statistics target.
1369 The exact meaning of positive values is data type-dependent.
1370 For scalar data types, <structfield>attstattarget</structfield>
1371 is both the target number of <quote>most common values</quote>
1372 to collect, and the target number of histogram bins to create.
1373 </para></entry>
1374 </row>
1375
1376 <row>
1377 <entry role="catalog_table_entry"><para role="column_definition">
1378 <structfield>attacl</structfield> <type>aclitem[]</type>
1379 </para>
1380 <para>
1381 Column-level access privileges, if any have been granted specifically
1382 on this column
1383 </para></entry>
1384 </row>
1385
1386 <row>
1387 <entry role="catalog_table_entry"><para role="column_definition">
1388 <structfield>attoptions</structfield> <type>text[]</type>
1389 </para>
1390 <para>
1391 Attribute-level options, as <quote>keyword=value</quote> strings
1392 </para></entry>
1393 </row>
1394
1395 <row>
1396 <entry role="catalog_table_entry"><para role="column_definition">
1397 <structfield>attfdwoptions</structfield> <type>text[]</type>
1398 </para>
1399 <para>
1400 Attribute-level foreign data wrapper options, as <quote>keyword=value</quote> strings
1401 </para></entry>
1402 </row>
1403
1404 <row>
1405 <entry role="catalog_table_entry"><para role="column_definition">
1406 <structfield>attmissingval</structfield> <type>anyarray</type>
1407 </para>
1408 <para>
1409 This column has a one element array containing the value used when the
1410 column is entirely missing from the row, as happens when the column is
1411 added with a non-volatile <literal>DEFAULT</literal> value after the
1412 row is created. The value is only used when
1413 <structfield>atthasmissing</structfield> is true. If there is no value
1414 the column is null.
1415 </para></entry>
1416 </row>
1417 </tbody>
1418 </tgroup>
1419 </table>
1420
1421 <para>
1422 In a dropped column's <structname>pg_attribute</structname> entry,
1423 <structfield>atttypid</structfield> is reset to zero, but
1424 <structfield>attlen</structfield> and the other fields copied from
1425 <link linkend="catalog-pg-type"><structname>pg_type</structname></link> are still valid. This arrangement is needed
1426 to cope with the situation where the dropped column's data type was
1427 later dropped, and so there is no <structname>pg_type</structname> row anymore.
1428 <structfield>attlen</structfield> and the other fields can be used
1429 to interpret the contents of a row of the table.
1430 </para>
1431 </sect1>
1432
1433
1434 <sect1 id="catalog-pg-authid">
1435 <title><structname>pg_authid</structname></title>
1436
1437 <indexterm zone="catalog-pg-authid">
1438 <primary>pg_authid</primary>
1439 </indexterm>
1440
1441 <para>
1442 The catalog <structname>pg_authid</structname> contains information about
1443 database authorization identifiers (roles). A role subsumes the concepts
1444 of <quote>users</quote> and <quote>groups</quote>. A user is essentially just a
1445 role with the <structfield>rolcanlogin</structfield> flag set. Any role (with or
1446 without <structfield>rolcanlogin</structfield>) can have other roles as members; see
1447 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1448 </para>
1449
1450 <para>
1451 Since this catalog contains passwords, it must not be publicly readable.
1452 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1453 is a publicly readable view on
1454 <structname>pg_authid</structname> that blanks out the password field.
1455 </para>
1456
1457 <para>
1458 <xref linkend="user-manag"/> contains detailed information about user and
1459 privilege management.
1460 </para>
1461
1462 <para>
1463 Because user identities are cluster-wide,
1464 <structname>pg_authid</structname>
1465 is shared across all databases of a cluster: there is only one
1466 copy of <structname>pg_authid</structname> per cluster, not
1467 one per database.
1468 </para>
1469
1470 <table>
1471 <title><structname>pg_authid</structname> Columns</title>
1472 <tgroup cols="1">
1473 <thead>
1474 <row>
1475 <entry role="catalog_table_entry"><para role="column_definition">
1476 Column Type
1477 </para>
1478 <para>
1479 Description
1480 </para></entry>
1481 </row>
1482 </thead>
1483
1484 <tbody>
1485 <row>
1486 <entry role="catalog_table_entry"><para role="column_definition">
1487 <structfield>oid</structfield> <type>oid</type>
1488 </para>
1489 <para>
1490 Row identifier
1491 </para></entry>
1492 </row>
1493
1494 <row>
1495 <entry role="catalog_table_entry"><para role="column_definition">
1496 <structfield>rolname</structfield> <type>name</type>
1497 </para>
1498 <para>
1499 Role name
1500 </para></entry>
1501 </row>
1502
1503 <row>
1504 <entry role="catalog_table_entry"><para role="column_definition">
1505 <structfield>rolsuper</structfield> <type>bool</type>
1506 </para>
1507 <para>
1508 Role has superuser privileges
1509 </para></entry>
1510 </row>
1511
1512 <row>
1513 <entry role="catalog_table_entry"><para role="column_definition">
1514 <structfield>rolinherit</structfield> <type>bool</type>
1515 </para>
1516 <para>
1517 Role automatically inherits privileges of roles it is a
1518 member of
1519 </para></entry>
1520 </row>
1521
1522 <row>
1523 <entry role="catalog_table_entry"><para role="column_definition">
1524 <structfield>rolcreaterole</structfield> <type>bool</type>
1525 </para>
1526 <para>
1527 Role can create more roles
1528 </para></entry>
1529 </row>
1530
1531 <row>
1532 <entry role="catalog_table_entry"><para role="column_definition">
1533 <structfield>rolcreatedb</structfield> <type>bool</type>
1534 </para>
1535 <para>
1536 Role can create databases
1537 </para></entry>
1538 </row>
1539
1540 <row>
1541 <entry role="catalog_table_entry"><para role="column_definition">
1542 <structfield>rolcanlogin</structfield> <type>bool</type>
1543 </para>
1544 <para>
1545 Role can log in. That is, this role can be given as the initial
1546 session authorization identifier.
1547 </para></entry>
1548 </row>
1549
1550 <row>
1551 <entry role="catalog_table_entry"><para role="column_definition">
1552 <structfield>rolreplication</structfield> <type>bool</type>
1553 </para>
1554 <para>
1555 Role is a replication role. A replication role can initiate replication
1556 connections and create and drop replication slots.
1557 </para></entry>
1558 </row>
1559
1560 <row>
1561 <entry role="catalog_table_entry"><para role="column_definition">
1562 <structfield>rolbypassrls</structfield> <type>bool</type>
1563 </para>
1564 <para>
1565 Role bypasses every row-level security policy, see
1566 <xref linkend="ddl-rowsecurity"/> for more information.
1567 </para></entry>
1568 </row>
1569
1570 <row>
1571 <entry role="catalog_table_entry"><para role="column_definition">
1572 <structfield>rolconnlimit</structfield> <type>int4</type>
1573 </para>
1574 <para>
1575 For roles that can log in, this sets maximum number of concurrent
1576 connections this role can make. -1 means no limit.
1577 </para></entry>
1578 </row>
1579
1580 <row>
1581 <entry role="catalog_table_entry"><para role="column_definition">
1582 <structfield>rolpassword</structfield> <type>text</type>
1583 </para>
1584 <para>
1585 Encrypted password; null if none. The format depends
1586 on the form of encryption used.
1587 </para></entry>
1588 </row>
1589
1590 <row>
1591 <entry role="catalog_table_entry"><para role="column_definition">
1592 <structfield>rolvaliduntil</structfield> <type>timestamptz</type>
1593 </para>
1594 <para>
1595 Password expiry time (only used for password authentication);
1596 null if no expiration
1597 </para></entry>
1598 </row>
1599 </tbody>
1600 </tgroup>
1601 </table>
1602
1603 <para>
1604 For an MD5 encrypted password, <structfield>rolpassword</structfield>
1605 column will begin with the string <literal>md5</literal> followed by a
1606 32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1607 password concatenated to their user name. For example, if user
1608 <literal>joe</literal> has password <literal>xyzzy</literal>, <productname>PostgreSQL</productname>
1609 will store the md5 hash of <literal>xyzzyjoe</literal>.
1610 </para>
1611
1612 <warning>
1613 <para>
1614 Support for MD5-encrypted passwords is deprecated and will be removed in a
1615 future release of <productname>PostgreSQL</productname>. Refer to
1616 <xref linkend="auth-password"/> for details about migrating to another
1617 password type.
1618 </para>
1619 </warning>
1620
1621 <para>
1622 If the password is encrypted with SCRAM-SHA-256, it has the format:
1623 <synopsis>
1624 SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&lt;salt&gt;</replaceable>$<replaceable>&lt;StoredKey&gt;</replaceable>:<replaceable>&lt;ServerKey&gt;</replaceable>
1625 </synopsis>
1626 where <replaceable>salt</replaceable>, <replaceable>StoredKey</replaceable> and
1627 <replaceable>ServerKey</replaceable> are in Base64 encoded format. This format is
1628 the same as that specified by <ulink url="https://datatracker.ietf.org/doc/html/rfc5803">RFC 5803</ulink>.
1629 </para>
1630 </sect1>
1631
1632
1633 <sect1 id="catalog-pg-auth-members">
1634 <title><structname>pg_auth_members</structname></title>
1635
1636 <indexterm zone="catalog-pg-auth-members">
1637 <primary>pg_auth_members</primary>
1638 </indexterm>
1639
1640 <para>
1641 The catalog <structname>pg_auth_members</structname> shows the membership
1642 relations between roles. Any non-circular set of relationships is allowed.
1643 </para>
1644
1645 <para>
1646 Because user identities are cluster-wide,
1647 <structname>pg_auth_members</structname>
1648 is shared across all databases of a cluster: there is only one
1649 copy of <structname>pg_auth_members</structname> per cluster, not
1650 one per database.
1651 </para>
1652
1653 <table>
1654 <title><structname>pg_auth_members</structname> Columns</title>
1655 <tgroup cols="1">
1656 <thead>
1657 <row>
1658 <entry role="catalog_table_entry"><para role="column_definition">
1659 Column Type
1660 </para>
1661 <para>
1662 Description
1663 </para></entry>
1664 </row>
1665 </thead>
1666
1667 <tbody>
1668 <row>
1669 <entry role="catalog_table_entry"><para role="column_definition">
1670 <structfield>oid</structfield> <type>oid</type>
1671 </para>
1672 <para>
1673 Row identifier
1674 </para></entry>
1675 </row>
1676
1677 <row>
1678 <entry role="catalog_table_entry"><para role="column_definition">
1679 <structfield>roleid</structfield> <type>oid</type>
1680 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1681 </para>
1682 <para>
1683 ID of a role that has a member
1684 </para></entry>
1685 </row>
1686
1687 <row>
1688 <entry role="catalog_table_entry"><para role="column_definition">
1689 <structfield>member</structfield> <type>oid</type>
1690 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1691 </para>
1692 <para>
1693 ID of a role that is a member of <structfield>roleid</structfield>
1694 </para></entry>
1695 </row>
1696
1697 <row>
1698 <entry role="catalog_table_entry"><para role="column_definition">
1699 <structfield>grantor</structfield> <type>oid</type>
1700 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1701 </para>
1702 <para>
1703 ID of the role that granted this membership
1704 </para></entry>
1705 </row>
1706
1707 <row>
1708 <entry role="catalog_table_entry"><para role="column_definition">
1709 <structfield>admin_option</structfield> <type>bool</type>
1710 </para>
1711 <para>
1712 True if <structfield>member</structfield> can grant membership in
1713 <structfield>roleid</structfield> to others
1714 </para></entry>
1715 </row>
1716
1717 <row>
1718 <entry role="catalog_table_entry"><para role="column_definition">
1719 <structfield>inherit_option</structfield> <type>bool</type>
1720 </para>
1721 <para>
1722 True if the member automatically inherits the privileges of the
1723 granted role
1724 </para></entry>
1725 </row>
1726
1727 <row>
1728 <entry role="catalog_table_entry"><para role="column_definition">
1729 <structfield>set_option</structfield> <type>bool</type>
1730 </para>
1731 <para>
1732 True if the member can
1733 <link linkend="sql-set-role"><command>SET ROLE</command></link>
1734 to the granted role
1735 </para></entry>
1736 </row>
1737 </tbody>
1738 </tgroup>
1739 </table>
1740
1741 </sect1>
1742
1743
1744 <sect1 id="catalog-pg-cast">
1745 <title><structname>pg_cast</structname></title>
1746
1747 <indexterm zone="catalog-pg-cast">
1748 <primary>pg_cast</primary>
1749 </indexterm>
1750
1751 <para>
1752 The catalog <structname>pg_cast</structname> stores data type conversion
1753 paths, both built-in and user-defined.
1754 </para>
1755
1756 <para>
1757 It should be noted that <structname>pg_cast</structname> does not represent
1758 every type conversion that the system knows how to perform; only those that
1759 cannot be deduced from some generic rule. For example, casting between a
1760 domain and its base type is not explicitly represented in
1761 <structname>pg_cast</structname>. Another important exception is that
1762 <quote>automatic I/O conversion casts</quote>, those performed using a data
1763 type's own I/O functions to convert to or from <type>text</type> or other
1764 string types, are not explicitly represented in
1765 <structname>pg_cast</structname>.
1766 </para>
1767
1768 <table>
1769 <title><structname>pg_cast</structname> Columns</title>
1770 <tgroup cols="1">
1771 <thead>
1772 <row>
1773 <entry role="catalog_table_entry"><para role="column_definition">
1774 Column Type
1775 </para>
1776 <para>
1777 Description
1778 </para></entry>
1779 </row>
1780 </thead>
1781
1782 <tbody>
1783 <row>
1784 <entry role="catalog_table_entry"><para role="column_definition">
1785 <structfield>oid</structfield> <type>oid</type>
1786 </para>
1787 <para>
1788 Row identifier
1789 </para></entry>
1790 </row>
1791
1792 <row>
1793 <entry role="catalog_table_entry"><para role="column_definition">
1794 <structfield>castsource</structfield> <type>oid</type>
1795 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1796 </para>
1797 <para>
1798 OID of the source data type
1799 </para></entry>
1800 </row>
1801
1802 <row>
1803 <entry role="catalog_table_entry"><para role="column_definition">
1804 <structfield>casttarget</structfield> <type>oid</type>
1805 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1806 </para>
1807 <para>
1808 OID of the target data type
1809 </para></entry>
1810 </row>
1811
1812 <row>
1813 <entry role="catalog_table_entry"><para role="column_definition">
1814 <structfield>castfunc</structfield> <type>oid</type>
1815 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
1816 </para>
1817 <para>
1818 The OID of the function to use to perform this cast. Zero is
1819 stored if the cast method doesn't require a function.
1820 </para></entry>
1821 </row>
1822
1823 <row>
1824 <entry role="catalog_table_entry"><para role="column_definition">
1825 <structfield>castcontext</structfield> <type>char</type>
1826 </para>
1827 <para>
1828 Indicates what contexts the cast can be invoked in.
1829 <literal>e</literal> means only as an explicit cast (using
1830 <literal>CAST</literal> or <literal>::</literal> syntax).
1831 <literal>a</literal> means implicitly in assignment
1832 to a target column, as well as explicitly.
1833 <literal>i</literal> means implicitly in expressions, as well as the
1834 other cases.
1835 </para></entry>
1836 </row>
1837
1838 <row>
1839 <entry role="catalog_table_entry"><para role="column_definition">
1840 <structfield>castmethod</structfield> <type>char</type>
1841 </para>
1842 <para>
1843 Indicates how the cast is performed.
1844 <literal>f</literal> means that the function specified in the <structfield>castfunc</structfield> field is used.
1845 <literal>i</literal> means that the input/output functions are used.
1846 <literal>b</literal> means that the types are binary-coercible, thus no conversion is required.
1847 </para></entry>
1848 </row>
1849 </tbody>
1850 </tgroup>
1851 </table>
1852
1853 <para>
1854 The cast functions listed in <structname>pg_cast</structname> must
1855 always take the cast source type as their first argument type, and
1856 return the cast destination type as their result type. A cast
1857 function can have up to three arguments. The second argument,
1858 if present, must be type <type>integer</type>; it receives the type
1859 modifier associated with the destination type, or -1
1860 if there is none. The third argument,
1861 if present, must be type <type>boolean</type>; it receives <literal>true</literal>
1862 if the cast is an explicit cast, <literal>false</literal> otherwise.
1863 </para>
1864
1865 <para>
1866 It is legitimate to create a <structname>pg_cast</structname> entry
1867 in which the source and target types are the same, if the associated
1868 function takes more than one argument. Such entries represent
1869 <quote>length coercion functions</quote> that coerce values of the type
1870 to be legal for a particular type modifier value.
1871 </para>
1872
1873 <para>
1874 When a <structname>pg_cast</structname> entry has different source and
1875 target types and a function that takes more than one argument, it
1876 represents converting from one type to another and applying a length
1877 coercion in a single step. When no such entry is available, coercion
1878 to a type that uses a type modifier involves two steps, one to
1879 convert between data types and a second to apply the modifier.
1880 </para>
1881 </sect1>
1882
1883 <sect1 id="catalog-pg-class">
1884 <title><structname>pg_class</structname></title>
1885
1886 <indexterm zone="catalog-pg-class">
1887 <primary>pg_class</primary>
1888 </indexterm>
1889
1890 <para>
1891 The catalog <structname>pg_class</structname> describes tables and
1892 other objects that have columns or are otherwise similar to a
1893 table. This includes indexes (but see also <link
1894 linkend="catalog-pg-index"><structname>pg_index</structname></link>),
1895 sequences (but see also <link
1896 linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link>),
1897 views, materialized views, composite types, and TOAST tables;
1898 see <structfield>relkind</structfield>.
1899 Below, when we mean all of these kinds of objects we speak of
1900 <quote>relations</quote>. Not all of <structname>pg_class</structname>'s
1901 columns are meaningful for all relation kinds.
1902 </para>
1903
1904 <table>
1905 <title><structname>pg_class</structname> Columns</title>
1906 <tgroup cols="1">
1907 <thead>
1908 <row>
1909 <entry role="catalog_table_entry"><para role="column_definition">
1910 Column Type
1911 </para>
1912 <para>
1913 Description
1914 </para></entry>
1915 </row>
1916 </thead>
1917
1918 <tbody>
1919 <row>
1920 <entry role="catalog_table_entry"><para role="column_definition">
1921 <structfield>oid</structfield> <type>oid</type>
1922 </para>
1923 <para>
1924 Row identifier
1925 </para></entry>
1926 </row>
1927
1928 <row>
1929 <entry role="catalog_table_entry"><para role="column_definition">
1930 <structfield>relname</structfield> <type>name</type>
1931 </para>
1932 <para>
1933 Name of the table, index, view, etc.
1934 </para></entry>
1935 </row>
1936
1937 <row>
1938 <entry role="catalog_table_entry"><para role="column_definition">
1939 <structfield>relnamespace</structfield> <type>oid</type>
1940 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
1941 </para>
1942 <para>
1943 The OID of the namespace that contains this relation
1944 </para></entry>
1945 </row>
1946
1947 <row>
1948 <entry role="catalog_table_entry"><para role="column_definition">
1949 <structfield>reltype</structfield> <type>oid</type>
1950 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1951 </para>
1952 <para>
1953 The OID of the data type that corresponds to this table's row type,
1954 if any; zero for indexes, sequences, and toast tables, which have
1955 no <structname>pg_type</structname> entry
1956 </para></entry>
1957 </row>
1958
1959 <row>
1960 <entry role="catalog_table_entry"><para role="column_definition">
1961 <structfield>reloftype</structfield> <type>oid</type>
1962 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1963 </para>
1964 <para>
1965 For typed tables, the OID of the underlying composite type;
1966 zero for all other relations
1967 </para></entry>
1968 </row>
1969
1970 <row>
1971 <entry role="catalog_table_entry"><para role="column_definition">
1972 <structfield>relowner</structfield> <type>oid</type>
1973 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1974 </para>
1975 <para>
1976 Owner of the relation
1977 </para></entry>
1978 </row>
1979
1980 <row>
1981 <entry role="catalog_table_entry"><para role="column_definition">
1982 <structfield>relam</structfield> <type>oid</type>
1983 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
1984 </para>
1985 <para>
1986 The access method used to access this table or index.
1987 Not meaningful if the relation is a sequence or
1988 has no on-disk file,
1989 except for partitioned tables, where, if set, it takes
1990 precedence over <varname>default_table_access_method</varname>
1991 when determining the access method to use for partitions created
1992 when one is not specified in the creation command.
1993 </para></entry>
1994 </row>
1995
1996 <row>
1997 <entry role="catalog_table_entry"><para role="column_definition">
1998 <structfield>relfilenode</structfield> <type>oid</type>
1999 </para>
2000 <para>
2001 Name of the on-disk file of this relation; zero means this
2002 is a <quote>mapped</quote> relation whose disk file name is determined
2003 by low-level state
2004 </para></entry>
2005 </row>
2006
2007 <row>
2008 <entry role="catalog_table_entry"><para role="column_definition">
2009 <structfield>reltablespace</structfield> <type>oid</type>
2010 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>)
2011 </para>
2012 <para>
2013 The tablespace in which this relation is stored.
2014 If zero, the database's default tablespace is implied.
2015 Not meaningful if the relation has no on-disk file,
2016 except for partitioned tables, where this is the tablespace
2017 in which partitions will be created when one is not
2018 specified in the creation command.
2019 </para></entry>
2020 </row>
2021
2022 <row>
2023 <entry role="catalog_table_entry"><para role="column_definition">
2024 <structfield>relpages</structfield> <type>int4</type>
2025 </para>
2026 <para>
2027 Size of the on-disk representation of this table in pages (of size
2028 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
2029 planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>,
2030 <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as
2031 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>.
2032 </para></entry>
2033 </row>
2034
2035 <row>
2036 <entry role="catalog_table_entry"><para role="column_definition">
2037 <structfield>reltuples</structfield> <type>float4</type>
2038 </para>
2039 <para>
2040 Number of live rows in the table. This is only an estimate used by
2041 the planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>,
2042 <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as
2043 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>.
2044 If the table has never yet been vacuumed or
2045 analyzed, <structfield>reltuples</structfield>
2046 contains <literal>-1</literal> indicating that the row count is
2047 unknown.
2048 </para></entry>
2049 </row>
2050
2051 <row>
2052 <entry role="catalog_table_entry"><para role="column_definition">
2053 <structfield>relallvisible</structfield> <type>int4</type>
2054 </para>
2055 <para>
2056 Number of pages that are marked all-visible in the table's
2057 visibility map. This is only an estimate used by the
2058 planner. It is updated by <link linkend="sql-vacuum"><command>VACUUM</command></link>,
2059 <link linkend="sql-analyze"><command>ANALYZE</command></link>, and a few DDL commands such as
2060 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>.
2061 </para></entry>
2062 </row>
2063
2064 <row>
2065 <entry role="catalog_table_entry"><para role="column_definition">
2066 <structfield>relallfrozen</structfield> <type>int4</type>
2067 </para>
2068 <para>
2069 Number of pages that are marked all-frozen in the table's visibility
2070 map. This is only an estimate used for triggering autovacuums. It can
2071 also be used along with <structfield>relallvisible</structfield> for
2072 scheduling manual vacuums and tuning <link
2073 linkend="runtime-config-vacuum-freezing">vacuum's freezing
2074 behavior</link>.
2075
2076 It is updated by
2077 <link linkend="sql-vacuum"><command>VACUUM</command></link>,
2078 <link linkend="sql-analyze"><command>ANALYZE</command></link>,
2079 and a few DDL commands such as
2080 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>.
2081 </para></entry>
2082 </row>
2083
2084
2085 <row>
2086 <entry role="catalog_table_entry"><para role="column_definition">
2087 <structfield>reltoastrelid</structfield> <type>oid</type>
2088 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2089 </para>
2090 <para>
2091 OID of the TOAST table associated with this table, zero if none. The
2092 TOAST table stores large attributes <quote>out of line</quote> in a
2093 secondary table.
2094 </para></entry>
2095 </row>
2096
2097 <row>
2098 <entry role="catalog_table_entry"><para role="column_definition">
2099 <structfield>relhasindex</structfield> <type>bool</type>
2100 </para>
2101 <para>
2102 True if this is a table and it has (or recently had) any indexes
2103 </para></entry>
2104 </row>
2105
2106 <row>
2107 <entry role="catalog_table_entry"><para role="column_definition">
2108 <structfield>relisshared</structfield> <type>bool</type>
2109 </para>
2110 <para>
2111 True if this table is shared across all databases in the cluster. Only
2112 certain system catalogs (such as <link linkend="catalog-pg-database"><structname>pg_database</structname></link>)
2113 are shared.
2114 </para></entry>
2115 </row>
2116
2117 <row>
2118 <entry role="catalog_table_entry"><para role="column_definition">
2119 <structfield>relpersistence</structfield> <type>char</type>
2120 </para>
2121 <para>
2122 <literal>p</literal> = permanent table/sequence, <literal>u</literal> = unlogged table/sequence,
2123 <literal>t</literal> = temporary table/sequence
2124 </para></entry>
2125 </row>
2126
2127 <row>
2128 <entry role="catalog_table_entry"><para role="column_definition">
2129 <structfield>relkind</structfield> <type>char</type>
2130 </para>
2131 <para>
2132 <literal>r</literal> = ordinary table,
2133 <literal>i</literal> = index,
2134 <literal>S</literal> = sequence,
2135 <literal>t</literal> = TOAST table,
2136 <literal>v</literal> = view,
2137 <literal>m</literal> = materialized view,
2138 <literal>c</literal> = composite type,
2139 <literal>f</literal> = foreign table,
2140 <literal>p</literal> = partitioned table,
2141 <literal>I</literal> = partitioned index
2142 </para></entry>
2143 </row>
2144
2145 <row>
2146 <entry role="catalog_table_entry"><para role="column_definition">
2147 <structfield>relnatts</structfield> <type>int2</type>
2148 </para>
2149 <para>
2150 Number of user columns in the relation (system columns not
2151 counted). There must be this many corresponding entries in
2152 <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>. See also
2153 <structname>pg_attribute</structname>.<structfield>attnum</structfield>.
2154 </para></entry>
2155 </row>
2156
2157 <row>
2158 <entry role="catalog_table_entry"><para role="column_definition">
2159 <structfield>relchecks</structfield> <type>int2</type>
2160 </para>
2161 <para>
2162 Number of <literal>CHECK</literal> constraints on the table; see
2163 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
2164 </para></entry>
2165 </row>
2166
2167 <row>
2168 <entry role="catalog_table_entry"><para role="column_definition">
2169 <structfield>relhasrules</structfield> <type>bool</type>
2170 </para>
2171 <para>
2172 True if table has (or once had) rules; see
2173 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
2174 </para></entry>
2175 </row>
2176
2177 <row>
2178 <entry role="catalog_table_entry"><para role="column_definition">
2179 <structfield>relhastriggers</structfield> <type>bool</type>
2180 </para>
2181 <para>
2182 True if table has (or once had) triggers; see
2183 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
2184 </para></entry>
2185 </row>
2186
2187 <row>
2188 <entry role="catalog_table_entry"><para role="column_definition">
2189 <structfield>relhassubclass</structfield> <type>bool</type>
2190 </para>
2191 <para>
2192 True if table or index has (or once had) any inheritance children or partitions
2193 </para></entry>
2194 </row>
2195
2196 <row>
2197 <entry role="catalog_table_entry"><para role="column_definition">
2198 <structfield>relrowsecurity</structfield> <type>bool</type>
2199 </para>
2200 <para>
2201 True if table has row-level security enabled; see
2202 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
2203 </para></entry>
2204 </row>
2205
2206 <row>
2207 <entry role="catalog_table_entry"><para role="column_definition">
2208 <structfield>relforcerowsecurity</structfield> <type>bool</type>
2209 </para>
2210 <para>
2211 True if row-level security (when enabled) will also apply to table owner; see
2212 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
2213 </para></entry>
2214 </row>
2215
2216 <row>
2217 <entry role="catalog_table_entry"><para role="column_definition">
2218 <structfield>relispopulated</structfield> <type>bool</type>
2219 </para>
2220 <para>
2221 True if relation is populated (this is true for all
2222 relations other than some materialized views)
2223 </para></entry>
2224 </row>
2225
2226 <row>
2227 <entry role="catalog_table_entry"><para role="column_definition">
2228 <structfield>relreplident</structfield> <type>char</type>
2229 </para>
2230 <para>
2231 Columns used to form <quote>replica identity</quote> for rows:
2232 <literal>d</literal> = default (primary key, if any),
2233 <literal>n</literal> = nothing,
2234 <literal>f</literal> = all columns,
2235 <literal>i</literal> = index with
2236 <structfield>indisreplident</structfield> set (same as nothing if the
2237 index used has been dropped)
2238 </para></entry>
2239 </row>
2240
2241 <row>
2242 <entry role="catalog_table_entry"><para role="column_definition">
2243 <structfield>relispartition</structfield> <type>bool</type>
2244 </para>
2245 <para>
2246 True if table or index is a partition
2247 </para></entry>
2248 </row>
2249
2250 <row>
2251 <entry role="catalog_table_entry"><para role="column_definition">
2252 <structfield>relrewrite</structfield> <type>oid</type>
2253 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2254 </para>
2255 <para>
2256 For new relations being written during a DDL operation that requires a
2257 table rewrite, this contains the OID of the original relation;
2258 otherwise zero. That state is only visible internally; this field should
2259 never contain anything other than zero for a user-visible relation.
2260 </para></entry>
2261 </row>
2262
2263 <row>
2264 <entry role="catalog_table_entry"><para role="column_definition">
2265 <structfield>relfrozenxid</structfield> <type>xid</type>
2266 </para>
2267 <para>
2268 All transaction IDs before this one have been replaced with a permanent
2269 (<quote>frozen</quote>) transaction ID in this table. This is used to track
2270 whether the table needs to be vacuumed in order to prevent transaction
2271 ID wraparound or to allow <literal>pg_xact</literal> to be shrunk. Zero
2272 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2273 </para></entry>
2274 </row>
2275
2276 <row>
2277 <entry role="catalog_table_entry"><para role="column_definition">
2278 <structfield>relminmxid</structfield> <type>xid</type>
2279 </para>
2280 <para>
2281 All multixact IDs before this one have been replaced by a
2282 transaction ID in this table. This is used to track
2283 whether the table needs to be vacuumed in order to prevent multixact ID
2284 wraparound or to allow <literal>pg_multixact</literal> to be shrunk. Zero
2285 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
2286 </para></entry>
2287 </row>
2288
2289 <row>
2290 <entry role="catalog_table_entry"><para role="column_definition">
2291 <structfield>relacl</structfield> <type>aclitem[]</type>
2292 </para>
2293 <para>
2294 Access privileges; see <xref linkend="ddl-priv"/> for details
2295 </para></entry>
2296 </row>
2297
2298 <row>
2299 <entry role="catalog_table_entry"><para role="column_definition">
2300 <structfield>reloptions</structfield> <type>text[]</type>
2301 </para>
2302 <para>
2303 Access-method-specific options, as <quote>keyword=value</quote> strings
2304 </para></entry>
2305 </row>
2306
2307 <row>
2308 <entry role="catalog_table_entry"><para role="column_definition">
2309 <structfield>relpartbound</structfield> <type>pg_node_tree</type>
2310 </para>
2311 <para>
2312 If table is a partition (see <structfield>relispartition</structfield>),
2313 internal representation of the partition bound
2314 </para></entry>
2315 </row>
2316 </tbody>
2317 </tgroup>
2318 </table>
2319
2320 <para>
2321 Several of the Boolean flags in <structname>pg_class</structname> are maintained
2322 lazily: they are guaranteed to be true if that's the correct state, but
2323 may not be reset to false immediately when the condition is no longer
2324 true. For example, <structfield>relhasindex</structfield> is set by
2325 <link linkend="sql-createindex"><command>CREATE INDEX</command></link>, but it is never cleared by
2326 <link linkend="sql-dropindex"><command>DROP INDEX</command></link>. Instead, <link linkend="sql-vacuum"><command>VACUUM</command></link> clears
2327 <structfield>relhasindex</structfield> if it finds the table has no indexes. This
2328 arrangement avoids race conditions and improves concurrency.
2329 </para>
2330 </sect1>
2331
2332 <sect1 id="catalog-pg-collation">
2333 <title><structname>pg_collation</structname></title>
2334
2335 <indexterm zone="catalog-pg-collation">
2336 <primary>pg_collation</primary>
2337 </indexterm>
2338
2339 <para>
2340 The catalog <structname>pg_collation</structname> describes the
2341 available collations, which are essentially mappings from an SQL
2342 name to operating system locale categories.
2343 See <xref linkend="collation"/> for more information.
2344 </para>
2345
2346 <table>
2347 <title><structname>pg_collation</structname> Columns</title>
2348 <tgroup cols="1">
2349 <thead>
2350 <row>
2351 <entry role="catalog_table_entry"><para role="column_definition">
2352 Column Type
2353 </para>
2354 <para>
2355 Description
2356 </para></entry>
2357 </row>
2358 </thead>
2359
2360 <tbody>
2361 <row>
2362 <entry role="catalog_table_entry"><para role="column_definition">
2363 <structfield>oid</structfield> <type>oid</type>
2364 </para>
2365 <para>
2366 Row identifier
2367 </para></entry>
2368 </row>
2369
2370 <row>
2371 <entry role="catalog_table_entry"><para role="column_definition">
2372 <structfield>collname</structfield> <type>name</type>
2373 </para>
2374 <para>
2375 Collation name (unique per namespace and encoding)
2376 </para></entry>
2377 </row>
2378
2379 <row>
2380 <entry role="catalog_table_entry"><para role="column_definition">
2381 <structfield>collnamespace</structfield> <type>oid</type>
2382 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2383 </para>
2384 <para>
2385 The OID of the namespace that contains this collation
2386 </para></entry>
2387 </row>
2388
2389 <row>
2390 <entry role="catalog_table_entry"><para role="column_definition">
2391 <structfield>collowner</structfield> <type>oid</type>
2392 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2393 </para>
2394 <para>
2395 Owner of the collation
2396 </para></entry>
2397 </row>
2398
2399 <row>
2400 <entry role="catalog_table_entry"><para role="column_definition">
2401 <structfield>collprovider</structfield> <type>char</type>
2402 </para>
2403 <para>
2404 Provider of the collation: <literal>d</literal> = database default,
2405 <literal>b</literal> = builtin, <literal>c</literal> = libc,
2406 <literal>i</literal> = icu </para></entry>
2407 </row>
2408
2409 <row>
2410 <entry role="catalog_table_entry"><para role="column_definition">
2411 <structfield>collisdeterministic</structfield> <type>bool</type>
2412 </para>
2413 <para>
2414 Is the collation deterministic?
2415 </para></entry>
2416 </row>
2417
2418 <row>
2419 <entry role="catalog_table_entry"><para role="column_definition">
2420 <structfield>collencoding</structfield> <type>int4</type>
2421 </para>
2422 <para>
2423 Encoding in which the collation is applicable, or -1 if it
2424 works for any encoding
2425 </para></entry>
2426 </row>
2427
2428 <row>
2429 <entry role="catalog_table_entry"><para role="column_definition">
2430 <structfield>collcollate</structfield> <type>text</type>
2431 </para>
2432 <para>
2433 <symbol>LC_COLLATE</symbol> for this collation object. If the provider is
2434 not <literal>libc</literal>, <structfield>collcollate</structfield> is
2435 <literal>NULL</literal> and <structfield>colllocale</structfield> is
2436 used instead.
2437 </para></entry>
2438 </row>
2439
2440 <row>
2441 <entry role="catalog_table_entry"><para role="column_definition">
2442 <structfield>collctype</structfield> <type>text</type>
2443 </para>
2444 <para>
2445 <symbol>LC_CTYPE</symbol> for this collation object. If the provider is
2446 not <literal>libc</literal>, <structfield>collctype</structfield> is
2447 <literal>NULL</literal> and <structfield>colllocale</structfield> is
2448 used instead.
2449 </para></entry>
2450 </row>
2451
2452 <row>
2453 <entry role="catalog_table_entry"><para role="column_definition">
2454 <structfield>colllocale</structfield> <type>text</type>
2455 </para>
2456 <para>
2457 Collation provider locale name for this collation object. If the
2458 provider is <literal>libc</literal>,
2459 <structfield>colllocale</structfield> is <literal>NULL</literal>;
2460 <structfield>collcollate</structfield> and
2461 <structfield>collctype</structfield> are used instead.
2462 </para></entry>
2463 </row>
2464
2465 <row>
2466 <entry role="catalog_table_entry"><para role="column_definition">
2467 <structfield>collicurules</structfield> <type>text</type>
2468 </para>
2469 <para>
2470 ICU collation rules for this collation object
2471 </para></entry>
2472 </row>
2473
2474 <row>
2475 <entry role="catalog_table_entry"><para role="column_definition">
2476 <structfield>collversion</structfield> <type>text</type>
2477 </para>
2478 <para>
2479 Provider-specific version of the collation. This is recorded when the
2480 collation is created and then checked when it is used, to detect
2481 changes in the collation definition that could lead to data corruption.
2482 </para></entry>
2483 </row>
2484 </tbody>
2485 </tgroup>
2486 </table>
2487
2488 <para>
2489 Note that the unique key on this catalog is (<structfield>collname</structfield>,
2490 <structfield>collencoding</structfield>, <structfield>collnamespace</structfield>) not just
2491 (<structfield>collname</structfield>, <structfield>collnamespace</structfield>).
2492 <productname>PostgreSQL</productname> generally ignores all
2493 collations that do not have <structfield>collencoding</structfield> equal to
2494 either the current database's encoding or -1, and creation of new entries
2495 with the same name as an entry with <structfield>collencoding</structfield> = -1
2496 is forbidden. Therefore it is sufficient to use a qualified SQL name
2497 (<replaceable>schema</replaceable>.<replaceable>name</replaceable>) to identify a collation,
2498 even though this is not unique according to the catalog definition.
2499 The reason for defining the catalog this way is that
2500 <application>initdb</application> fills it in at cluster initialization time with
2501 entries for all locales available on the system, so it must be able to
2502 hold entries for all encodings that might ever be used in the cluster.
2503 </para>
2504
2505 <para>
2506 In the <literal>template0</literal> database, it could be useful to create
2507 collations whose encoding does not match the database encoding,
2508 since they could match the encodings of databases later cloned from
2509 <literal>template0</literal>. This would currently have to be done manually.
2510 </para>
2511 </sect1>
2512
2513 <sect1 id="catalog-pg-constraint">
2514 <title><structname>pg_constraint</structname></title>
2515
2516 <indexterm zone="catalog-pg-constraint">
2517 <primary>pg_constraint</primary>
2518 </indexterm>
2519
2520 <para>
2521 The catalog <structname>pg_constraint</structname> stores check, not-null,
2522 primary key, unique, foreign key, and exclusion constraints on tables.
2523 (Column constraints are not treated specially. Every column constraint is
2524 equivalent to some table constraint.)
2525 </para>
2526
2527 <para>
2528 User-defined constraint triggers (created with <link linkend="sql-createtrigger">
2529 <command>CREATE CONSTRAINT TRIGGER</command></link>) also give rise to an entry in this table.
2530 </para>
2531
2532 <para>
2533 Check constraints on domains are stored here, too.
2534 </para>
2535
2536 <table>
2537 <title><structname>pg_constraint</structname> Columns</title>
2538 <tgroup cols="1">
2539 <thead>
2540 <row>
2541 <entry role="catalog_table_entry"><para role="column_definition">
2542 Column Type
2543 </para>
2544 <para>
2545 Description
2546 </para></entry>
2547 </row>
2548 </thead>
2549
2550 <tbody>
2551 <row>
2552 <entry role="catalog_table_entry"><para role="column_definition">
2553 <structfield>oid</structfield> <type>oid</type>
2554 </para>
2555 <para>
2556 Row identifier
2557 </para></entry>
2558 </row>
2559
2560 <row>
2561 <entry role="catalog_table_entry"><para role="column_definition">
2562 <structfield>conname</structfield> <type>name</type>
2563 </para>
2564 <para>
2565 Constraint name (not necessarily unique!)
2566 </para></entry>
2567 </row>
2568
2569 <row>
2570 <entry role="catalog_table_entry"><para role="column_definition">
2571 <structfield>connamespace</structfield> <type>oid</type>
2572 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2573 </para>
2574 <para>
2575 The OID of the namespace that contains this constraint
2576 </para></entry>
2577 </row>
2578
2579 <row>
2580 <entry role="catalog_table_entry"><para role="column_definition">
2581 <structfield>contype</structfield> <type>char</type>
2582 </para>
2583 <para>
2584 <literal>c</literal> = check constraint,
2585 <literal>f</literal> = foreign key constraint,
2586 <literal>n</literal> = not-null constraint,
2587 <literal>p</literal> = primary key constraint,
2588 <literal>u</literal> = unique constraint,
2589 <literal>t</literal> = constraint trigger,
2590 <literal>x</literal> = exclusion constraint
2591 </para></entry>
2592 </row>
2593
2594 <row>
2595 <entry role="catalog_table_entry"><para role="column_definition">
2596 <structfield>condeferrable</structfield> <type>bool</type>
2597 </para>
2598 <para>
2599 Is the constraint deferrable?
2600 </para></entry>
2601 </row>
2602
2603 <row>
2604 <entry role="catalog_table_entry"><para role="column_definition">
2605 <structfield>condeferred</structfield> <type>bool</type>
2606 </para>
2607 <para>
2608 Is the constraint deferred by default?
2609 </para></entry>
2610 </row>
2611
2612 <row>
2613 <entry role="catalog_table_entry"><para role="column_definition">
2614 <structfield>conenforced</structfield> <type>bool</type>
2615 </para>
2616 <para>
2617 Is the constraint enforced?
2618 </para></entry>
2619 </row>
2620
2621 <row>
2622 <entry role="catalog_table_entry"><para role="column_definition">
2623 <structfield>convalidated</structfield> <type>bool</type>
2624 </para>
2625 <para>
2626 Has the constraint been validated?
2627 </para></entry>
2628 </row>
2629
2630 <row>
2631 <entry role="catalog_table_entry"><para role="column_definition">
2632 <structfield>conrelid</structfield> <type>oid</type>
2633 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2634 </para>
2635 <para>
2636 The table this constraint is on; zero if not a table constraint
2637 </para></entry>
2638 </row>
2639
2640 <row>
2641 <entry role="catalog_table_entry"><para role="column_definition">
2642 <structfield>contypid</structfield> <type>oid</type>
2643 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
2644 </para>
2645 <para>
2646 The domain this constraint is on; zero if not a domain constraint
2647 </para></entry>
2648 </row>
2649
2650 <row>
2651 <entry role="catalog_table_entry"><para role="column_definition">
2652 <structfield>conindid</structfield> <type>oid</type>
2653 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2654 </para>
2655 <para>
2656 The index supporting this constraint, if it's a unique, primary
2657 key, foreign key, or exclusion constraint; else zero
2658 </para></entry>
2659 </row>
2660
2661 <row>
2662 <entry role="catalog_table_entry"><para role="column_definition">
2663 <structfield>conparentid</structfield> <type>oid</type>
2664 (references <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.<structfield>oid</structfield>)
2665 </para>
2666 <para>
2667 The corresponding constraint of the parent partitioned table,
2668 if this is a constraint on a partition; else zero
2669 </para></entry>
2670 </row>
2671
2672 <row>
2673 <entry role="catalog_table_entry"><para role="column_definition">
2674 <structfield>confrelid</structfield> <type>oid</type>
2675 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2676 </para>
2677 <para>
2678 If a foreign key, the referenced table; else zero
2679 </para></entry>
2680 </row>
2681
2682 <row>
2683 <entry role="catalog_table_entry"><para role="column_definition">
2684 <structfield>confupdtype</structfield> <type>char</type>
2685 </para>
2686 <para>
2687 Foreign key update action code:
2688 <literal>a</literal> = no action,
2689 <literal>r</literal> = restrict,
2690 <literal>c</literal> = cascade,
2691 <literal>n</literal> = set null,
2692 <literal>d</literal> = set default
2693 </para></entry>
2694 </row>
2695
2696 <row>
2697 <entry role="catalog_table_entry"><para role="column_definition">
2698 <structfield>confdeltype</structfield> <type>char</type>
2699 </para>
2700 <para>
2701 Foreign key deletion action code:
2702 <literal>a</literal> = no action,
2703 <literal>r</literal> = restrict,
2704 <literal>c</literal> = cascade,
2705 <literal>n</literal> = set null,
2706 <literal>d</literal> = set default
2707 </para></entry>
2708 </row>
2709
2710 <row>
2711 <entry role="catalog_table_entry"><para role="column_definition">
2712 <structfield>confmatchtype</structfield> <type>char</type>
2713 </para>
2714 <para>
2715 Foreign key match type:
2716 <literal>f</literal> = full,
2717 <literal>p</literal> = partial,
2718 <literal>s</literal> = simple
2719 </para></entry>
2720 </row>
2721
2722 <row>
2723 <entry role="catalog_table_entry"><para role="column_definition">
2724 <structfield>conislocal</structfield> <type>bool</type>
2725 </para>
2726 <para>
2727 This constraint is defined locally for the relation. Note that a
2728 constraint can be locally defined and inherited simultaneously.
2729 </para></entry>
2730 </row>
2731
2732 <row>
2733 <entry role="catalog_table_entry"><para role="column_definition">
2734 <structfield>coninhcount</structfield> <type>int2</type>
2735 </para>
2736 <para>
2737 The number of direct inheritance ancestors this constraint has.
2738 A constraint with
2739 a nonzero number of ancestors cannot be dropped nor renamed.
2740 </para></entry>
2741 </row>
2742
2743 <row>
2744 <entry role="catalog_table_entry"><para role="column_definition">
2745 <structfield>connoinherit</structfield> <type>bool</type>
2746 </para>
2747 <para>
2748 This constraint is defined locally for the relation. It is a
2749 non-inheritable constraint.
2750 </para></entry>
2751 </row>
2752
2753 <row>
2754 <entry role="catalog_table_entry"><para role="column_definition">
2755 <structfield>conperiod</structfield> <type>bool</type>
2756 </para>
2757 <para>
2758 This constraint is defined with <literal>WITHOUT OVERLAPS</literal>
2759 (for primary keys and unique constraints) or <literal>PERIOD</literal>
2760 (for foreign keys).
2761 </para></entry>
2762 </row>
2763
2764 <row>
2765 <entry role="catalog_table_entry"><para role="column_definition">
2766 <structfield>conkey</structfield> <type>int2[]</type>
2767 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
2768 </para>
2769 <para>
2770 If a table constraint (including foreign keys, but not constraint
2771 triggers), list of the constrained columns
2772 </para></entry>
2773 </row>
2774
2775 <row>
2776 <entry role="catalog_table_entry"><para role="column_definition">
2777 <structfield>confkey</structfield> <type>int2[]</type>
2778 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
2779 </para>
2780 <para>
2781 If a foreign key, list of the referenced columns
2782 </para></entry>
2783 </row>
2784
2785 <row>
2786 <entry role="catalog_table_entry"><para role="column_definition">
2787 <structfield>conpfeqop</structfield> <type>oid[]</type>
2788 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2789 </para>
2790 <para>
2791 If a foreign key, list of the equality operators for PK = FK comparisons
2792 </para></entry>
2793 </row>
2794
2795 <row>
2796 <entry role="catalog_table_entry"><para role="column_definition">
2797 <structfield>conppeqop</structfield> <type>oid[]</type>
2798 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2799 </para>
2800 <para>
2801 If a foreign key, list of the equality operators for PK = PK comparisons
2802 </para></entry>
2803 </row>
2804
2805 <row>
2806 <entry role="catalog_table_entry"><para role="column_definition">
2807 <structfield>conffeqop</structfield> <type>oid[]</type>
2808 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2809 </para>
2810 <para>
2811 If a foreign key, list of the equality operators for FK = FK comparisons
2812 </para></entry>
2813 </row>
2814
2815 <row>
2816 <entry role="catalog_table_entry"><para role="column_definition">
2817 <structfield>confdelsetcols</structfield> <type>int2[]</type>
2818 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
2819 </para>
2820 <para>
2821 If a foreign key with a <literal>SET NULL</literal> or <literal>SET
2822 DEFAULT</literal> delete action, the columns that will be updated.
2823 If null, all of the referencing columns will be updated.
2824 </para></entry>
2825 </row>
2826
2827 <row>
2828 <entry role="catalog_table_entry"><para role="column_definition">
2829 <structfield>conexclop</structfield> <type>oid[]</type>
2830 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2831 </para>
2832 <para>
2833 If an exclusion constraint or <literal>WITHOUT OVERLAPS</literal>
2834 primary key/unique constraint, list of the per-column exclusion operators.
2835 </para></entry>
2836 </row>
2837
2838 <row>
2839 <entry role="catalog_table_entry"><para role="column_definition">
2840 <structfield>conbin</structfield> <type>pg_node_tree</type>
2841 </para>
2842 <para>
2843 If a check constraint, an internal representation of the
2844 expression. (It's recommended to use
2845 <function>pg_get_constraintdef()</function> to extract the definition of
2846 a check constraint.)
2847 </para></entry>
2848 </row>
2849 </tbody>
2850 </tgroup>
2851 </table>
2852
2853 <para>
2854 In the case of an exclusion constraint, <structfield>conkey</structfield>
2855 is only useful for constraint elements that are simple column references.
2856 For other cases, a zero appears in <structfield>conkey</structfield>
2857 and the associated index must be consulted to discover the expression
2858 that is constrained. (<structfield>conkey</structfield> thus has the
2859 same contents as <link linkend="catalog-pg-index"><structname>pg_index</structname></link>.<structfield>indkey</structfield> for the
2860 index.)
2861 </para>
2862
2863 <note>
2864 <para>
2865 <literal>pg_class.relchecks</literal> needs to agree with the
2866 number of check-constraint entries found in this table for each
2867 relation.
2868 </para>
2869 </note>
2870 </sect1>
2871
2872
2873 <sect1 id="catalog-pg-conversion">
2874 <title><structname>pg_conversion</structname></title>
2875
2876 <indexterm zone="catalog-pg-conversion">
2877 <primary>pg_conversion</primary>
2878 </indexterm>
2879
2880 <para>
2881 The catalog <structname>pg_conversion</structname> describes
2882 encoding conversion functions. See <xref linkend="sql-createconversion"/>
2883 for more information.
2884 </para>
2885
2886 <table>
2887 <title><structname>pg_conversion</structname> Columns</title>
2888 <tgroup cols="1">
2889 <thead>
2890 <row>
2891 <entry role="catalog_table_entry"><para role="column_definition">
2892 Column Type
2893 </para>
2894 <para>
2895 Description
2896 </para></entry>
2897 </row>
2898 </thead>
2899
2900 <tbody>
2901 <row>
2902 <entry role="catalog_table_entry"><para role="column_definition">
2903 <structfield>oid</structfield> <type>oid</type>
2904 </para>
2905 <para>
2906 Row identifier
2907 </para></entry>
2908 </row>
2909
2910 <row>
2911 <entry role="catalog_table_entry"><para role="column_definition">
2912 <structfield>conname</structfield> <type>name</type>
2913 </para>
2914 <para>
2915 Conversion name (unique within a namespace)
2916 </para></entry>
2917 </row>
2918
2919 <row>
2920 <entry role="catalog_table_entry"><para role="column_definition">
2921 <structfield>connamespace</structfield> <type>oid</type>
2922 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2923 </para>
2924 <para>
2925 The OID of the namespace that contains this conversion
2926 </para></entry>
2927 </row>
2928
2929 <row>
2930 <entry role="catalog_table_entry"><para role="column_definition">
2931 <structfield>conowner</structfield> <type>oid</type>
2932 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2933 </para>
2934 <para>
2935 Owner of the conversion
2936 </para></entry>
2937 </row>
2938
2939 <row>
2940 <entry role="catalog_table_entry"><para role="column_definition">
2941 <structfield>conforencoding</structfield> <type>int4</type>
2942 </para>
2943 <para>
2944 Source encoding ID (<link linkend="pg-encoding-to-char"><function>pg_encoding_to_char()</function></link>
2945 can translate this number to the encoding name)
2946 </para></entry>
2947 </row>
2948
2949 <row>
2950 <entry role="catalog_table_entry"><para role="column_definition">
2951 <structfield>contoencoding</structfield> <type>int4</type>
2952 </para>
2953 <para>
2954 Destination encoding ID (<link linkend="pg-encoding-to-char"><function>pg_encoding_to_char()</function></link>
2955 can translate this number to the encoding name)
2956 </para></entry>
2957 </row>
2958
2959 <row>
2960 <entry role="catalog_table_entry"><para role="column_definition">
2961 <structfield>conproc</structfield> <type>regproc</type>
2962 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
2963 </para>
2964 <para>
2965 Conversion function
2966 </para></entry>
2967 </row>
2968
2969 <row>
2970 <entry role="catalog_table_entry"><para role="column_definition">
2971 <structfield>condefault</structfield> <type>bool</type>
2972 </para>
2973 <para>
2974 True if this is the default conversion
2975 </para></entry>
2976 </row>
2977 </tbody>
2978 </tgroup>
2979 </table>
2980
2981 </sect1>
2982
2983 <sect1 id="catalog-pg-database">
2984 <title><structname>pg_database</structname></title>
2985
2986 <indexterm zone="catalog-pg-database">
2987 <primary>pg_database</primary>
2988 </indexterm>
2989
2990 <para>
2991 The catalog <structname>pg_database</structname> stores information about
2992 the available databases. Databases are created with the <link
2993 linkend="sql-createdatabase"><command>CREATE DATABASE</command></link> command.
2994 Consult <xref linkend="managing-databases"/> for details about the meaning
2995 of some of the parameters.
2996 </para>
2997
2998 <para>
2999 Unlike most system catalogs, <structname>pg_database</structname>
3000 is shared across all databases of a cluster: there is only one
3001 copy of <structname>pg_database</structname> per cluster, not
3002 one per database.
3003 </para>
3004
3005 <table>
3006 <title><structname>pg_database</structname> Columns</title>
3007 <tgroup cols="1">
3008 <thead>
3009 <row>
3010 <entry role="catalog_table_entry"><para role="column_definition">
3011 Column Type
3012 </para>
3013 <para>
3014 Description
3015 </para></entry>
3016 </row>
3017 </thead>
3018
3019 <tbody>
3020 <row>
3021 <entry role="catalog_table_entry"><para role="column_definition">
3022 <structfield>oid</structfield> <type>oid</type>
3023 </para>
3024 <para>
3025 Row identifier
3026 </para></entry>
3027 </row>
3028
3029 <row>
3030 <entry role="catalog_table_entry"><para role="column_definition">
3031 <structfield>datname</structfield> <type>name</type>
3032 </para>
3033 <para>
3034 Database name
3035 </para></entry>
3036 </row>
3037
3038 <row>
3039 <entry role="catalog_table_entry"><para role="column_definition">
3040 <structfield>datdba</structfield> <type>oid</type>
3041 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3042 </para>
3043 <para>
3044 Owner of the database, usually the user who created it
3045 </para></entry>
3046 </row>
3047
3048 <row>
3049 <entry role="catalog_table_entry"><para role="column_definition">
3050 <structfield>encoding</structfield> <type>int4</type>
3051 </para>
3052 <para>
3053 Character encoding for this database
3054 (<link linkend="pg-encoding-to-char"><function>pg_encoding_to_char()</function></link> can translate
3055 this number to the encoding name)
3056 </para></entry>
3057 </row>
3058
3059 <row>
3060 <entry role="catalog_table_entry"><para role="column_definition">
3061 <structfield>datlocprovider</structfield> <type>char</type>
3062 </para>
3063 <para>
3064 Locale provider for this database: <literal>b</literal> = builtin,
3065 <literal>c</literal> = libc, <literal>i</literal> = icu </para></entry>
3066 </row>
3067
3068 <row>
3069 <entry role="catalog_table_entry"><para role="column_definition">
3070 <structfield>datistemplate</structfield> <type>bool</type>
3071 </para>
3072 <para>
3073 If true, then this database can be cloned by
3074 any user with <literal>CREATEDB</literal> privileges;
3075 if false, then only superusers or the owner of
3076 the database can clone it.
3077 </para></entry>
3078 </row>
3079
3080 <row>
3081 <entry role="catalog_table_entry"><para role="column_definition">
3082 <structfield>datallowconn</structfield> <type>bool</type>
3083 </para>
3084 <para>
3085 If false then no one can connect to this database. This is
3086 used to protect the <literal>template0</literal> database from being altered.
3087 </para></entry>
3088 </row>
3089
3090 <row>
3091 <entry role="catalog_table_entry"><para role="column_definition">
3092 <structfield>dathasloginevt</structfield> <type>bool</type>
3093 </para>
3094 <para>
3095 Indicates that there are login event triggers defined for this database.
3096 This flag is used to avoid extra lookups on the
3097 <structname>pg_event_trigger</structname> table during each backend
3098 startup. This flag is used internally by <productname>PostgreSQL</productname>
3099 and should not be manually altered or read for monitoring purposes.
3100 </para></entry>
3101 </row>
3102
3103 <row>
3104 <entry role="catalog_table_entry"><para role="column_definition">
3105 <structfield>datconnlimit</structfield> <type>int4</type>
3106 </para>
3107 <para>
3108 Sets maximum number of concurrent connections that can be made
3109 to this database. -1 means no limit, -2 indicates the database is
3110 invalid.
3111 </para></entry>
3112 </row>
3113
3114 <row>
3115 <entry role="catalog_table_entry"><para role="column_definition">
3116 <structfield>datfrozenxid</structfield> <type>xid</type>
3117 </para>
3118 <para>
3119 All transaction IDs before this one have been replaced with a permanent
3120 (<quote>frozen</quote>) transaction ID in this database. This is used to
3121 track whether the database needs to be vacuumed in order to prevent
3122 transaction ID wraparound or to allow <literal>pg_xact</literal> to be shrunk.
3123 It is the minimum of the per-table
3124 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relfrozenxid</structfield> values.
3125 </para></entry>
3126 </row>
3127
3128 <row>
3129 <entry role="catalog_table_entry"><para role="column_definition">
3130 <structfield>datminmxid</structfield> <type>xid</type>
3131 </para>
3132 <para>
3133 All multixact IDs before this one have been replaced with a
3134 transaction ID in this database. This is used to
3135 track whether the database needs to be vacuumed in order to prevent
3136 multixact ID wraparound or to allow <literal>pg_multixact</literal> to be shrunk.
3137 It is the minimum of the per-table
3138 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relminmxid</structfield> values.
3139 </para></entry>
3140 </row>
3141
3142 <row>
3143 <entry role="catalog_table_entry"><para role="column_definition">
3144 <structfield>dattablespace</structfield> <type>oid</type>
3145 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>)
3146 </para>
3147 <para>
3148 The default tablespace for the database.
3149 Within this database, all tables for which
3150 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>reltablespace</structfield> is zero
3151 will be stored in this tablespace; in particular, all the non-shared
3152 system catalogs will be there.
3153 </para></entry>
3154 </row>
3155
3156 <row>
3157 <entry role="catalog_table_entry"><para role="column_definition">
3158 <structfield>datcollate</structfield> <type>text</type>
3159 </para>
3160 <para>
3161 LC_COLLATE for this database
3162 </para></entry>
3163 </row>
3164
3165 <row>
3166 <entry role="catalog_table_entry"><para role="column_definition">
3167 <structfield>datctype</structfield> <type>text</type>
3168 </para>
3169 <para>
3170 LC_CTYPE for this database
3171 </para></entry>
3172 </row>
3173
3174 <row>
3175 <entry role="catalog_table_entry"><para role="column_definition">
3176 <structfield>datlocale</structfield> <type>text</type>
3177 </para>
3178 <para>
3179 Collation provider locale name for this database. If the
3180 provider is <literal>libc</literal>,
3181 <structfield>datlocale</structfield> is <literal>NULL</literal>;
3182 <structfield>datcollate</structfield> and
3183 <structfield>datctype</structfield> are used instead.
3184 </para></entry>
3185 </row>
3186
3187 <row>
3188 <entry role="catalog_table_entry"><para role="column_definition">
3189 <structfield>daticurules</structfield> <type>text</type>
3190 </para>
3191 <para>
3192 ICU collation rules for this database
3193 </para></entry>
3194 </row>
3195
3196 <row>
3197 <entry role="catalog_table_entry"><para role="column_definition">
3198 <structfield>datcollversion</structfield> <type>text</type>
3199 </para>
3200 <para>
3201 Provider-specific version of the collation. This is recorded when the
3202 database is created and then checked when it is used, to detect
3203 changes in the collation definition that could lead to data corruption.
3204 </para></entry>
3205 </row>
3206
3207 <row>
3208 <entry role="catalog_table_entry"><para role="column_definition">
3209 <structfield>datacl</structfield> <type>aclitem[]</type>
3210 </para>
3211 <para>
3212 Access privileges; see <xref linkend="ddl-priv"/> for details
3213 </para></entry>
3214 </row>
3215 </tbody>
3216 </tgroup>
3217 </table>
3218 </sect1>
3219
3220
3221 <sect1 id="catalog-pg-db-role-setting">
3222 <title><structname>pg_db_role_setting</structname></title>
3223
3224 <indexterm zone="catalog-pg-db-role-setting">
3225 <primary>pg_db_role_setting</primary>
3226 </indexterm>
3227
3228 <para>
3229 The catalog <structname>pg_db_role_setting</structname> records the default
3230 values that have been set for run-time configuration variables,
3231 for each role and database combination.
3232 </para>
3233
3234 <para>
3235 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
3236 is shared across all databases of a cluster: there is only one
3237 copy of <structname>pg_db_role_setting</structname> per cluster, not
3238 one per database.
3239 </para>
3240
3241 <table>
3242 <title><structname>pg_db_role_setting</structname> Columns</title>
3243 <tgroup cols="1">
3244 <thead>
3245 <row>
3246 <entry role="catalog_table_entry"><para role="column_definition">
3247 Column Type
3248 </para>
3249 <para>
3250 Description
3251 </para></entry>
3252 </row>
3253 </thead>
3254
3255 <tbody>
3256 <row>
3257 <entry role="catalog_table_entry"><para role="column_definition">
3258 <structfield>setdatabase</structfield> <type>oid</type>
3259 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
3260 </para>
3261 <para>
3262 The OID of the database the setting is applicable to, or zero if not database-specific
3263 </para></entry>
3264 </row>
3265
3266 <row>
3267 <entry role="catalog_table_entry"><para role="column_definition">
3268 <structfield>setrole</structfield> <type>oid</type>
3269 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3270 </para>
3271 <para>
3272 The OID of the role the setting is applicable to, or zero if not role-specific
3273 </para></entry>
3274 </row>
3275
3276 <row>
3277 <entry role="catalog_table_entry"><para role="column_definition">
3278 <structfield>setconfig</structfield> <type>text[]</type>
3279 </para>
3280 <para>
3281 Defaults for run-time configuration variables
3282 </para></entry>
3283 </row>
3284 </tbody>
3285 </tgroup>
3286 </table>
3287 </sect1>
3288
3289
3290 <sect1 id="catalog-pg-default-acl">
3291 <title><structname>pg_default_acl</structname></title>
3292
3293 <indexterm zone="catalog-pg-default-acl">
3294 <primary>pg_default_acl</primary>
3295 </indexterm>
3296
3297 <para>
3298 The catalog <structname>pg_default_acl</structname> stores initial
3299 privileges to be assigned to newly created objects.
3300 </para>
3301
3302 <table>
3303 <title><structname>pg_default_acl</structname> Columns</title>
3304 <tgroup cols="1">
3305 <thead>
3306 <row>
3307 <entry role="catalog_table_entry"><para role="column_definition">
3308 Column Type
3309 </para>
3310 <para>
3311 Description
3312 </para></entry>
3313 </row>
3314 </thead>
3315
3316 <tbody>
3317 <row>
3318 <entry role="catalog_table_entry"><para role="column_definition">
3319 <structfield>oid</structfield> <type>oid</type>
3320 </para>
3321 <para>
3322 Row identifier
3323 </para></entry>
3324 </row>
3325
3326 <row>
3327 <entry role="catalog_table_entry"><para role="column_definition">
3328 <structfield>defaclrole</structfield> <type>oid</type>
3329 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3330 </para>
3331 <para>
3332 The OID of the role associated with this entry
3333 </para></entry>
3334 </row>
3335
3336 <row>
3337 <entry role="catalog_table_entry"><para role="column_definition">
3338 <structfield>defaclnamespace</structfield> <type>oid</type>
3339 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
3340 </para>
3341 <para>
3342 The OID of the namespace associated with this entry,
3343 or zero if none
3344 </para></entry>
3345 </row>
3346
3347 <row>
3348 <entry role="catalog_table_entry"><para role="column_definition">
3349 <structfield>defaclobjtype</structfield> <type>char</type>
3350 </para>
3351 <para>
3352 Type of object this entry is for:
3353 <literal>r</literal> = relation (table, view),
3354 <literal>S</literal> = sequence,
3355 <literal>f</literal> = function,
3356 <literal>T</literal> = type,
3357 <literal>n</literal> = schema,
3358 <literal>L</literal> = large object
3359 </para></entry>
3360 </row>
3361
3362 <row>
3363 <entry role="catalog_table_entry"><para role="column_definition">
3364 <structfield>defaclacl</structfield> <type>aclitem[]</type>
3365 </para>
3366 <para>
3367 Access privileges that this type of object should have on creation
3368 </para></entry>
3369 </row>
3370 </tbody>
3371 </tgroup>
3372 </table>
3373
3374 <para>
3375 A <structname>pg_default_acl</structname> entry shows the initial privileges to
3376 be assigned to an object belonging to the indicated user. There are
3377 currently two types of entry: <quote>global</quote> entries with
3378 <structfield>defaclnamespace</structfield> = zero, and <quote>per-schema</quote> entries
3379 that reference a particular schema. If a global entry is present then
3380 it <emphasis>overrides</emphasis> the normal hard-wired default privileges
3381 for the object type. A per-schema entry, if present, represents privileges
3382 to be <emphasis>added to</emphasis> the global or hard-wired default privileges.
3383 </para>
3384
3385 <para>
3386 Note that when an <acronym>ACL</acronym> entry in another catalog is null,
3387 it is taken to represent the hard-wired default privileges for its object,
3388 <emphasis>not</emphasis> whatever might be in <structname>pg_default_acl</structname>
3389 at the moment. <structname>pg_default_acl</structname> is only consulted during
3390 object creation.
3391 </para>
3392
3393 </sect1>
3394
3395
3396 <sect1 id="catalog-pg-depend">
3397 <title><structname>pg_depend</structname></title>
3398
3399 <indexterm zone="catalog-pg-depend">
3400 <primary>pg_depend</primary>
3401 </indexterm>
3402
3403 <para>
3404 The catalog <structname>pg_depend</structname> records the dependency
3405 relationships between database objects. This information allows
3406 <command>DROP</command> commands to find which other objects must be dropped
3407 by <command>DROP CASCADE</command> or prevent dropping in the <command>DROP
3408 RESTRICT</command> case.
3409 </para>
3410
3411 <para>
3412 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
3413 which performs a similar function for dependencies involving objects
3414 that are shared across a database cluster.
3415 </para>
3416
3417 <table>
3418 <title><structname>pg_depend</structname> Columns</title>
3419 <tgroup cols="1">
3420 <thead>
3421 <row>
3422 <entry role="catalog_table_entry"><para role="column_definition">
3423 Column Type
3424 </para>
3425 <para>
3426 Description
3427 </para></entry>
3428 </row>
3429 </thead>
3430
3431 <tbody>
3432 <row>
3433 <entry role="catalog_table_entry"><para role="column_definition">
3434 <structfield>classid</structfield> <type>oid</type>
3435 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3436 </para>
3437 <para>
3438 The OID of the system catalog the dependent object is in
3439 </para></entry>
3440 </row>
3441
3442 <row>
3443 <entry role="catalog_table_entry"><para role="column_definition">
3444 <structfield>objid</structfield> <type>oid</type>
3445 (references any OID column)
3446 </para>
3447 <para>
3448 The OID of the specific dependent object
3449 </para></entry>
3450 </row>
3451
3452 <row>
3453 <entry role="catalog_table_entry"><para role="column_definition">
3454 <structfield>objsubid</structfield> <type>int4</type>
3455 </para>
3456 <para>
3457 For a table column, this is the column number (the
3458 <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
3459 table itself). For all other object types, this column is
3460 zero.
3461 </para></entry>
3462 </row>
3463
3464 <row>
3465 <entry role="catalog_table_entry"><para role="column_definition">
3466 <structfield>refclassid</structfield> <type>oid</type>
3467 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3468 </para>
3469 <para>
3470 The OID of the system catalog the referenced object is in
3471 </para></entry>
3472 </row>
3473
3474 <row>
3475 <entry role="catalog_table_entry"><para role="column_definition">
3476 <structfield>refobjid</structfield> <type>oid</type>
3477 (references any OID column)
3478 </para>
3479 <para>
3480 The OID of the specific referenced object
3481 </para></entry>
3482 </row>
3483
3484 <row>
3485 <entry role="catalog_table_entry"><para role="column_definition">
3486 <structfield>refobjsubid</structfield> <type>int4</type>
3487 </para>
3488 <para>
3489 For a table column, this is the column number (the
3490 <structfield>refobjid</structfield> and <structfield>refclassid</structfield> refer
3491 to the table itself). For all other object types, this column
3492 is zero.
3493 </para></entry>
3494 </row>
3495
3496 <row>
3497 <entry role="catalog_table_entry"><para role="column_definition">
3498 <structfield>deptype</structfield> <type>char</type>
3499 </para>
3500 <para>
3501 A code defining the specific semantics of this dependency relationship; see text
3502 </para></entry>
3503 </row>
3504 </tbody>
3505 </tgroup>
3506 </table>
3507
3508 <para>
3509 In all cases, a <structname>pg_depend</structname> entry indicates that the
3510 referenced object cannot be dropped without also dropping the dependent
3511 object. However, there are several subflavors identified by
3512 <structfield>deptype</structfield>:
3513
3514 <variablelist>
3515 <varlistentry>
3516 <term><symbol>DEPENDENCY_NORMAL</symbol> (<literal>n</literal>)</term>
3517 <listitem>
3518 <para>
3519 A normal relationship between separately-created objects. The
3520 dependent object can be dropped without affecting the
3521 referenced object. The referenced object can only be dropped
3522 by specifying <literal>CASCADE</literal>, in which case the dependent
3523 object is dropped, too. Example: a table column has a normal
3524 dependency on its data type.
3525 </para>
3526 </listitem>
3527 </varlistentry>
3528
3529 <varlistentry>
3530 <term><symbol>DEPENDENCY_AUTO</symbol> (<literal>a</literal>)</term>
3531 <listitem>
3532 <para>
3533 The dependent object can be dropped separately from the
3534 referenced object, and should be automatically dropped
3535 (regardless of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
3536 mode) if the referenced object is dropped. Example: a named
3537 constraint on a table is made auto-dependent on the table, so
3538 that it will go away if the table is dropped.
3539 </para>
3540 </listitem>
3541 </varlistentry>
3542
3543 <varlistentry>
3544 <term><symbol>DEPENDENCY_INTERNAL</symbol> (<literal>i</literal>)</term>
3545 <listitem>
3546 <para>
3547 The dependent object was created as part of creation of the
3548 referenced object, and is really just a part of its internal
3549 implementation. A direct <command>DROP</command> of the dependent
3550 object will be disallowed outright (we'll tell the user to issue
3551 a <command>DROP</command> against the referenced object, instead).
3552 A <command>DROP</command> of the referenced object will result in
3553 automatically dropping the dependent object
3554 whether <literal>CASCADE</literal> is specified or not. If the
3555 dependent object has to be dropped due to a dependency on some other
3556 object being removed, its drop is converted to a drop of the referenced
3557 object, so that <literal>NORMAL</literal> and <literal>AUTO</literal>
3558 dependencies of the dependent object behave much like they were
3559 dependencies of the referenced object.
3560 Example: a view's <literal>ON SELECT</literal> rule is made
3561 internally dependent on the view, preventing it from being dropped
3562 while the view remains. Dependencies of the rule (such as tables it
3563 refers to) act as if they were dependencies of the view.
3564 </para>
3565 </listitem>
3566 </varlistentry>
3567
3568 <varlistentry>
3569 <term><symbol>DEPENDENCY_PARTITION_PRI</symbol> (<literal>P</literal>)</term>
3570 <term><symbol>DEPENDENCY_PARTITION_SEC</symbol> (<literal>S</literal>)</term>
3571 <listitem>
3572 <para>
3573 The dependent object was created as part of creation of the
3574 referenced object, and is really just a part of its internal
3575 implementation; however, unlike <literal>INTERNAL</literal>,
3576 there is more than one such referenced object. The dependent object
3577 must not be dropped unless at least one of these referenced objects
3578 is dropped; if any one is, the dependent object should be dropped
3579 whether or not <literal>CASCADE</literal> is specified. Also
3580 unlike <literal>INTERNAL</literal>, a drop of some other object
3581 that the dependent object depends on does not result in automatic
3582 deletion of any partition-referenced object. Hence, if the drop
3583 does not cascade to at least one of these objects via some other
3584 path, it will be refused. (In most cases, the dependent object
3585 shares all its non-partition dependencies with at least one
3586 partition-referenced object, so that this restriction does not
3587 result in blocking any cascaded delete.)
3588 Primary and secondary partition dependencies behave identically
3589 except that the primary dependency is preferred for use in error
3590 messages; hence, a partition-dependent object should have one
3591 primary partition dependency and one or more secondary partition
3592 dependencies.
3593 Note that partition dependencies are made in addition to, not
3594 instead of, any dependencies the object would normally have. This
3595 simplifies <command>ATTACH/DETACH PARTITION</command> operations:
3596 the partition dependencies need only be added or removed.
3597 Example: a child partitioned index is made partition-dependent
3598 on both the partition table it is on and the parent partitioned
3599 index, so that it goes away if either of those is dropped, but
3600 not otherwise. The dependency on the parent index is primary,
3601 so that if the user tries to drop the child partitioned index,
3602 the error message will suggest dropping the parent index instead
3603 (not the table).
3604 </para>
3605 </listitem>
3606 </varlistentry>
3607
3608 <varlistentry>
3609 <term><symbol>DEPENDENCY_EXTENSION</symbol> (<literal>e</literal>)</term>
3610 <listitem>
3611 <para>
3612 The dependent object is a member of the <firstterm>extension</firstterm> that is
3613 the referenced object (see
3614 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3615 The dependent object can be dropped only via
3616 <link linkend="sql-dropextension"><command>DROP EXTENSION</command></link> on the referenced object.
3617 Functionally this dependency type acts the same as
3618 an <literal>INTERNAL</literal> dependency, but it's kept separate for
3619 clarity and to simplify <application>pg_dump</application>.
3620 </para>
3621 </listitem>
3622 </varlistentry>
3623
3624 <varlistentry>
3625 <term><symbol>DEPENDENCY_AUTO_EXTENSION</symbol> (<literal>x</literal>)</term>
3626 <listitem>
3627 <para>
3628 The dependent object is not a member of the extension that is the
3629 referenced object (and so it should not be ignored
3630 by <application>pg_dump</application>), but it cannot function
3631 without the extension and should be auto-dropped if the extension is.
3632 The dependent object may be dropped on its own as well.
3633 Functionally this dependency type acts the same as
3634 an <literal>AUTO</literal> dependency, but it's kept separate for
3635 clarity and to simplify <application>pg_dump</application>.
3636 </para>
3637 </listitem>
3638 </varlistentry>
3639 </variablelist>
3640
3641 Other dependency flavors might be needed in future.
3642 </para>
3643
3644 <para>
3645 Note that it's quite possible for two objects to be linked by more than
3646 one <structname>pg_depend</structname> entry. For example, a child
3647 partitioned index would have both a partition-type dependency on its
3648 associated partition table, and an auto dependency on each column of
3649 that table that it indexes. This sort of situation expresses the union
3650 of multiple dependency semantics. A dependent object can be dropped
3651 without <literal>CASCADE</literal> if any of its dependencies satisfies
3652 its condition for automatic dropping. Conversely, all the
3653 dependencies' restrictions about which objects must be dropped together
3654 must be satisfied.
3655 </para>
3656
3657 <para>
3658 Most objects created during <application>initdb</application> are
3659 considered <quote>pinned</quote>, which means that the system itself
3660 depends on them. Therefore, they are never allowed to be dropped.
3661 Also, knowing that pinned objects will not be dropped, the dependency
3662 mechanism doesn't bother to make <structname>pg_depend</structname>
3663 entries showing dependencies on them. Thus, for example, a table
3664 column of type <type>numeric</type> notionally has
3665 a <literal>NORMAL</literal> dependency on the <type>numeric</type>
3666 data type, but no such entry actually appears
3667 in <structname>pg_depend</structname>.
3668 </para>
3669
3670 </sect1>
3671
3672
3673 <sect1 id="catalog-pg-description">
3674 <title><structname>pg_description</structname></title>
3675
3676 <indexterm zone="catalog-pg-description">
3677 <primary>pg_description</primary>
3678 </indexterm>
3679
3680 <para>
3681 The catalog <structname>pg_description</structname> stores optional descriptions
3682 (comments) for each database object. Descriptions can be manipulated
3683 with the <link linkend="sql-comment"><command>COMMENT</command></link> command and viewed with
3684 <application>psql</application>'s <literal>\d</literal> commands.
3685 Descriptions of many built-in system objects are provided in the initial
3686 contents of <structname>pg_description</structname>.
3687 </para>
3688
3689 <para>
3690 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3691 which performs a similar function for descriptions involving objects that
3692 are shared across a database cluster.
3693 </para>
3694
3695 <table>
3696 <title><structname>pg_description</structname> Columns</title>
3697 <tgroup cols="1">
3698 <thead>
3699 <row>
3700 <entry role="catalog_table_entry"><para role="column_definition">
3701 Column Type
3702 </para>
3703 <para>
3704 Description
3705 </para></entry>
3706 </row>
3707 </thead>
3708
3709 <tbody>
3710 <row>
3711 <entry role="catalog_table_entry"><para role="column_definition">
3712 <structfield>objoid</structfield> <type>oid</type>
3713 (references any OID column)
3714 </para>
3715 <para>
3716 The OID of the object this description pertains to
3717 </para></entry>
3718 </row>
3719
3720 <row>
3721 <entry role="catalog_table_entry"><para role="column_definition">
3722 <structfield>classoid</structfield> <type>oid</type>
3723 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3724 </para>
3725 <para>
3726 The OID of the system catalog this object appears in
3727 </para></entry>
3728 </row>
3729
3730 <row>
3731 <entry role="catalog_table_entry"><para role="column_definition">
3732 <structfield>objsubid</structfield> <type>int4</type>
3733 </para>
3734 <para>
3735 For a comment on a table column, this is the column number (the
3736 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
3737 the table itself). For all other object types, this column is
3738 zero.
3739 </para></entry>
3740 </row>
3741
3742 <row>
3743 <entry role="catalog_table_entry"><para role="column_definition">
3744 <structfield>description</structfield> <type>text</type>
3745 </para>
3746 <para>
3747 Arbitrary text that serves as the description of this object
3748 </para></entry>
3749 </row>
3750 </tbody>
3751 </tgroup>
3752 </table>
3753
3754 </sect1>
3755
3756
3757 <sect1 id="catalog-pg-enum">
3758 <title><structname>pg_enum</structname></title>
3759
3760 <indexterm zone="catalog-pg-enum">
3761 <primary>pg_enum</primary>
3762 </indexterm>
3763
3764 <para>
3765 The <structname>pg_enum</structname> catalog contains entries
3766 showing the values and labels for each enum type. The
3767 internal representation of a given enum value is actually the OID
3768 of its associated row in <structname>pg_enum</structname>.
3769 </para>
3770
3771 <table>
3772 <title><structname>pg_enum</structname> Columns</title>
3773 <tgroup cols="1">
3774 <thead>
3775 <row>
3776 <entry role="catalog_table_entry"><para role="column_definition">
3777 Column Type
3778 </para>
3779 <para>
3780 Description
3781 </para></entry>
3782 </row>
3783 </thead>
3784
3785 <tbody>
3786 <row>
3787 <entry role="catalog_table_entry"><para role="column_definition">
3788 <structfield>oid</structfield> <type>oid</type>
3789 </para>
3790 <para>
3791 Row identifier
3792 </para></entry>
3793 </row>
3794
3795 <row>
3796 <entry role="catalog_table_entry"><para role="column_definition">
3797 <structfield>enumtypid</structfield> <type>oid</type>
3798 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
3799 </para>
3800 <para>
3801 The OID of the <link linkend="catalog-pg-type"><structname>pg_type</structname></link> entry owning this enum value
3802 </para></entry>
3803 </row>
3804
3805 <row>
3806 <entry role="catalog_table_entry"><para role="column_definition">
3807 <structfield>enumsortorder</structfield> <type>float4</type>
3808 </para>
3809 <para>
3810 The sort position of this enum value within its enum type
3811 </para></entry>
3812 </row>
3813
3814 <row>
3815 <entry role="catalog_table_entry"><para role="column_definition">
3816 <structfield>enumlabel</structfield> <type>name</type>
3817 </para>
3818 <para>
3819 The textual label for this enum value
3820 </para></entry>
3821 </row>
3822 </tbody>
3823 </tgroup>
3824 </table>
3825
3826 <para>
3827 The OIDs for <structname>pg_enum</structname> rows follow a special
3828 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3829 as the sort ordering of their enum type. That is, if two even OIDs
3830 belong to the same enum type, the smaller OID must have the smaller
3831 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3832 need bear no relationship to the sort order. This rule allows the
3833 enum comparison routines to avoid catalog lookups in many common cases.
3834 The routines that create and alter enum types attempt to assign even
3835 OIDs to enum values whenever possible.
3836 </para>
3837
3838 <para>
3839 When an enum type is created, its members are assigned sort-order
3840 positions 1..<replaceable>n</replaceable>. But members added later might be given
3841 negative or fractional values of <structfield>enumsortorder</structfield>.
3842 The only requirement on these values is that they be correctly
3843 ordered and unique within each enum type.
3844 </para>
3845 </sect1>
3846
3847
3848 <sect1 id="catalog-pg-event-trigger">
3849 <title><structname>pg_event_trigger</structname></title>
3850
3851 <indexterm zone="catalog-pg-event-trigger">
3852 <primary>pg_event_trigger</primary>
3853 </indexterm>
3854
3855 <para>
3856 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3857 See <xref linkend="event-triggers"/> for more information.
3858 </para>
3859
3860 <table>
3861 <title><structname>pg_event_trigger</structname> Columns</title>
3862 <tgroup cols="1">
3863 <thead>
3864 <row>
3865 <entry role="catalog_table_entry"><para role="column_definition">
3866 Column Type
3867 </para>
3868 <para>
3869 Description
3870 </para></entry>
3871 </row>
3872 </thead>
3873
3874 <tbody>
3875 <row>
3876 <entry role="catalog_table_entry"><para role="column_definition">
3877 <structfield>oid</structfield> <type>oid</type>
3878 </para>
3879 <para>
3880 Row identifier
3881 </para></entry>
3882 </row>
3883
3884 <row>
3885 <entry role="catalog_table_entry"><para role="column_definition">
3886 <structfield>evtname</structfield> <type>name</type>
3887 </para>
3888 <para>
3889 Trigger name (must be unique)
3890 </para></entry>
3891 </row>
3892
3893 <row>
3894 <entry role="catalog_table_entry"><para role="column_definition">
3895 <structfield>evtevent</structfield> <type>name</type>
3896 </para>
3897 <para>
3898 Identifies the event for which this trigger fires
3899 </para></entry>
3900 </row>
3901
3902 <row>
3903 <entry role="catalog_table_entry"><para role="column_definition">
3904 <structfield>evtowner</structfield> <type>oid</type>
3905 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3906 </para>
3907 <para>
3908 Owner of the event trigger
3909 </para></entry>
3910 </row>
3911
3912 <row>
3913 <entry role="catalog_table_entry"><para role="column_definition">
3914 <structfield>evtfoid</structfield> <type>oid</type>
3915 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
3916 </para>
3917 <para>
3918 The function to be called
3919 </para></entry>
3920 </row>
3921
3922 <row>
3923 <entry role="catalog_table_entry"><para role="column_definition">
3924 <structfield>evtenabled</structfield> <type>char</type>
3925 </para>
3926 <para>
3927 Controls in which <xref linkend="guc-session-replication-role"/> modes
3928 the event trigger fires.
3929 <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
3930 <literal>D</literal> = trigger is disabled,
3931 <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
3932 <literal>A</literal> = trigger fires always.
3933 </para></entry>
3934 </row>
3935
3936 <row>
3937 <entry role="catalog_table_entry"><para role="column_definition">
3938 <structfield>evttags</structfield> <type>text[]</type>
3939 </para>
3940 <para>
3941 Command tags for which this trigger will fire. If NULL, the firing
3942 of this trigger is not restricted on the basis of the command tag.
3943 </para></entry>
3944 </row>
3945 </tbody>
3946 </tgroup>
3947 </table>
3948 </sect1>
3949
3950
3951 <sect1 id="catalog-pg-extension">
3952 <title><structname>pg_extension</structname></title>
3953
3954 <indexterm zone="catalog-pg-extension">
3955 <primary>pg_extension</primary>
3956 </indexterm>
3957
3958 <para>
3959 The catalog <structname>pg_extension</structname> stores information
3960 about the installed extensions. See <xref linkend="extend-extensions"/>
3961 for details about extensions.
3962 </para>
3963
3964 <table>
3965 <title><structname>pg_extension</structname> Columns</title>
3966 <tgroup cols="1">
3967 <thead>
3968 <row>
3969 <entry role="catalog_table_entry"><para role="column_definition">
3970 Column Type
3971 </para>
3972 <para>
3973 Description
3974 </para></entry>
3975 </row>
3976 </thead>
3977
3978 <tbody>
3979 <row>
3980 <entry role="catalog_table_entry"><para role="column_definition">
3981 <structfield>oid</structfield> <type>oid</type>
3982 </para>
3983 <para>
3984 Row identifier
3985 </para></entry>
3986 </row>
3987
3988 <row>
3989 <entry role="catalog_table_entry"><para role="column_definition">
3990 <structfield>extname</structfield> <type>name</type>
3991 </para>
3992 <para>
3993 Name of the extension
3994 </para></entry>
3995 </row>
3996
3997 <row>
3998 <entry role="catalog_table_entry"><para role="column_definition">
3999 <structfield>extowner</structfield> <type>oid</type>
4000 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4001 </para>
4002 <para>
4003 Owner of the extension
4004 </para></entry>
4005 </row>
4006
4007 <row>
4008 <entry role="catalog_table_entry"><para role="column_definition">
4009 <structfield>extnamespace</structfield> <type>oid</type>
4010 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
4011 </para>
4012 <para>
4013 Schema containing the extension's exported objects
4014 </para></entry>
4015 </row>
4016
4017 <row>
4018 <entry role="catalog_table_entry"><para role="column_definition">
4019 <structfield>extrelocatable</structfield> <type>bool</type>
4020 </para>
4021 <para>
4022 True if extension can be relocated to another schema
4023 </para></entry>
4024 </row>
4025
4026 <row>
4027 <entry role="catalog_table_entry"><para role="column_definition">
4028 <structfield>extversion</structfield> <type>text</type>
4029 </para>
4030 <para>
4031 Version name for the extension
4032 </para></entry>
4033 </row>
4034
4035 <row>
4036 <entry role="catalog_table_entry"><para role="column_definition">
4037 <structfield>extconfig</structfield> <type>oid[]</type>
4038 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4039 </para>
4040 <para>
4041 Array of <type>regclass</type> OIDs for the extension's configuration
4042 table(s), or <literal>NULL</literal> if none
4043 </para></entry>
4044 </row>
4045
4046 <row>
4047 <entry role="catalog_table_entry"><para role="column_definition">
4048 <structfield>extcondition</structfield> <type>text[]</type>
4049 </para>
4050 <para>
4051 Array of <literal>WHERE</literal>-clause filter conditions for the
4052 extension's configuration table(s), or <literal>NULL</literal> if none
4053 </para></entry>
4054 </row>
4055 </tbody>
4056 </tgroup>
4057 </table>
4058
4059 <para>
4060 Note that unlike most catalogs with a <quote>namespace</quote> column,
4061 <structfield>extnamespace</structfield> is not meant to imply
4062 that the extension belongs to that schema. Extension names are never
4063 schema-qualified. Rather, <structfield>extnamespace</structfield>
4064 indicates the schema that contains most or all of the extension's
4065 objects. If <structfield>extrelocatable</structfield> is true, then
4066 this schema must in fact contain all schema-qualifiable objects
4067 belonging to the extension.
4068 </para>
4069 </sect1>
4070
4071
4072 <sect1 id="catalog-pg-foreign-data-wrapper">
4073 <title><structname>pg_foreign_data_wrapper</structname></title>
4074
4075 <indexterm zone="catalog-pg-foreign-data-wrapper">
4076 <primary>pg_foreign_data_wrapper</primary>
4077 </indexterm>
4078
4079 <para>
4080 The catalog <structname>pg_foreign_data_wrapper</structname> stores
4081 foreign-data wrapper definitions. A foreign-data wrapper is the
4082 mechanism by which external data, residing on foreign servers, is
4083 accessed.
4084 </para>
4085
4086 <table>
4087 <title><structname>pg_foreign_data_wrapper</structname> Columns</title>
4088 <tgroup cols="1">
4089 <thead>
4090 <row>
4091 <entry role="catalog_table_entry"><para role="column_definition">
4092 Column Type
4093 </para>
4094 <para>
4095 Description
4096 </para></entry>
4097 </row>
4098 </thead>
4099
4100 <tbody>
4101 <row>
4102 <entry role="catalog_table_entry"><para role="column_definition">
4103 <structfield>oid</structfield> <type>oid</type>
4104 </para>
4105 <para>
4106 Row identifier
4107 </para></entry>
4108 </row>
4109
4110 <row>
4111 <entry role="catalog_table_entry"><para role="column_definition">
4112 <structfield>fdwname</structfield> <type>name</type>
4113 </para>
4114 <para>
4115 Name of the foreign-data wrapper
4116 </para></entry>
4117 </row>
4118
4119 <row>
4120 <entry role="catalog_table_entry"><para role="column_definition">
4121 <structfield>fdwowner</structfield> <type>oid</type>
4122 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4123 </para>
4124 <para>
4125 Owner of the foreign-data wrapper
4126 </para></entry>
4127 </row>
4128
4129 <row>
4130 <entry role="catalog_table_entry"><para role="column_definition">
4131 <structfield>fdwhandler</structfield> <type>oid</type>
4132 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4133 </para>
4134 <para>
4135 References a handler function that is responsible for
4136 supplying execution routines for the foreign-data wrapper.
4137 Zero if no handler is provided
4138 </para></entry>
4139 </row>
4140
4141 <row>
4142 <entry role="catalog_table_entry"><para role="column_definition">
4143 <structfield>fdwvalidator</structfield> <type>oid</type>
4144 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4145 </para>
4146 <para>
4147 References a validator function that is responsible for
4148 checking the validity of the options given to the
4149 foreign-data wrapper, as well as options for foreign servers and user
4150 mappings using the foreign-data wrapper. Zero if no validator
4151 is provided
4152 </para></entry>
4153 </row>
4154
4155 <row>
4156 <entry role="catalog_table_entry"><para role="column_definition">
4157 <structfield>fdwacl</structfield> <type>aclitem[]</type>
4158 </para>
4159 <para>
4160 Access privileges; see <xref linkend="ddl-priv"/> for details
4161 </para></entry>
4162 </row>
4163
4164 <row>
4165 <entry role="catalog_table_entry"><para role="column_definition">
4166 <structfield>fdwoptions</structfield> <type>text[]</type>
4167 </para>
4168 <para>
4169 Foreign-data wrapper specific options, as <quote>keyword=value</quote> strings
4170 </para></entry>
4171 </row>
4172 </tbody>
4173 </tgroup>
4174 </table>
4175 </sect1>
4176
4177
4178 <sect1 id="catalog-pg-foreign-server">
4179 <title><structname>pg_foreign_server</structname></title>
4180
4181 <indexterm zone="catalog-pg-foreign-server">
4182 <primary>pg_foreign_server</primary>
4183 </indexterm>
4184
4185 <para>
4186 The catalog <structname>pg_foreign_server</structname> stores
4187 foreign server definitions. A foreign server describes a source
4188 of external data, such as a remote server. Foreign
4189 servers are accessed via foreign-data wrappers.
4190 </para>
4191
4192 <table>
4193 <title><structname>pg_foreign_server</structname> Columns</title>
4194 <tgroup cols="1">
4195 <thead>
4196 <row>
4197 <entry role="catalog_table_entry"><para role="column_definition">
4198 Column Type
4199 </para>
4200 <para>
4201 Description
4202 </para></entry>
4203 </row>
4204 </thead>
4205
4206 <tbody>
4207 <row>
4208 <entry role="catalog_table_entry"><para role="column_definition">
4209 <structfield>oid</structfield> <type>oid</type>
4210 </para>
4211 <para>
4212 Row identifier
4213 </para></entry>
4214 </row>
4215
4216 <row>
4217 <entry role="catalog_table_entry"><para role="column_definition">
4218 <structfield>srvname</structfield> <type>name</type>
4219 </para>
4220 <para>
4221 Name of the foreign server
4222 </para></entry>
4223 </row>
4224
4225 <row>
4226 <entry role="catalog_table_entry"><para role="column_definition">
4227 <structfield>srvowner</structfield> <type>oid</type>
4228 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4229 </para>
4230 <para>
4231 Owner of the foreign server
4232 </para></entry>
4233 </row>
4234
4235 <row>
4236 <entry role="catalog_table_entry"><para role="column_definition">
4237 <structfield>srvfdw</structfield> <type>oid</type>
4238 (references <link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.<structfield>oid</structfield>)
4239 </para>
4240 <para>
4241 OID of the foreign-data wrapper of this foreign server
4242 </para></entry>
4243 </row>
4244
4245 <row>
4246 <entry role="catalog_table_entry"><para role="column_definition">
4247 <structfield>srvtype</structfield> <type>text</type>
4248 </para>
4249 <para>
4250 Type of the server (optional)
4251 </para></entry>
4252 </row>
4253
4254 <row>
4255 <entry role="catalog_table_entry"><para role="column_definition">
4256 <structfield>srvversion</structfield> <type>text</type>
4257 </para>
4258 <para>
4259 Version of the server (optional)
4260 </para></entry>
4261 </row>
4262
4263 <row>
4264 <entry role="catalog_table_entry"><para role="column_definition">
4265 <structfield>srvacl</structfield> <type>aclitem[]</type>
4266 </para>
4267 <para>
4268 Access privileges; see <xref linkend="ddl-priv"/> for details
4269 </para></entry>
4270 </row>
4271
4272 <row>
4273 <entry role="catalog_table_entry"><para role="column_definition">
4274 <structfield>srvoptions</structfield> <type>text[]</type>
4275 </para>
4276 <para>
4277 Foreign server specific options, as <quote>keyword=value</quote> strings
4278 </para></entry>
4279 </row>
4280 </tbody>
4281 </tgroup>
4282 </table>
4283 </sect1>
4284
4285
4286 <sect1 id="catalog-pg-foreign-table">
4287 <title><structname>pg_foreign_table</structname></title>
4288
4289 <indexterm zone="catalog-pg-foreign-table">
4290 <primary>pg_foreign_table</primary>
4291 </indexterm>
4292
4293 <para>
4294 The catalog <structname>pg_foreign_table</structname> contains
4295 auxiliary information about foreign tables. A foreign table is
4296 primarily represented by a
4297 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>
4298 entry, just like a regular table. Its <structname>pg_foreign_table</structname>
4299 entry contains the information that is pertinent only to foreign tables
4300 and not any other kind of relation.
4301 </para>
4302
4303 <table>
4304 <title><structname>pg_foreign_table</structname> Columns</title>
4305 <tgroup cols="1">
4306 <thead>
4307 <row>
4308 <entry role="catalog_table_entry"><para role="column_definition">
4309 Column Type
4310 </para>
4311 <para>
4312 Description
4313 </para></entry>
4314 </row>
4315 </thead>
4316
4317 <tbody>
4318 <row>
4319 <entry role="catalog_table_entry"><para role="column_definition">
4320 <structfield>ftrelid</structfield> <type>oid</type>
4321 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4322 </para>
4323 <para>
4324 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this foreign table
4325 </para></entry>
4326 </row>
4327
4328 <row>
4329 <entry role="catalog_table_entry"><para role="column_definition">
4330 <structfield>ftserver</structfield> <type>oid</type>
4331 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
4332 </para>
4333 <para>
4334 OID of the foreign server for this foreign table
4335 </para></entry>
4336 </row>
4337
4338 <row>
4339 <entry role="catalog_table_entry"><para role="column_definition">
4340 <structfield>ftoptions</structfield> <type>text[]</type>
4341 </para>
4342 <para>
4343 Foreign table options, as <quote>keyword=value</quote> strings
4344 </para></entry>
4345 </row>
4346 </tbody>
4347 </tgroup>
4348 </table>
4349 </sect1>
4350
4351
4352 <sect1 id="catalog-pg-index">
4353 <title><structname>pg_index</structname></title>
4354
4355 <indexterm zone="catalog-pg-index">
4356 <primary>pg_index</primary>
4357 </indexterm>
4358
4359 <para>
4360 The catalog <structname>pg_index</structname> contains part of the information
4361 about indexes. The rest is mostly in
4362 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.
4363 </para>
4364
4365 <table>
4366 <title><structname>pg_index</structname> Columns</title>
4367 <tgroup cols="1">
4368 <thead>
4369 <row>
4370 <entry role="catalog_table_entry"><para role="column_definition">
4371 Column Type
4372 </para>
4373 <para>
4374 Description
4375 </para></entry>
4376 </row>
4377 </thead>
4378
4379 <tbody>
4380 <row>
4381 <entry role="catalog_table_entry"><para role="column_definition">
4382 <structfield>indexrelid</structfield> <type>oid</type>
4383 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4384 </para>
4385 <para>
4386 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this index
4387 </para></entry>
4388 </row>
4389
4390 <row>
4391 <entry role="catalog_table_entry"><para role="column_definition">
4392 <structfield>indrelid</structfield> <type>oid</type>
4393 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4394 </para>
4395 <para>
4396 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for the table this index is for
4397 </para></entry>
4398 </row>
4399
4400 <row>
4401 <entry role="catalog_table_entry"><para role="column_definition">
4402 <structfield>indnatts</structfield> <type>int2</type>
4403 </para>
4404 <para>
4405 The total number of columns in the index (duplicates
4406 <literal>pg_class.relnatts</literal>); this number includes both key and included attributes
4407 </para></entry>
4408 </row>
4409
4410 <row>
4411 <entry role="catalog_table_entry"><para role="column_definition">
4412 <structfield>indnkeyatts</structfield> <type>int2</type>
4413 </para>
4414 <para>
4415 The number of <firstterm>key columns</firstterm> in the index,
4416 not counting any <firstterm>included columns</firstterm>, which are
4417 merely stored and do not participate in the index semantics
4418 </para></entry>
4419 </row>
4420
4421 <row>
4422 <entry role="catalog_table_entry"><para role="column_definition">
4423 <structfield>indisunique</structfield> <type>bool</type>
4424 </para>
4425 <para>
4426 If true, this is a unique index
4427 </para></entry>
4428 </row>
4429
4430 <row>
4431 <entry role="catalog_table_entry"><para role="column_definition">
4432 <structfield>indnullsnotdistinct</structfield> <type>bool</type>
4433 </para>
4434 <para>
4435 This value is only used for unique indexes. If false, this unique
4436 index will consider null values distinct (so the index can contain
4437 multiple null values in a column, the default PostgreSQL behavior). If
4438 it is true, it will consider null values to be equal (so the index can
4439 only contain one null value in a column).
4440 </para></entry>
4441 </row>
4442
4443 <row>
4444 <entry role="catalog_table_entry"><para role="column_definition">
4445 <structfield>indisprimary</structfield> <type>bool</type>
4446 </para>
4447 <para>
4448 If true, this index represents the primary key of the table
4449 (<structfield>indisunique</structfield> should always be true when this is true)
4450 </para></entry>
4451 </row>
4452
4453 <row>
4454 <entry role="catalog_table_entry"><para role="column_definition">
4455 <structfield>indisexclusion</structfield> <type>bool</type>
4456 </para>
4457 <para>
4458 If true, this index supports an exclusion constraint
4459 </para></entry>
4460 </row>
4461
4462 <row>
4463 <entry role="catalog_table_entry"><para role="column_definition">
4464 <structfield>indimmediate</structfield> <type>bool</type>
4465 </para>
4466 <para>
4467 If true, the uniqueness check is enforced immediately on
4468 insertion
4469 (irrelevant if <structfield>indisunique</structfield> is not true)
4470 </para></entry>
4471 </row>
4472
4473 <row>
4474 <entry role="catalog_table_entry"><para role="column_definition">
4475 <structfield>indisclustered</structfield> <type>bool</type>
4476 </para>
4477 <para>
4478 If true, the table was last clustered on this index
4479 </para></entry>
4480 </row>
4481
4482 <row>
4483 <entry role="catalog_table_entry"><para role="column_definition">
4484 <structfield>indisvalid</structfield> <type>bool</type>
4485 </para>
4486 <para>
4487 If true, the index is currently valid for queries. False means the
4488 index is possibly incomplete: it must still be modified by
4489 <link linkend="sql-insert"><command>INSERT</command></link>/<link linkend="sql-update"><command>UPDATE</command></link> operations, but it cannot safely
4490 be used for queries. If it is unique, the uniqueness property is not
4491 guaranteed true either.
4492 </para></entry>
4493 </row>
4494
4495 <row>
4496 <entry role="catalog_table_entry"><para role="column_definition">
4497 <structfield>indcheckxmin</structfield> <type>bool</type>
4498 </para>
4499 <para>
4500 If true, queries must not use the index until the <structfield>xmin</structfield>
4501 of this <structname>pg_index</structname> row is below their <symbol>TransactionXmin</symbol>
4502 event horizon, because the table may contain broken <link linkend="storage-hot">HOT chains</link> with
4503 incompatible rows that they can see
4504 </para></entry>
4505 </row>
4506
4507 <row>
4508 <entry role="catalog_table_entry"><para role="column_definition">
4509 <structfield>indisready</structfield> <type>bool</type>
4510 </para>
4511 <para>
4512 If true, the index is currently ready for inserts. False means the
4513 index must be ignored by <link linkend="sql-insert"><command>INSERT</command></link>/<link linkend="sql-update"><command>UPDATE</command></link>
4514 operations.
4515 </para></entry>
4516 </row>
4517
4518 <row>
4519 <entry role="catalog_table_entry"><para role="column_definition">
4520 <structfield>indislive</structfield> <type>bool</type>
4521 </para>
4522 <para>
4523 If false, the index is in process of being dropped, and should be
4524 ignored for all purposes (including HOT-safety decisions)
4525 </para></entry>
4526 </row>
4527
4528 <row>
4529 <entry role="catalog_table_entry"><para role="column_definition">
4530 <structfield>indisreplident</structfield> <type>bool</type>
4531 </para>
4532 <para>
4533 If true this index has been chosen as <quote>replica identity</quote>
4534 using <link linkend="sql-altertable-replica-identity"><command>ALTER TABLE ...
4535 REPLICA IDENTITY USING INDEX ...</command></link>
4536 </para></entry>
4537 </row>
4538
4539 <row>
4540 <entry role="catalog_table_entry"><para role="column_definition">
4541 <structfield>indkey</structfield> <type>int2vector</type>
4542 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
4543 </para>
4544 <para>
4545 This is an array of <structfield>indnatts</structfield> values that
4546 indicate which table columns this index indexes. For example, a value
4547 of <literal>1 3</literal> would mean that the first and the third table
4548 columns make up the index entries. Key columns come before non-key
4549 (included) columns. A zero in this array indicates that the
4550 corresponding index attribute is an expression over the table columns,
4551 rather than a simple column reference.
4552 </para></entry>
4553 </row>
4554
4555 <row>
4556 <entry role="catalog_table_entry"><para role="column_definition">
4557 <structfield>indcollation</structfield> <type>oidvector</type>
4558 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
4559 </para>
4560 <para>
4561 For each column in the index key
4562 (<structfield>indnkeyatts</structfield> values), this contains the OID
4563 of the collation to use for the index, or zero if the column is not of
4564 a collatable data type.
4565 </para></entry>
4566 </row>
4567
4568 <row>
4569 <entry role="catalog_table_entry"><para role="column_definition">
4570 <structfield>indclass</structfield> <type>oidvector</type>
4571 (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
4572 </para>
4573 <para>
4574 For each column in the index key
4575 (<structfield>indnkeyatts</structfield> values), this contains the OID
4576 of the operator class to use. See
4577 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4578 </para></entry>
4579 </row>
4580
4581 <row>
4582 <entry role="catalog_table_entry"><para role="column_definition">
4583 <structfield>indoption</structfield> <type>int2vector</type>
4584 </para>
4585 <para>
4586 This is an array of <structfield>indnkeyatts</structfield> values that
4587 store per-column flag bits. The meaning of the bits is defined by
4588 the index's access method.
4589 </para></entry>
4590 </row>
4591
4592 <row>
4593 <entry role="catalog_table_entry"><para role="column_definition">
4594 <structfield>indexprs</structfield> <type>pg_node_tree</type>
4595 </para>
4596 <para>
4597 Expression trees (in <function>nodeToString()</function>
4598 representation) for index attributes that are not simple column
4599 references. This is a list with one element for each zero
4600 entry in <structfield>indkey</structfield>. Null if all index attributes
4601 are simple references.
4602 </para></entry>
4603 </row>
4604
4605 <row>
4606 <entry role="catalog_table_entry"><para role="column_definition">
4607 <structfield>indpred</structfield> <type>pg_node_tree</type>
4608 </para>
4609 <para>
4610 Expression tree (in <function>nodeToString()</function>
4611 representation) for partial index predicate. Null if not a
4612 partial index.
4613 </para></entry>
4614 </row>
4615 </tbody>
4616 </tgroup>
4617 </table>
4618
4619 </sect1>
4620
4621
4622 <sect1 id="catalog-pg-inherits">
4623 <title><structname>pg_inherits</structname></title>
4624
4625 <indexterm zone="catalog-pg-inherits">
4626 <primary>pg_inherits</primary>
4627 </indexterm>
4628
4629 <para>
4630 The catalog <structname>pg_inherits</structname> records information about
4631 table and index inheritance hierarchies. There is one entry for each direct
4632 parent-child table or index relationship in the database. (Indirect
4633 inheritance can be determined by following chains of entries.)
4634 </para>
4635
4636 <table>
4637 <title><structname>pg_inherits</structname> Columns</title>
4638 <tgroup cols="1">
4639 <thead>
4640 <row>
4641 <entry role="catalog_table_entry"><para role="column_definition">
4642 Column Type
4643 </para>
4644 <para>
4645 Description
4646 </para></entry>
4647 </row>
4648 </thead>
4649
4650 <tbody>
4651 <row>
4652 <entry role="catalog_table_entry"><para role="column_definition">
4653 <structfield>inhrelid</structfield> <type>oid</type>
4654 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4655 </para>
4656 <para>
4657 The OID of the child table or index
4658 </para></entry>
4659 </row>
4660
4661 <row>
4662 <entry role="catalog_table_entry"><para role="column_definition">
4663 <structfield>inhparent</structfield> <type>oid</type>
4664 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4665 </para>
4666 <para>
4667 The OID of the parent table or index
4668 </para></entry>
4669 </row>
4670
4671 <row>
4672 <entry role="catalog_table_entry"><para role="column_definition">
4673 <structfield>inhseqno</structfield> <type>int4</type>
4674 </para>
4675 <para>
4676 If there is more than one direct parent for a child table (multiple
4677 inheritance), this number tells the order in which the
4678 inherited columns are to be arranged. The count starts at 1.
4679 </para>
4680 <para>
4681 Indexes cannot have multiple inheritance, since they can only inherit
4682 when using declarative partitioning.
4683 </para></entry>
4684 </row>
4685
4686 <row>
4687 <entry role="catalog_table_entry"><para role="column_definition">
4688 <structfield>inhdetachpending</structfield> <type>bool</type>
4689 </para>
4690 <para>
4691 <literal>true</literal> for a partition that is in the process of
4692 being detached; <literal>false</literal> otherwise.
4693 </para></entry>
4694 </row>
4695 </tbody>
4696 </tgroup>
4697 </table>
4698
4699 </sect1>
4700
4701 <sect1 id="catalog-pg-init-privs">
4702 <title><structname>pg_init_privs</structname></title>
4703
4704 <indexterm zone="catalog-pg-init-privs">
4705 <primary>pg_init_privs</primary>
4706 </indexterm>
4707
4708 <para>
4709 The catalog <structname>pg_init_privs</structname> records information about
4710 the initial privileges of objects in the system. There is one entry
4711 for each object in the database which has a non-default (non-NULL)
4712 initial set of privileges.
4713 </para>
4714
4715 <para>
4716 Objects can have initial privileges either by having those privileges set
4717 when the system is initialized (by <application>initdb</application>) or when the
4718 object is created during a <link linkend="sql-createextension"><command>CREATE EXTENSION</command></link> and the
4719 extension script sets initial privileges using the <link linkend="sql-grant"><command>GRANT</command></link>
4720 system. Note that the system will automatically handle recording of the
4721 privileges during the extension script and that extension authors need
4722 only use the <command>GRANT</command> and <command>REVOKE</command>
4723 statements in their script to have the privileges recorded. The
4724 <literal>privtype</literal> column indicates if the initial privilege was
4725 set by <application>initdb</application> or during a
4726 <command>CREATE EXTENSION</command> command.
4727 </para>
4728
4729 <para>
4730 Objects which have initial privileges set by <application>initdb</application> will
4731 have entries where <literal>privtype</literal> is
4732 <literal>'i'</literal>, while objects which have initial privileges set
4733 by <command>CREATE EXTENSION</command> will have entries where
4734 <literal>privtype</literal> is <literal>'e'</literal>.
4735 </para>
4736
4737 <table>
4738 <title><structname>pg_init_privs</structname> Columns</title>
4739 <tgroup cols="1">
4740 <thead>
4741 <row>
4742 <entry role="catalog_table_entry"><para role="column_definition">
4743 Column Type
4744 </para>
4745 <para>
4746 Description
4747 </para></entry>
4748 </row>
4749 </thead>
4750
4751 <tbody>
4752 <row>
4753 <entry role="catalog_table_entry"><para role="column_definition">
4754 <structfield>objoid</structfield> <type>oid</type>
4755 (references any OID column)
4756 </para>
4757 <para>
4758 The OID of the specific object
4759 </para></entry>
4760 </row>
4761
4762 <row>
4763 <entry role="catalog_table_entry"><para role="column_definition">
4764 <structfield>classoid</structfield> <type>oid</type>
4765 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4766 </para>
4767 <para>
4768 The OID of the system catalog the object is in
4769 </para></entry>
4770 </row>
4771
4772 <row>
4773 <entry role="catalog_table_entry"><para role="column_definition">
4774 <structfield>objsubid</structfield> <type>int4</type>
4775 </para>
4776 <para>
4777 For a table column, this is the column number (the
4778 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to the
4779 table itself). For all other object types, this column is
4780 zero.
4781 </para></entry>
4782 </row>
4783
4784 <row>
4785 <entry role="catalog_table_entry"><para role="column_definition">
4786 <structfield>privtype</structfield> <type>char</type>
4787 </para>
4788 <para>
4789 A code defining the type of initial privilege of this object; see text
4790 </para></entry>
4791 </row>
4792
4793 <row>
4794 <entry role="catalog_table_entry"><para role="column_definition">
4795 <structfield>initprivs</structfield> <type>aclitem[]</type>
4796 </para>
4797 <para>
4798 The initial access privileges; see
4799 <xref linkend="ddl-priv"/> for details
4800 </para></entry>
4801 </row>
4802 </tbody>
4803 </tgroup>
4804 </table>
4805
4806 </sect1>
4807
4808
4809 <sect1 id="catalog-pg-language">
4810 <title><structname>pg_language</structname></title>
4811
4812 <indexterm zone="catalog-pg-language">
4813 <primary>pg_language</primary>
4814 </indexterm>
4815
4816 <para>
4817 The catalog <structname>pg_language</structname> registers
4818 languages in which you can write functions or stored procedures.
4819 See <xref linkend="sql-createlanguage"/>
4820 and <xref linkend="xplang"/> for more information about language handlers.
4821 </para>
4822
4823 <table>
4824 <title><structname>pg_language</structname> Columns</title>
4825 <tgroup cols="1">
4826 <thead>
4827 <row>
4828 <entry role="catalog_table_entry"><para role="column_definition">
4829 Column Type
4830 </para>
4831 <para>
4832 Description
4833 </para></entry>
4834 </row>
4835 </thead>
4836
4837 <tbody>
4838 <row>
4839 <entry role="catalog_table_entry"><para role="column_definition">
4840 <structfield>oid</structfield> <type>oid</type>
4841 </para>
4842 <para>
4843 Row identifier
4844 </para></entry>
4845 </row>
4846
4847 <row>
4848 <entry role="catalog_table_entry"><para role="column_definition">
4849 <structfield>lanname</structfield> <type>name</type>
4850 </para>
4851 <para>
4852 Name of the language
4853 </para></entry>
4854 </row>
4855
4856 <row>
4857 <entry role="catalog_table_entry"><para role="column_definition">
4858 <structfield>lanowner</structfield> <type>oid</type>
4859 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4860 </para>
4861 <para>
4862 Owner of the language
4863 </para></entry>
4864 </row>
4865
4866 <row>
4867 <entry role="catalog_table_entry"><para role="column_definition">
4868 <structfield>lanispl</structfield> <type>bool</type>
4869 </para>
4870 <para>
4871 This is false for internal languages (such as
4872 <acronym>SQL</acronym>) and true for user-defined languages.
4873 Currently, <application>pg_dump</application> still uses this
4874 to determine which languages need to be dumped, but this might be
4875 replaced by a different mechanism in the future.
4876 </para></entry>
4877 </row>
4878
4879 <row>
4880 <entry role="catalog_table_entry"><para role="column_definition">
4881 <structfield>lanpltrusted</structfield> <type>bool</type>
4882 </para>
4883 <para>
4884 True if this is a trusted language, which means that it is believed
4885 not to grant access to anything outside the normal SQL execution
4886 environment. Only superusers can create functions in untrusted
4887 languages.
4888 </para></entry>
4889 </row>
4890
4891 <row>
4892 <entry role="catalog_table_entry"><para role="column_definition">
4893 <structfield>lanplcallfoid</structfield> <type>oid</type>
4894 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4895 </para>
4896 <para>
4897 For noninternal languages this references the language
4898 handler, which is a special function that is responsible for
4899 executing all functions that are written in the particular
4900 language. Zero for internal languages.
4901 </para></entry>
4902 </row>
4903
4904 <row>
4905 <entry role="catalog_table_entry"><para role="column_definition">
4906 <structfield>laninline</structfield> <type>oid</type>
4907 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4908 </para>
4909 <para>
4910 This references a function that is responsible for executing
4911 <quote>inline</quote> anonymous code blocks
4912 (<xref linkend="sql-do"/> blocks).
4913 Zero if inline blocks are not supported.
4914 </para></entry>
4915 </row>
4916
4917 <row>
4918 <entry role="catalog_table_entry"><para role="column_definition">
4919 <structfield>lanvalidator</structfield> <type>oid</type>
4920 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4921 </para>
4922 <para>
4923 This references a language validator function that is responsible
4924 for checking the syntax and validity of new functions when they
4925 are created. Zero if no validator is provided.
4926 </para></entry>
4927 </row>
4928
4929 <row>
4930 <entry role="catalog_table_entry"><para role="column_definition">
4931 <structfield>lanacl</structfield> <type>aclitem[]</type>
4932 </para>
4933 <para>
4934 Access privileges; see <xref linkend="ddl-priv"/> for details
4935 </para></entry>
4936 </row>
4937 </tbody>
4938 </tgroup>
4939 </table>
4940
4941 </sect1>
4942
4943
4944 <sect1 id="catalog-pg-largeobject">
4945 <title><structname>pg_largeobject</structname></title>
4946
4947 <indexterm zone="catalog-pg-largeobject">
4948 <primary>pg_largeobject</primary>
4949 </indexterm>
4950
4951 <para>
4952 The catalog <structname>pg_largeobject</structname> holds the data making up
4953 <quote>large objects</quote>. A large object is identified by an OID
4954 assigned when it is created. Each large object is broken into
4955 segments or <quote>pages</quote> small enough to be conveniently stored as rows
4956 in <structname>pg_largeobject</structname>.
4957 The amount of data per page is defined to be <symbol>LOBLKSIZE</symbol> (which is currently
4958 <literal>BLCKSZ/4</literal>, or typically 2 kB).
4959 </para>
4960
4961 <para>
4962 Prior to <productname>PostgreSQL</productname> 9.0, there was no permission structure
4963 associated with large objects. As a result,
4964 <structname>pg_largeobject</structname> was publicly readable and could be
4965 used to obtain the OIDs (and contents) of all large objects in the system.
4966 This is no longer the case; use
4967 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>
4968 to obtain a list of large object OIDs.
4969 </para>
4970
4971 <table>
4972 <title><structname>pg_largeobject</structname> Columns</title>
4973 <tgroup cols="1">
4974 <thead>
4975 <row>
4976 <entry role="catalog_table_entry"><para role="column_definition">
4977 Column Type
4978 </para>
4979 <para>
4980 Description
4981 </para></entry>
4982 </row>
4983 </thead>
4984
4985 <tbody>
4986 <row>
4987 <entry role="catalog_table_entry"><para role="column_definition">
4988 <structfield>loid</structfield> <type>oid</type>
4989 (references <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.<structfield>oid</structfield>)
4990 </para>
4991 <para>
4992 Identifier of the large object that includes this page
4993 </para></entry>
4994 </row>
4995
4996 <row>
4997 <entry role="catalog_table_entry"><para role="column_definition">
4998 <structfield>pageno</structfield> <type>int4</type>
4999 </para>
5000 <para>
5001 Page number of this page within its large object
5002 (counting from zero)
5003 </para></entry>
5004 </row>
5005
5006 <row>
5007 <entry role="catalog_table_entry"><para role="column_definition">
5008 <structfield>data</structfield> <type>bytea</type>
5009 </para>
5010 <para>
5011 Actual data stored in the large object.
5012 This will never be more than <symbol>LOBLKSIZE</symbol> bytes and might be less.
5013 </para></entry>
5014 </row>
5015 </tbody>
5016 </tgroup>
5017 </table>
5018
5019 <para>
5020 Each row of <structname>pg_largeobject</structname> holds data
5021 for one page of a large object, beginning at
5022 byte offset (<literal>pageno * LOBLKSIZE</literal>) within the object. The implementation
5023 allows sparse storage: pages might be missing, and might be shorter than
5024 <literal>LOBLKSIZE</literal> bytes even if they are not the last page of the object.
5025 Missing regions within a large object read as zeroes.
5026 </para>
5027
5028 </sect1>
5029
5030 <sect1 id="catalog-pg-largeobject-metadata">
5031 <title><structname>pg_largeobject_metadata</structname></title>
5032
5033 <indexterm zone="catalog-pg-largeobject-metadata">
5034 <primary>pg_largeobject_metadata</primary>
5035 </indexterm>
5036
5037 <para>
5038 The catalog <structname>pg_largeobject_metadata</structname>
5039 holds metadata associated with large objects. The actual large object
5040 data is stored in
5041 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link>.
5042 </para>
5043
5044 <table>
5045 <title><structname>pg_largeobject_metadata</structname> Columns</title>
5046 <tgroup cols="1">
5047 <thead>
5048 <row>
5049 <entry role="catalog_table_entry"><para role="column_definition">
5050 Column Type
5051 </para>
5052 <para>
5053 Description
5054 </para></entry>
5055 </row>
5056 </thead>
5057
5058 <tbody>
5059 <row>
5060 <entry role="catalog_table_entry"><para role="column_definition">
5061 <structfield>oid</structfield> <type>oid</type>
5062 </para>
5063 <para>
5064 Row identifier
5065 </para></entry>
5066 </row>
5067
5068 <row>
5069 <entry role="catalog_table_entry"><para role="column_definition">
5070 <structfield>lomowner</structfield> <type>oid</type>
5071 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5072 </para>
5073 <para>
5074 Owner of the large object
5075 </para></entry>
5076 </row>
5077
5078 <row>
5079 <entry role="catalog_table_entry"><para role="column_definition">
5080 <structfield>lomacl</structfield> <type>aclitem[]</type>
5081 </para>
5082 <para>
5083 Access privileges; see <xref linkend="ddl-priv"/> for details
5084 </para></entry>
5085 </row>
5086 </tbody>
5087 </tgroup>
5088 </table>
5089 </sect1>
5090
5091
5092 <sect1 id="catalog-pg-namespace">
5093 <title><structname>pg_namespace</structname></title>
5094
5095 <indexterm zone="catalog-pg-namespace">
5096 <primary>pg_namespace</primary>
5097 </indexterm>
5098
5099 <para>
5100 The catalog <structname>pg_namespace</structname> stores namespaces.
5101 A namespace is the structure underlying SQL schemas: each namespace
5102 can have a separate collection of relations, types, etc. without name
5103 conflicts.
5104 </para>
5105
5106 <table>
5107 <title><structname>pg_namespace</structname> Columns</title>
5108 <tgroup cols="1">
5109 <thead>
5110 <row>
5111 <entry role="catalog_table_entry"><para role="column_definition">
5112 Column Type
5113 </para>
5114 <para>
5115 Description
5116 </para></entry>
5117 </row>
5118 </thead>
5119
5120 <tbody>
5121 <row>
5122 <entry role="catalog_table_entry"><para role="column_definition">
5123 <structfield>oid</structfield> <type>oid</type>
5124 </para>
5125 <para>
5126 Row identifier
5127 </para></entry>
5128 </row>
5129
5130 <row>
5131 <entry role="catalog_table_entry"><para role="column_definition">
5132 <structfield>nspname</structfield> <type>name</type>
5133 </para>
5134 <para>
5135 Name of the namespace
5136 </para></entry>
5137 </row>
5138
5139 <row>
5140 <entry role="catalog_table_entry"><para role="column_definition">
5141 <structfield>nspowner</structfield> <type>oid</type>
5142 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5143 </para>
5144 <para>
5145 Owner of the namespace
5146 </para></entry>
5147 </row>
5148
5149 <row>
5150 <entry role="catalog_table_entry"><para role="column_definition">
5151 <structfield>nspacl</structfield> <type>aclitem[]</type>
5152 </para>
5153 <para>
5154 Access privileges; see <xref linkend="ddl-priv"/> for details
5155 </para></entry>
5156 </row>
5157 </tbody>
5158 </tgroup>
5159 </table>
5160
5161 </sect1>
5162
5163
5164 <sect1 id="catalog-pg-opclass">
5165 <title><structname>pg_opclass</structname></title>
5166
5167 <indexterm zone="catalog-pg-opclass">
5168 <primary>pg_opclass</primary>
5169 </indexterm>
5170
5171 <para>
5172 The catalog <structname>pg_opclass</structname> defines
5173 index access method operator classes. Each operator class defines
5174 semantics for index columns of a particular data type and a particular
5175 index access method. An operator class essentially specifies that a
5176 particular operator family is applicable to a particular indexable column
5177 data type. The set of operators from the family that are actually usable
5178 with the indexed column are whichever ones accept the column's data type
5179 as their left-hand input.
5180 </para>
5181
5182 <para>
5183 Operator classes are described at length in <xref linkend="xindex"/>.
5184 </para>
5185
5186 <table>
5187 <title><structname>pg_opclass</structname> Columns</title>
5188 <tgroup cols="1">
5189 <thead>
5190 <row>
5191 <entry role="catalog_table_entry"><para role="column_definition">
5192 Column Type
5193 </para>
5194 <para>
5195 Description
5196 </para></entry>
5197 </row>
5198 </thead>
5199
5200 <tbody>
5201 <row>
5202 <entry role="catalog_table_entry"><para role="column_definition">
5203 <structfield>oid</structfield> <type>oid</type>
5204 </para>
5205 <para>
5206 Row identifier
5207 </para></entry>
5208 </row>
5209
5210 <row>
5211 <entry role="catalog_table_entry"><para role="column_definition">
5212 <structfield>opcmethod</structfield> <type>oid</type>
5213 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
5214 </para>
5215 <para>
5216 Index access method operator class is for
5217 </para></entry>
5218 </row>
5219
5220 <row>
5221 <entry role="catalog_table_entry"><para role="column_definition">
5222 <structfield>opcname</structfield> <type>name</type>
5223 </para>
5224 <para>
5225 Name of this operator class
5226 </para></entry>
5227 </row>
5228
5229 <row>
5230 <entry role="catalog_table_entry"><para role="column_definition">
5231 <structfield>opcnamespace</structfield> <type>oid</type>
5232 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5233 </para>
5234 <para>
5235 Namespace of this operator class
5236 </para></entry>
5237 </row>
5238
5239 <row>
5240 <entry role="catalog_table_entry"><para role="column_definition">
5241 <structfield>opcowner</structfield> <type>oid</type>
5242 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5243 </para>
5244 <para>
5245 Owner of the operator class
5246 </para></entry>
5247 </row>
5248
5249 <row>
5250 <entry role="catalog_table_entry"><para role="column_definition">
5251 <structfield>opcfamily</structfield> <type>oid</type>
5252 (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
5253 </para>
5254 <para>
5255 Operator family containing the operator class
5256 </para></entry>
5257 </row>
5258
5259 <row>
5260 <entry role="catalog_table_entry"><para role="column_definition">
5261 <structfield>opcintype</structfield> <type>oid</type>
5262 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5263 </para>
5264 <para>
5265 Data type that the operator class indexes
5266 </para></entry>
5267 </row>
5268
5269 <row>
5270 <entry role="catalog_table_entry"><para role="column_definition">
5271 <structfield>opcdefault</structfield> <type>bool</type>
5272 </para>
5273 <para>
5274 True if this operator class is the default for <structfield>opcintype</structfield>
5275 </para></entry>
5276 </row>
5277
5278 <row>
5279 <entry role="catalog_table_entry"><para role="column_definition">
5280 <structfield>opckeytype</structfield> <type>oid</type>
5281 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5282 </para>
5283 <para>
5284 Type of data stored in index, or zero if same as <structfield>opcintype</structfield>
5285 </para></entry>
5286 </row>
5287 </tbody>
5288 </tgroup>
5289 </table>
5290
5291 <para>
5292 An operator class's <structfield>opcmethod</structfield> must match the
5293 <structfield>opfmethod</structfield> of its containing operator family.
5294 Also, there must be no more than one <structname>pg_opclass</structname>
5295 row having <structfield>opcdefault</structfield> true for any given combination of
5296 <structfield>opcmethod</structfield> and <structfield>opcintype</structfield>.
5297 </para>
5298
5299 </sect1>
5300
5301
5302 <sect1 id="catalog-pg-operator">
5303 <title><structname>pg_operator</structname></title>
5304
5305 <indexterm zone="catalog-pg-operator">
5306 <primary>pg_operator</primary>
5307 </indexterm>
5308
5309 <para>
5310 The catalog <structname>pg_operator</structname> stores information about operators.
5311 See <xref linkend="sql-createoperator"/>
5312 and <xref linkend="xoper"/> for more information.
5313 </para>
5314
5315 <table>
5316 <title><structname>pg_operator</structname> Columns</title>
5317 <tgroup cols="1">
5318 <thead>
5319 <row>
5320 <entry role="catalog_table_entry"><para role="column_definition">
5321 Column Type
5322 </para>
5323 <para>
5324 Description
5325 </para></entry>
5326 </row>
5327 </thead>
5328
5329 <tbody>
5330 <row>
5331 <entry role="catalog_table_entry"><para role="column_definition">
5332 <structfield>oid</structfield> <type>oid</type>
5333 </para>
5334 <para>
5335 Row identifier
5336 </para></entry>
5337 </row>
5338
5339 <row>
5340 <entry role="catalog_table_entry"><para role="column_definition">
5341 <structfield>oprname</structfield> <type>name</type>
5342 </para>
5343 <para>
5344 Name of the operator
5345 </para></entry>
5346 </row>
5347
5348 <row>
5349 <entry role="catalog_table_entry"><para role="column_definition">
5350 <structfield>oprnamespace</structfield> <type>oid</type>
5351 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5352 </para>
5353 <para>
5354 The OID of the namespace that contains this operator
5355 </para></entry>
5356 </row>
5357
5358 <row>
5359 <entry role="catalog_table_entry"><para role="column_definition">
5360 <structfield>oprowner</structfield> <type>oid</type>
5361 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5362 </para>
5363 <para>
5364 Owner of the operator
5365 </para></entry>
5366 </row>
5367
5368 <row>
5369 <entry role="catalog_table_entry"><para role="column_definition">
5370 <structfield>oprkind</structfield> <type>char</type>
5371 </para>
5372 <para>
5373 <literal>b</literal> = infix operator (<quote>both</quote>),
5374 or <literal>l</literal> = prefix operator (<quote>left</quote>)
5375 </para></entry>
5376 </row>
5377
5378 <row>
5379 <entry role="catalog_table_entry"><para role="column_definition">
5380 <structfield>oprcanmerge</structfield> <type>bool</type>
5381 </para>
5382 <para>
5383 This operator supports merge joins
5384 </para></entry>
5385 </row>
5386
5387 <row>
5388 <entry role="catalog_table_entry"><para role="column_definition">
5389 <structfield>oprcanhash</structfield> <type>bool</type>
5390 </para>
5391 <para>
5392 This operator supports hash joins
5393 </para></entry>
5394 </row>
5395
5396 <row>
5397 <entry role="catalog_table_entry"><para role="column_definition">
5398 <structfield>oprleft</structfield> <type>oid</type>
5399 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5400 </para>
5401 <para>
5402 Type of the left operand (zero for a prefix operator)
5403 </para></entry>
5404 </row>
5405
5406 <row>
5407 <entry role="catalog_table_entry"><para role="column_definition">
5408 <structfield>oprright</structfield> <type>oid</type>
5409 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5410 </para>
5411 <para>
5412 Type of the right operand
5413 </para></entry>
5414 </row>
5415
5416 <row>
5417 <entry role="catalog_table_entry"><para role="column_definition">
5418 <structfield>oprresult</structfield> <type>oid</type>
5419 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5420 </para>
5421 <para>
5422 Type of the result
5423 (zero for a not-yet-defined <quote>shell</quote> operator)
5424 </para></entry>
5425 </row>
5426
5427 <row>
5428 <entry role="catalog_table_entry"><para role="column_definition">
5429 <structfield>oprcom</structfield> <type>oid</type>
5430 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
5431 </para>
5432 <para>
5433 Commutator of this operator (zero if none)
5434 </para></entry>
5435 </row>
5436
5437 <row>
5438 <entry role="catalog_table_entry"><para role="column_definition">
5439 <structfield>oprnegate</structfield> <type>oid</type>
5440 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
5441 </para>
5442 <para>
5443 Negator of this operator (zero if none)
5444 </para></entry>
5445 </row>
5446
5447 <row>
5448 <entry role="catalog_table_entry"><para role="column_definition">
5449 <structfield>oprcode</structfield> <type>regproc</type>
5450 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5451 </para>
5452 <para>
5453 Function that implements this operator
5454 (zero for a not-yet-defined <quote>shell</quote> operator)
5455 </para></entry>
5456 </row>
5457
5458 <row>
5459 <entry role="catalog_table_entry"><para role="column_definition">
5460 <structfield>oprrest</structfield> <type>regproc</type>
5461 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5462 </para>
5463 <para>
5464 Restriction selectivity estimation function for this operator
5465 (zero if none)
5466 </para></entry>
5467 </row>
5468
5469 <row>
5470 <entry role="catalog_table_entry"><para role="column_definition">
5471 <structfield>oprjoin</structfield> <type>regproc</type>
5472 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5473 </para>
5474 <para>
5475 Join selectivity estimation function for this operator
5476 (zero if none)
5477 </para></entry>
5478 </row>
5479 </tbody>
5480 </tgroup>
5481 </table>
5482
5483 </sect1>
5484
5485
5486 <sect1 id="catalog-pg-opfamily">
5487 <title><structname>pg_opfamily</structname></title>
5488
5489 <indexterm zone="catalog-pg-opfamily">
5490 <primary>pg_opfamily</primary>
5491 </indexterm>
5492
5493 <para>
5494 The catalog <structname>pg_opfamily</structname> defines operator families.
5495 Each operator family is a collection of operators and associated
5496 support routines that implement the semantics specified for a particular
5497 index access method. Furthermore, the operators in a family are all
5498 <quote>compatible</quote>, in a way that is specified by the access method.
5499 The operator family concept allows cross-data-type operators to be used
5500 with indexes and to be reasoned about using knowledge of access method
5501 semantics.
5502 </para>
5503
5504 <para>
5505 Operator families are described at length in <xref linkend="xindex"/>.
5506 </para>
5507
5508 <table>
5509 <title><structname>pg_opfamily</structname> Columns</title>
5510 <tgroup cols="1">
5511 <thead>
5512 <row>
5513 <entry role="catalog_table_entry"><para role="column_definition">
5514 Column Type
5515 </para>
5516 <para>
5517 Description
5518 </para></entry>
5519 </row>
5520 </thead>
5521
5522 <tbody>
5523 <row>
5524 <entry role="catalog_table_entry"><para role="column_definition">
5525 <structfield>oid</structfield> <type>oid</type>
5526 </para>
5527 <para>
5528 Row identifier
5529 </para></entry>
5530 </row>
5531
5532 <row>
5533 <entry role="catalog_table_entry"><para role="column_definition">
5534 <structfield>opfmethod</structfield> <type>oid</type>
5535 (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
5536 </para>
5537 <para>
5538 Index access method operator family is for
5539 </para></entry>
5540 </row>
5541
5542 <row>
5543 <entry role="catalog_table_entry"><para role="column_definition">
5544 <structfield>opfname</structfield> <type>name</type>
5545 </para>
5546 <para>
5547 Name of this operator family
5548 </para></entry>
5549 </row>
5550
5551 <row>
5552 <entry role="catalog_table_entry"><para role="column_definition">
5553 <structfield>opfnamespace</structfield> <type>oid</type>
5554 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5555 </para>
5556 <para>
5557 Namespace of this operator family
5558 </para></entry>
5559 </row>
5560
5561 <row>
5562 <entry role="catalog_table_entry"><para role="column_definition">
5563 <structfield>opfowner</structfield> <type>oid</type>
5564 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5565 </para>
5566 <para>
5567 Owner of the operator family
5568 </para></entry>
5569 </row>
5570 </tbody>
5571 </tgroup>
5572 </table>
5573
5574 <para>
5575 The majority of the information defining an operator family is not in its
5576 <structname>pg_opfamily</structname> row, but in the associated rows in
5577 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
5578 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
5579 and
5580 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
5581 </para>
5582
5583 </sect1>
5584
5585
5586 <sect1 id="catalog-pg-parameter-acl">
5587 <title><structname>pg_parameter_acl</structname></title>
5588
5589 <indexterm zone="catalog-pg-parameter-acl">
5590 <primary>pg_parameter_acl</primary>
5591 </indexterm>
5592
5593 <para>
5594 The catalog <structname>pg_parameter_acl</structname> records configuration
5595 parameters for which privileges have been granted to one or more roles.
5596 No entry is made for parameters that have default privileges.
5597 </para>
5598
5599 <para>
5600 Unlike most system catalogs, <structname>pg_parameter_acl</structname>
5601 is shared across all databases of a cluster: there is only one
5602 copy of <structname>pg_parameter_acl</structname> per cluster, not
5603 one per database.
5604 </para>
5605
5606 <table>
5607 <title><structname>pg_parameter_acl</structname> Columns</title>
5608 <tgroup cols="1">
5609 <thead>
5610 <row>
5611 <entry role="catalog_table_entry"><para role="column_definition">
5612 Column Type
5613 </para>
5614 <para>
5615 Description
5616 </para></entry>
5617 </row>
5618 </thead>
5619
5620 <tbody>
5621 <row>
5622 <entry role="catalog_table_entry"><para role="column_definition">
5623 <structfield>oid</structfield> <type>oid</type>
5624 </para>
5625 <para>
5626 Row identifier
5627 </para></entry>
5628 </row>
5629
5630 <row>
5631 <entry role="catalog_table_entry"><para role="column_definition">
5632 <structfield>parname</structfield> <type>text</type>
5633 </para>
5634 <para>
5635 The name of a configuration parameter for which privileges are granted
5636 </para></entry>
5637 </row>
5638
5639 <row>
5640 <entry role="catalog_table_entry"><para role="column_definition">
5641 <structfield>paracl</structfield> <type>aclitem[]</type>
5642 </para>
5643 <para>
5644 Access privileges; see <xref linkend="ddl-priv"/> for details
5645 </para></entry>
5646 </row>
5647
5648 </tbody>
5649 </tgroup>
5650 </table>
5651 </sect1>
5652
5653
5654 <sect1 id="catalog-pg-partitioned-table">
5655 <title><structname>pg_partitioned_table</structname></title>
5656
5657 <indexterm zone="catalog-pg-partitioned-table">
5658 <primary>pg_partitioned_table</primary>
5659 </indexterm>
5660
5661 <para>
5662 The catalog <structname>pg_partitioned_table</structname> stores
5663 information about how tables are partitioned.
5664 </para>
5665
5666 <table>
5667 <title><structname>pg_partitioned_table</structname> Columns</title>
5668 <tgroup cols="1">
5669 <thead>
5670 <row>
5671 <entry role="catalog_table_entry"><para role="column_definition">
5672 Column Type
5673 </para>
5674 <para>
5675 Description
5676 </para></entry>
5677 </row>
5678 </thead>
5679
5680 <tbody>
5681 <row>
5682 <entry role="catalog_table_entry"><para role="column_definition">
5683 <structfield>partrelid</structfield> <type>oid</type>
5684 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5685 </para>
5686 <para>
5687 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this partitioned table
5688 </para></entry>
5689 </row>
5690
5691 <row>
5692 <entry role="catalog_table_entry"><para role="column_definition">
5693 <structfield>partstrat</structfield> <type>char</type>
5694 </para>
5695 <para>
5696 Partitioning strategy; <literal>h</literal> = hash partitioned table,
5697 <literal>l</literal> = list partitioned table, <literal>r</literal> = range partitioned table
5698 </para></entry>
5699 </row>
5700
5701 <row>
5702 <entry role="catalog_table_entry"><para role="column_definition">
5703 <structfield>partnatts</structfield> <type>int2</type>
5704 </para>
5705 <para>
5706 The number of columns in the partition key
5707 </para></entry>
5708 </row>
5709
5710 <row>
5711 <entry role="catalog_table_entry"><para role="column_definition">
5712 <structfield>partdefid</structfield> <type>oid</type>
5713 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5714 </para>
5715 <para>
5716 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for the default partition
5717 of this partitioned table, or zero if this partitioned table does not
5718 have a default partition
5719 </para></entry>
5720 </row>
5721
5722 <row>
5723 <entry role="catalog_table_entry"><para role="column_definition">
5724 <structfield>partattrs</structfield> <type>int2vector</type>
5725 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
5726 </para>
5727 <para>
5728 This is an array of <structfield>partnatts</structfield> values that
5729 indicate which table columns are part of the partition key. For
5730 example, a value of <literal>1 3</literal> would mean that the first
5731 and the third table columns make up the partition key. A zero in this
5732 array indicates that the corresponding partition key column is an
5733 expression, rather than a simple column reference.
5734 </para></entry>
5735 </row>
5736
5737 <row>
5738 <entry role="catalog_table_entry"><para role="column_definition">
5739 <structfield>partclass</structfield> <type>oidvector</type>
5740 (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
5741 </para>
5742 <para>
5743 For each column in the partition key, this contains the OID of the
5744 operator class to use. See
5745 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
5746 </para></entry>
5747 </row>
5748
5749 <row>
5750 <entry role="catalog_table_entry"><para role="column_definition">
5751 <structfield>partcollation</structfield> <type>oidvector</type>
5752 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
5753 </para>
5754 <para>
5755 For each column in the partition key, this contains the OID of the
5756 collation to use for partitioning, or zero if the column is not
5757 of a collatable data type.
5758 </para></entry>
5759 </row>
5760
5761 <row>
5762 <entry role="catalog_table_entry"><para role="column_definition">
5763 <structfield>partexprs</structfield> <type>pg_node_tree</type>
5764 </para>
5765 <para>
5766 Expression trees (in <function>nodeToString()</function>
5767 representation) for partition key columns that are not simple column
5768 references. This is a list with one element for each zero
5769 entry in <structfield>partattrs</structfield>. Null if all partition key columns
5770 are simple references.
5771 </para></entry>
5772 </row>
5773 </tbody>
5774 </tgroup>
5775 </table>
5776 </sect1>
5777
5778
5779 <sect1 id="catalog-pg-policy">
5780 <title><structname>pg_policy</structname></title>
5781
5782 <indexterm zone="catalog-pg-policy">
5783 <primary>pg_policy</primary>
5784 </indexterm>
5785
5786 <para>
5787 The catalog <structname>pg_policy</structname> stores row-level
5788 security policies for tables. A policy includes the kind of
5789 command that it applies to (possibly all commands), the roles that it
5790 applies to, the expression to be added as a security-barrier
5791 qualification to queries that include the table, and the expression
5792 to be added as a <literal>WITH CHECK</literal> option for queries that attempt to
5793 add new records to the table.
5794 </para>
5795
5796 <table>
5797 <title><structname>pg_policy</structname> Columns</title>
5798 <tgroup cols="1">
5799 <thead>
5800 <row>
5801 <entry role="catalog_table_entry"><para role="column_definition">
5802 Column Type
5803 </para>
5804 <para>
5805 Description
5806 </para></entry>
5807 </row>
5808 </thead>
5809
5810 <tbody>
5811 <row>
5812 <entry role="catalog_table_entry"><para role="column_definition">
5813 <structfield>oid</structfield> <type>oid</type>
5814 </para>
5815 <para>
5816 Row identifier
5817 </para></entry>
5818 </row>
5819
5820 <row>
5821 <entry role="catalog_table_entry"><para role="column_definition">
5822 <structfield>polname</structfield> <type>name</type>
5823 </para>
5824 <para>
5825 The name of the policy
5826 </para></entry>
5827 </row>
5828
5829 <row>
5830 <entry role="catalog_table_entry"><para role="column_definition">
5831 <structfield>polrelid</structfield> <type>oid</type>
5832 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5833 </para>
5834 <para>
5835 The table to which the policy applies
5836 </para></entry>
5837 </row>
5838
5839 <row>
5840 <entry role="catalog_table_entry"><para role="column_definition">
5841 <structfield>polcmd</structfield> <type>char</type>
5842 </para>
5843 <para>
5844 The command type to which the policy is applied:
5845 <literal>r</literal> for <xref linkend="sql-select"/>,
5846 <literal>a</literal> for <xref linkend="sql-insert"/>,
5847 <literal>w</literal> for <xref linkend="sql-update"/>,
5848 <literal>d</literal> for <xref linkend="sql-delete"/>,
5849 or <literal>*</literal> for all
5850 </para></entry>
5851 </row>
5852
5853 <row>
5854 <entry role="catalog_table_entry"><para role="column_definition">
5855 <structfield>polpermissive</structfield> <type>bool</type>
5856 </para>
5857 <para>
5858 Is the policy permissive or restrictive?
5859 </para></entry>
5860 </row>
5861
5862 <row>
5863 <entry role="catalog_table_entry"><para role="column_definition">
5864 <structfield>polroles</structfield> <type>oid[]</type>
5865 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5866 </para>
5867 <para>
5868 The roles to which the policy is applied;
5869 zero means <literal>PUBLIC</literal>
5870 (and normally appears alone in the array)
5871 </para></entry>
5872 </row>
5873
5874 <row>
5875 <entry role="catalog_table_entry"><para role="column_definition">
5876 <structfield>polqual</structfield> <type>pg_node_tree</type>
5877 </para>
5878 <para>
5879 The expression tree to be added to the security barrier qualifications for queries that use the table
5880 </para></entry>
5881 </row>
5882
5883 <row>
5884 <entry role="catalog_table_entry"><para role="column_definition">
5885 <structfield>polwithcheck</structfield> <type>pg_node_tree</type>
5886 </para>
5887 <para>
5888 The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table
5889 </para></entry>
5890 </row>
5891 </tbody>
5892 </tgroup>
5893 </table>
5894
5895 <note>
5896 <para>
5897 Policies stored in <structname>pg_policy</structname> are applied only when
5898 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relrowsecurity</structfield> is set for
5899 their table.
5900 </para>
5901 </note>
5902
5903 </sect1>
5904
5905 <sect1 id="catalog-pg-proc">
5906 <title><structname>pg_proc</structname></title>
5907
5908 <indexterm zone="catalog-pg-proc">
5909 <primary>pg_proc</primary>
5910 </indexterm>
5911
5912 <para>
5913 The catalog <structname>pg_proc</structname> stores information about
5914 functions, procedures, aggregate functions, and window functions
5915 (collectively also known as routines). See <xref
5916 linkend="sql-createfunction"/>, <xref linkend="sql-createprocedure"/>, and
5917 <xref linkend="xfunc"/> for more information.
5918 </para>
5919
5920 <para>
5921 If <structfield>prokind</structfield> indicates that the entry is for an
5922 aggregate function, there should be a matching row in
5923 <link linkend="catalog-pg-aggregate"><structfield>pg_aggregate</structfield></link>.
5924 </para>
5925
5926 <table>
5927 <title><structname>pg_proc</structname> Columns</title>
5928 <tgroup cols="1">
5929 <thead>
5930 <row>
5931 <entry role="catalog_table_entry"><para role="column_definition">
5932 Column Type
5933 </para>
5934 <para>
5935 Description
5936 </para></entry>
5937 </row>
5938 </thead>
5939
5940 <tbody>
5941 <row>
5942 <entry role="catalog_table_entry"><para role="column_definition">
5943 <structfield>oid</structfield> <type>oid</type>
5944 </para>
5945 <para>
5946 Row identifier
5947 </para></entry>
5948 </row>
5949
5950 <row>
5951 <entry role="catalog_table_entry"><para role="column_definition">
5952 <structfield>proname</structfield> <type>name</type>
5953 </para>
5954 <para>
5955 Name of the function
5956 </para></entry>
5957 </row>
5958
5959 <row>
5960 <entry role="catalog_table_entry"><para role="column_definition">
5961 <structfield>pronamespace</structfield> <type>oid</type>
5962 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5963 </para>
5964 <para>
5965 The OID of the namespace that contains this function
5966 </para></entry>
5967 </row>
5968
5969 <row>
5970 <entry role="catalog_table_entry"><para role="column_definition">
5971 <structfield>proowner</structfield> <type>oid</type>
5972 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5973 </para>
5974 <para>
5975 Owner of the function
5976 </para></entry>
5977 </row>
5978
5979 <row>
5980 <entry role="catalog_table_entry"><para role="column_definition">
5981 <structfield>prolang</structfield> <type>oid</type>
5982 (references <link linkend="catalog-pg-language"><structname>pg_language</structname></link>.<structfield>oid</structfield>)
5983 </para>
5984 <para>
5985 Implementation language or call interface of this function
5986 </para></entry>
5987 </row>
5988
5989 <row>
5990 <entry role="catalog_table_entry"><para role="column_definition">
5991 <structfield>procost</structfield> <type>float4</type>
5992 </para>
5993 <para>
5994 Estimated execution cost (in units of
5995 <xref linkend="guc-cpu-operator-cost"/>); if <structfield>proretset</structfield>,
5996 this is cost per row returned
5997 </para></entry>
5998 </row>
5999
6000 <row>
6001 <entry role="catalog_table_entry"><para role="column_definition">
6002 <structfield>prorows</structfield> <type>float4</type>
6003 </para>
6004 <para>
6005 Estimated number of result rows (zero if not <structfield>proretset</structfield>)
6006 </para></entry>
6007 </row>
6008
6009 <row>
6010 <entry role="catalog_table_entry"><para role="column_definition">
6011 <structfield>provariadic</structfield> <type>oid</type>
6012 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6013 </para>
6014 <para>
6015 Data type of the variadic array parameter's elements,
6016 or zero if the function does not have a variadic parameter
6017 </para></entry>
6018 </row>
6019
6020 <row>
6021 <entry role="catalog_table_entry"><para role="column_definition">
6022 <structfield>prosupport</structfield> <type>regproc</type>
6023 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
6024 </para>
6025 <para>
6026 Planner support function for this function
6027 (see <xref linkend="xfunc-optimization"/>), or zero if none
6028 </para></entry>
6029 </row>
6030
6031 <row>
6032 <entry role="catalog_table_entry"><para role="column_definition">
6033 <structfield>prokind</structfield> <type>char</type>
6034 </para>
6035 <para>
6036 <literal>f</literal> for a normal function, <literal>p</literal>
6037 for a procedure, <literal>a</literal> for an aggregate function, or
6038 <literal>w</literal> for a window function
6039 </para></entry>
6040 </row>
6041
6042 <row>
6043 <entry role="catalog_table_entry"><para role="column_definition">
6044 <structfield>prosecdef</structfield> <type>bool</type>
6045 </para>
6046 <para>
6047 Function is a security definer (i.e., a <quote>setuid</quote>
6048 function)
6049 </para></entry>
6050 </row>
6051
6052 <row>
6053 <entry role="catalog_table_entry"><para role="column_definition">
6054 <structfield>proleakproof</structfield> <type>bool</type>
6055 </para>
6056 <para>
6057 The function has no side effects. No information about the
6058 arguments is conveyed except via the return value. Any function
6059 that might throw an error depending on the values of its arguments
6060 is not leakproof.
6061 </para></entry>
6062 </row>
6063
6064 <row>
6065 <entry role="catalog_table_entry"><para role="column_definition">
6066 <structfield>proisstrict</structfield> <type>bool</type>
6067 </para>
6068 <para>
6069 Function returns null if any call argument is null. In that
6070 case the function won't actually be called at all. Functions
6071 that are not <quote>strict</quote> must be prepared to handle
6072 null inputs.
6073 </para></entry>
6074 </row>
6075
6076 <row>
6077 <entry role="catalog_table_entry"><para role="column_definition">
6078 <structfield>proretset</structfield> <type>bool</type>
6079 </para>
6080 <para>
6081 Function returns a set (i.e., multiple values of the specified
6082 data type)
6083 </para></entry>
6084 </row>
6085
6086 <row>
6087 <entry role="catalog_table_entry"><para role="column_definition">
6088 <structfield>provolatile</structfield> <type>char</type>
6089 </para>
6090 <para>
6091 <structfield>provolatile</structfield> tells whether the function's
6092 result depends only on its input arguments, or is affected by outside
6093 factors.
6094 It is <literal>i</literal> for <quote>immutable</quote> functions,
6095 which always deliver the same result for the same inputs.
6096 It is <literal>s</literal> for <quote>stable</quote> functions,
6097 whose results (for fixed inputs) do not change within a scan.
6098 It is <literal>v</literal> for <quote>volatile</quote> functions,
6099 whose results might change at any time. (Use <literal>v</literal> also
6100 for functions with side-effects, so that calls to them cannot get
6101 optimized away.)
6102 </para></entry>
6103 </row>
6104
6105 <row>
6106 <entry role="catalog_table_entry"><para role="column_definition">
6107 <structfield>proparallel</structfield> <type>char</type>
6108 </para>
6109 <para>
6110 <structfield>proparallel</structfield> tells whether the function
6111 can be safely run in parallel mode.
6112 It is <literal>s</literal> for functions which are safe to run in
6113 parallel mode without restriction.
6114 It is <literal>r</literal> for functions which can be run in parallel
6115 mode, but their execution is restricted to the parallel group leader;
6116 parallel worker processes cannot invoke these functions.
6117 It is <literal>u</literal> for functions which are unsafe in parallel
6118 mode; the presence of such a function forces a serial execution plan.
6119 </para></entry>
6120 </row>
6121
6122 <row>
6123 <entry role="catalog_table_entry"><para role="column_definition">
6124 <structfield>pronargs</structfield> <type>int2</type>
6125 </para>
6126 <para>
6127 Number of input arguments
6128 </para></entry>
6129 </row>
6130
6131 <row>
6132 <entry role="catalog_table_entry"><para role="column_definition">
6133 <structfield>pronargdefaults</structfield> <type>int2</type>
6134 </para>
6135 <para>
6136 Number of arguments that have defaults
6137 </para></entry>
6138 </row>
6139
6140 <row>
6141 <entry role="catalog_table_entry"><para role="column_definition">
6142 <structfield>prorettype</structfield> <type>oid</type>
6143 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6144 </para>
6145 <para>
6146 Data type of the return value
6147 </para></entry>
6148 </row>
6149
6150 <row>
6151 <entry role="catalog_table_entry"><para role="column_definition">
6152 <structfield>proargtypes</structfield> <type>oidvector</type>
6153 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6154 </para>
6155 <para>
6156 An array of the data types of the function arguments. This includes
6157 only input arguments (including <literal>INOUT</literal> and
6158 <literal>VARIADIC</literal> arguments), and thus represents
6159 the call signature of the function.
6160 </para></entry>
6161 </row>
6162
6163 <row>
6164 <entry role="catalog_table_entry"><para role="column_definition">
6165 <structfield>proallargtypes</structfield> <type>oid[]</type>
6166 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6167 </para>
6168 <para>
6169 An array of the data types of the function arguments. This includes
6170 all arguments (including <literal>OUT</literal> and
6171 <literal>INOUT</literal> arguments); however, if all the
6172 arguments are <literal>IN</literal> arguments, this field will be null.
6173 Note that subscripting is 1-based, whereas for historical reasons
6174 <structfield>proargtypes</structfield> is subscripted from 0.
6175 </para></entry>
6176 </row>
6177
6178 <row>
6179 <entry role="catalog_table_entry"><para role="column_definition">
6180 <structfield>proargmodes</structfield> <type>char[]</type>
6181 </para>
6182 <para>
6183 An array of the modes of the function arguments, encoded as
6184 <literal>i</literal> for <literal>IN</literal> arguments,
6185 <literal>o</literal> for <literal>OUT</literal> arguments,
6186 <literal>b</literal> for <literal>INOUT</literal> arguments,
6187 <literal>v</literal> for <literal>VARIADIC</literal> arguments,
6188 <literal>t</literal> for <literal>TABLE</literal> arguments.
6189 If all the arguments are <literal>IN</literal> arguments,
6190 this field will be null.
6191 Note that subscripts correspond to positions of
6192 <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
6193 </para></entry>
6194 </row>
6195
6196 <row>
6197 <entry role="catalog_table_entry"><para role="column_definition">
6198 <structfield>proargnames</structfield> <type>text[]</type>
6199 </para>
6200 <para>
6201 An array of the names of the function arguments.
6202 Arguments without a name are set to empty strings in the array.
6203 If none of the arguments have a name, this field will be null.
6204 Note that subscripts correspond to positions of
6205 <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
6206 </para></entry>
6207 </row>
6208
6209 <row>
6210 <entry role="catalog_table_entry"><para role="column_definition">
6211 <structfield>proargdefaults</structfield> <type>pg_node_tree</type>
6212 </para>
6213 <para>
6214 Expression trees (in <function>nodeToString()</function> representation)
6215 for default values. This is a list with
6216 <structfield>pronargdefaults</structfield> elements, corresponding to the last
6217 <replaceable>N</replaceable> <emphasis>input</emphasis> arguments (i.e., the last
6218 <replaceable>N</replaceable> <structfield>proargtypes</structfield> positions).
6219 If none of the arguments have defaults, this field will be null.
6220 </para></entry>
6221 </row>
6222
6223 <row>
6224 <entry role="catalog_table_entry"><para role="column_definition">
6225 <structfield>protrftypes</structfield> <type>oid[]</type>
6226 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6227 </para>
6228 <para>
6229 An array of the argument/result data type(s) for which to apply
6230 transforms (from the function's <literal>TRANSFORM</literal>
6231 clause). Null if none.
6232 </para></entry>
6233 </row>
6234
6235 <row>
6236 <entry role="catalog_table_entry"><para role="column_definition">
6237 <structfield>prosrc</structfield> <type>text</type>
6238 </para>
6239 <para>
6240 This tells the function handler how to invoke the function. It
6241 might be the actual source code of the function for interpreted
6242 languages, a link symbol, a file name, or just about anything
6243 else, depending on the implementation language/call convention.
6244 </para></entry>
6245 </row>
6246
6247 <row>
6248 <entry role="catalog_table_entry"><para role="column_definition">
6249 <structfield>probin</structfield> <type>text</type>
6250 </para>
6251 <para>
6252 Additional information about how to invoke the function.
6253 Again, the interpretation is language-specific.
6254 </para></entry>
6255 </row>
6256
6257 <row>
6258 <entry role="catalog_table_entry"><para role="column_definition">
6259 <structfield>prosqlbody</structfield> <type>pg_node_tree</type>
6260 </para>
6261 <para>
6262 Pre-parsed SQL function body. This is used for SQL-language
6263 functions when the body is given in SQL-standard notation
6264 rather than as a string literal. It's null in other cases.
6265 </para></entry>
6266 </row>
6267
6268 <row>
6269 <entry role="catalog_table_entry"><para role="column_definition">
6270 <structfield>proconfig</structfield> <type>text[]</type>
6271 </para>
6272 <para>
6273 Function's local settings for run-time configuration variables
6274 </para></entry>
6275 </row>
6276
6277 <row>
6278 <entry role="catalog_table_entry"><para role="column_definition">
6279 <structfield>proacl</structfield> <type>aclitem[]</type>
6280 </para>
6281 <para>
6282 Access privileges; see <xref linkend="ddl-priv"/> for details
6283 </para></entry>
6284 </row>
6285 </tbody>
6286 </tgroup>
6287 </table>
6288
6289 <para>
6290 For compiled functions, both built-in and dynamically loaded,
6291 <structfield>prosrc</structfield> contains the function's C-language
6292 name (link symbol).
6293 For SQL-language functions, <structfield>prosrc</structfield> contains
6294 the function's source text if that is specified as a string literal;
6295 but if the function body is specified in SQL-standard style,
6296 <structfield>prosrc</structfield> is unused (typically it's an empty
6297 string) and <structfield>prosqlbody</structfield> contains the
6298 pre-parsed definition.
6299 For all other currently-known language types,
6300 <structfield>prosrc</structfield> contains the function's source
6301 text. <structfield>probin</structfield> is null except for
6302 dynamically-loaded C functions, for which it gives the name of the
6303 shared library file containing the function.
6304 </para>
6305
6306 </sect1>
6307
6308 <sect1 id="catalog-pg-publication">
6309 <title><structname>pg_publication</structname></title>
6310
6311 <indexterm zone="catalog-pg-publication">
6312 <primary>pg_publication</primary>
6313 </indexterm>
6314
6315 <para>
6316 The catalog <structname>pg_publication</structname> contains all
6317 publications created in the database. For more on publications see
6318 <xref linkend="logical-replication-publication"/>.
6319 </para>
6320
6321 <table>
6322 <title><structname>pg_publication</structname> Columns</title>
6323 <tgroup cols="1">
6324 <thead>
6325 <row>
6326 <entry role="catalog_table_entry"><para role="column_definition">
6327 Column Type
6328 </para>
6329 <para>
6330 Description
6331 </para></entry>
6332 </row>
6333 </thead>
6334
6335 <tbody>
6336 <row>
6337 <entry role="catalog_table_entry"><para role="column_definition">
6338 <structfield>oid</structfield> <type>oid</type>
6339 </para>
6340 <para>
6341 Row identifier
6342 </para></entry>
6343 </row>
6344
6345 <row>
6346 <entry role="catalog_table_entry"><para role="column_definition">
6347 <structfield>pubname</structfield> <type>name</type>
6348 </para>
6349 <para>
6350 Name of the publication
6351 </para></entry>
6352 </row>
6353
6354 <row>
6355 <entry role="catalog_table_entry"><para role="column_definition">
6356 <structfield>pubowner</structfield> <type>oid</type>
6357 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
6358 </para>
6359 <para>
6360 Owner of the publication
6361 </para></entry>
6362 </row>
6363
6364 <row>
6365 <entry role="catalog_table_entry"><para role="column_definition">
6366 <structfield>puballtables</structfield> <type>bool</type>
6367 </para>
6368 <para>
6369 If true, this publication automatically includes all tables
6370 in the database, including any that will be created in the future.
6371 </para></entry>
6372 </row>
6373
6374 <row>
6375 <entry role="catalog_table_entry"><para role="column_definition">
6376 <structfield>pubinsert</structfield> <type>bool</type>
6377 </para>
6378 <para>
6379 If true, <xref linkend="sql-insert"/> operations are replicated for
6380 tables in the publication.
6381 </para></entry>
6382 </row>
6383
6384 <row>
6385 <entry role="catalog_table_entry"><para role="column_definition">
6386 <structfield>pubupdate</structfield> <type>bool</type>
6387 </para>
6388 <para>
6389 If true, <xref linkend="sql-update"/> operations are replicated for
6390 tables in the publication.
6391 </para></entry>
6392 </row>
6393
6394 <row>
6395 <entry role="catalog_table_entry"><para role="column_definition">
6396 <structfield>pubdelete</structfield> <type>bool</type>
6397 </para>
6398 <para>
6399 If true, <xref linkend="sql-delete"/> operations are replicated for
6400 tables in the publication.
6401 </para></entry>
6402 </row>
6403
6404 <row>
6405 <entry role="catalog_table_entry"><para role="column_definition">
6406 <structfield>pubtruncate</structfield> <type>bool</type>
6407 </para>
6408 <para>
6409 If true, <xref linkend="sql-truncate"/> operations are replicated for
6410 tables in the publication.
6411 </para></entry>
6412 </row>
6413
6414 <row>
6415 <entry role="catalog_table_entry"><para role="column_definition">
6416 <structfield>pubviaroot</structfield> <type>bool</type>
6417 </para>
6418 <para>
6419 If true, operations on a leaf partition are replicated using the
6420 identity and schema of its topmost partitioned ancestor mentioned in the
6421 publication instead of its own.
6422 </para></entry>
6423 </row>
6424
6425 <row>
6426 <entry role="catalog_table_entry"><para role="column_definition">
6427 <structfield>pubgencols</structfield> <type>char</type>
6428 </para>
6429 <para>
6430 Controls how to handle generated column replication when there is no
6431 publication column list:
6432 <literal>n</literal> = generated columns in the tables associated with
6433 the publication should not be replicated,
6434 <literal>s</literal> = stored generated columns in the tables associated
6435 with the publication should be replicated.
6436 </para></entry>
6437 </row>
6438 </tbody>
6439 </tgroup>
6440 </table>
6441 </sect1>
6442
6443 <sect1 id="catalog-pg-publication-namespace">
6444 <title><structname>pg_publication_namespace</structname></title>
6445
6446 <indexterm zone="catalog-pg-publication-namespace">
6447 <primary>pg_publication_namespace</primary>
6448 </indexterm>
6449
6450 <para>
6451 The catalog <structname>pg_publication_namespace</structname> contains the
6452 mapping between schemas and publications in the database. This is a
6453 many-to-many mapping.
6454 </para>
6455
6456 <table>
6457 <title><structname>pg_publication_namespace</structname> Columns</title>
6458 <tgroup cols="1">
6459 <thead>
6460 <row>
6461 <entry role="catalog_table_entry"><para role="column_definition">
6462 Column Type
6463 </para>
6464 <para>
6465 Description
6466 </para></entry>
6467 </row>
6468 </thead>
6469
6470 <tbody>
6471 <row>
6472 <entry role="catalog_table_entry"><para role="column_definition">
6473 <structfield>oid</structfield> <type>oid</type>
6474 </para>
6475 <para>
6476 Row identifier
6477 </para></entry>
6478 </row>
6479
6480 <row>
6481 <entry role="catalog_table_entry"><para role="column_definition">
6482 <structfield>pnpubid</structfield> <type>oid</type>
6483 (references <link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.<structfield>oid</structfield>)
6484 </para>
6485 <para>
6486 Reference to publication
6487 </para></entry>
6488 </row>
6489
6490 <row>
6491 <entry role="catalog_table_entry"><para role="column_definition">
6492 <structfield>pnnspid</structfield> <type>oid</type>
6493 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
6494 </para>
6495 <para>
6496 Reference to schema
6497 </para></entry>
6498 </row>
6499 </tbody>
6500 </tgroup>
6501 </table>
6502 </sect1>
6503
6504 <sect1 id="catalog-pg-publication-rel">
6505 <title><structname>pg_publication_rel</structname></title>
6506
6507 <indexterm zone="catalog-pg-publication-rel">
6508 <primary>pg_publication_rel</primary>
6509 </indexterm>
6510
6511 <para>
6512 The catalog <structname>pg_publication_rel</structname> contains the
6513 mapping between relations and publications in the database. This is a
6514 many-to-many mapping. See also <xref linkend="view-pg-publication-tables"/>
6515 for a more user-friendly view of this information.
6516 </para>
6517
6518 <table>
6519 <title><structname>pg_publication_rel</structname> Columns</title>
6520 <tgroup cols="1">
6521 <thead>
6522 <row>
6523 <entry role="catalog_table_entry"><para role="column_definition">
6524 Column Type
6525 </para>
6526 <para>
6527 Description
6528 </para></entry>
6529 </row>
6530 </thead>
6531
6532 <tbody>
6533 <row>
6534 <entry role="catalog_table_entry"><para role="column_definition">
6535 <structfield>oid</structfield> <type>oid</type>
6536 </para>
6537 <para>
6538 Row identifier
6539 </para></entry>
6540 </row>
6541
6542 <row>
6543 <entry role="catalog_table_entry"><para role="column_definition">
6544 <structfield>prpubid</structfield> <type>oid</type>
6545 (references <link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.<structfield>oid</structfield>)
6546 </para>
6547 <para>
6548 Reference to publication
6549 </para></entry>
6550 </row>
6551
6552 <row>
6553 <entry role="catalog_table_entry"><para role="column_definition">
6554 <structfield>prrelid</structfield> <type>oid</type>
6555 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6556 </para>
6557 <para>
6558 Reference to relation
6559 </para></entry>
6560 </row>
6561
6562 <row>
6563 <entry role="catalog_table_entry"><para role="column_definition">
6564 <structfield>prqual</structfield> <type>pg_node_tree</type>
6565 </para>
6566 <para>Expression tree (in <function>nodeToString()</function>
6567 representation) for the relation's publication qualifying condition. Null
6568 if there is no publication qualifying condition.</para></entry>
6569 </row>
6570
6571 <row>
6572 <entry role="catalog_table_entry"><para role="column_definition">
6573 <structfield>prattrs</structfield> <type>int2vector</type>
6574 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
6575 </para>
6576 <para>
6577 This is an array of values that indicates which table columns are
6578 part of the publication. For example, a value of <literal>1 3</literal>
6579 would mean that the first and the third table columns are published.
6580 A null value indicates that all columns are published.
6581 </para></entry>
6582 </row>
6583 </tbody>
6584 </tgroup>
6585 </table>
6586 </sect1>
6587
6588 <sect1 id="catalog-pg-range">
6589 <title><structname>pg_range</structname></title>
6590
6591 <indexterm zone="catalog-pg-range">
6592 <primary>pg_range</primary>
6593 </indexterm>
6594
6595 <para>
6596 The catalog <structname>pg_range</structname> stores information about
6597 range types. This is in addition to the types' entries in
6598 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
6599 </para>
6600
6601 <table>
6602 <title><structname>pg_range</structname> Columns</title>
6603 <tgroup cols="1">
6604 <thead>
6605 <row>
6606 <entry role="catalog_table_entry"><para role="column_definition">
6607 Column Type
6608 </para>
6609 <para>
6610 Description
6611 </para></entry>
6612 </row>
6613 </thead>
6614
6615 <tbody>
6616 <row>
6617 <entry role="catalog_table_entry"><para role="column_definition">
6618 <structfield>rngtypid</structfield> <type>oid</type>
6619 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6620 </para>
6621 <para>
6622 OID of the range type
6623 </para></entry>
6624 </row>
6625
6626 <row>
6627 <entry role="catalog_table_entry"><para role="column_definition">
6628 <structfield>rngsubtype</structfield> <type>oid</type>
6629 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6630 </para>
6631 <para>
6632 OID of the element type (subtype) of this range type
6633 </para></entry>
6634 </row>
6635
6636 <row>
6637 <entry role="catalog_table_entry"><para role="column_definition">
6638 <structfield>rngmultitypid</structfield> <type>oid</type>
6639 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6640 </para>
6641 <para>
6642 OID of the multirange type for this range type
6643 </para></entry>
6644 </row>
6645
6646 <row>
6647 <entry role="catalog_table_entry"><para role="column_definition">
6648 <structfield>rngcollation</structfield> <type>oid</type>
6649 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
6650 </para>
6651 <para>
6652 OID of the collation used for range comparisons, or zero if none
6653 </para></entry>
6654 </row>
6655
6656 <row>
6657 <entry role="catalog_table_entry"><para role="column_definition">
6658 <structfield>rngsubopc</structfield> <type>oid</type>
6659 (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
6660 </para>
6661 <para>
6662 OID of the subtype's operator class used for range comparisons
6663 </para></entry>
6664 </row>
6665
6666 <row>
6667 <entry role="catalog_table_entry"><para role="column_definition">
6668 <structfield>rngcanonical</structfield> <type>regproc</type>
6669 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
6670 </para>
6671 <para>
6672 OID of the function to convert a range value into canonical form,
6673 or zero if none
6674 </para></entry>
6675 </row>
6676
6677 <row>
6678 <entry role="catalog_table_entry"><para role="column_definition">
6679 <structfield>rngsubdiff</structfield> <type>regproc</type>
6680 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
6681 </para>
6682 <para>
6683 OID of the function to return the difference between two element
6684 values as <type>double precision</type>, or zero if none
6685 </para></entry>
6686 </row>
6687 </tbody>
6688 </tgroup>
6689 </table>
6690
6691 <para>
6692 <structfield>rngsubopc</structfield> (plus <structfield>rngcollation</structfield>, if the
6693 element type is collatable) determines the sort ordering used by the range
6694 type. <structfield>rngcanonical</structfield> is used when the element type is
6695 discrete. <structfield>rngsubdiff</structfield> is optional but should be supplied to
6696 improve performance of GiST indexes on the range type.
6697 </para>
6698
6699 </sect1>
6700
6701 <sect1 id="catalog-pg-replication-origin">
6702 <title><structname>pg_replication_origin</structname></title>
6703
6704 <indexterm zone="catalog-pg-replication-origin">
6705 <primary>pg_replication_origin</primary>
6706 </indexterm>
6707
6708 <para>
6709 The <structname>pg_replication_origin</structname> catalog contains
6710 all replication origins created. For more on replication origins
6711 see <xref linkend="replication-origins"/>.
6712 </para>
6713
6714 <para>
6715 Unlike most system catalogs, <structname>pg_replication_origin</structname>
6716 is shared across all databases of a cluster: there is only one copy
6717 of <structname>pg_replication_origin</structname> per cluster, not one per
6718 database.
6719 </para>
6720
6721 <table>
6722 <title><structname>pg_replication_origin</structname> Columns</title>
6723 <tgroup cols="1">
6724 <thead>
6725 <row>
6726 <entry role="catalog_table_entry"><para role="column_definition">
6727 Column Type
6728 </para>
6729 <para>
6730 Description
6731 </para></entry>
6732 </row>
6733 </thead>
6734
6735 <tbody>
6736 <row>
6737 <entry role="catalog_table_entry"><para role="column_definition">
6738 <structfield>roident</structfield> <type>oid</type>
6739 </para>
6740 <para>
6741 A unique, cluster-wide identifier for the replication
6742 origin. Should never leave the system.
6743 </para></entry>
6744 </row>
6745
6746 <row>
6747 <entry role="catalog_table_entry"><para role="column_definition">
6748 <structfield>roname</structfield> <type>text</type>
6749 </para>
6750 <para>
6751 The external, user defined, name of a replication
6752 origin.
6753 </para></entry>
6754 </row>
6755 </tbody>
6756 </tgroup>
6757 </table>
6758 </sect1>
6759
6760 <sect1 id="catalog-pg-rewrite">
6761 <title><structname>pg_rewrite</structname></title>
6762
6763 <indexterm zone="catalog-pg-rewrite">
6764 <primary>pg_rewrite</primary>
6765 </indexterm>
6766
6767 <para>
6768 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
6769 </para>
6770
6771 <table>
6772 <title><structname>pg_rewrite</structname> Columns</title>
6773 <tgroup cols="1">
6774 <thead>
6775 <row>
6776 <entry role="catalog_table_entry"><para role="column_definition">
6777 Column Type
6778 </para>
6779 <para>
6780 Description
6781 </para></entry>
6782 </row>
6783 </thead>
6784
6785 <tbody>
6786 <row>
6787 <entry role="catalog_table_entry"><para role="column_definition">
6788 <structfield>oid</structfield> <type>oid</type>
6789 </para>
6790 <para>
6791 Row identifier
6792 </para></entry>
6793 </row>
6794
6795 <row>
6796 <entry role="catalog_table_entry"><para role="column_definition">
6797 <structfield>rulename</structfield> <type>name</type>
6798 </para>
6799 <para>
6800 Rule name
6801 </para></entry>
6802 </row>
6803
6804 <row>
6805 <entry role="catalog_table_entry"><para role="column_definition">
6806 <structfield>ev_class</structfield> <type>oid</type>
6807 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6808 </para>
6809 <para>
6810 The table this rule is for
6811 </para></entry>
6812 </row>
6813
6814 <row>
6815 <entry role="catalog_table_entry"><para role="column_definition">
6816 <structfield>ev_type</structfield> <type>char</type>
6817 </para>
6818 <para>
6819 Event type that the rule is for: 1 = <xref linkend="sql-select"/>, 2 =
6820 <xref linkend="sql-update"/>, 3 = <xref linkend="sql-insert"/>, 4 =
6821 <xref linkend="sql-delete"/>
6822 </para></entry>
6823 </row>
6824
6825 <row>
6826 <entry role="catalog_table_entry"><para role="column_definition">
6827 <structfield>ev_enabled</structfield> <type>char</type>
6828 </para>
6829 <para>
6830 Controls in which <xref linkend="guc-session-replication-role"/> modes
6831 the rule fires.
6832 <literal>O</literal> = rule fires in <quote>origin</quote> and <quote>local</quote> modes,
6833 <literal>D</literal> = rule is disabled,
6834 <literal>R</literal> = rule fires in <quote>replica</quote> mode,
6835 <literal>A</literal> = rule fires always.
6836 </para></entry>
6837 </row>
6838
6839 <row>
6840 <entry role="catalog_table_entry"><para role="column_definition">
6841 <structfield>is_instead</structfield> <type>bool</type>
6842 </para>
6843 <para>
6844 True if the rule is an <literal>INSTEAD</literal> rule
6845 </para></entry>
6846 </row>
6847
6848 <row>
6849 <entry role="catalog_table_entry"><para role="column_definition">
6850 <structfield>ev_qual</structfield> <type>pg_node_tree</type>
6851 </para>
6852 <para>
6853 Expression tree (in the form of a
6854 <function>nodeToString()</function> representation) for the
6855 rule's qualifying condition
6856 </para></entry>
6857 </row>
6858
6859 <row>
6860 <entry role="catalog_table_entry"><para role="column_definition">
6861 <structfield>ev_action</structfield> <type>pg_node_tree</type>
6862 </para>
6863 <para>
6864 Query tree (in the form of a
6865 <function>nodeToString()</function> representation) for the
6866 rule's action
6867 </para></entry>
6868 </row>
6869 </tbody>
6870 </tgroup>
6871 </table>
6872
6873 <note>
6874 <para>
6875 <literal>pg_class.relhasrules</literal>
6876 must be true if a table has any rules in this catalog.
6877 </para>
6878 </note>
6879
6880 </sect1>
6881
6882 <sect1 id="catalog-pg-seclabel">
6883 <title><structname>pg_seclabel</structname></title>
6884
6885 <indexterm zone="catalog-pg-seclabel">
6886 <primary>pg_seclabel</primary>
6887 </indexterm>
6888
6889 <para>
6890 The catalog <structname>pg_seclabel</structname> stores security
6891 labels on database objects. Security labels can be manipulated
6892 with the <link linkend="sql-security-label"><command>SECURITY LABEL</command></link> command. For an easier
6893 way to view security labels, see <xref linkend="view-pg-seclabels"/>.
6894 </para>
6895
6896 <para>
6897 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
6898 which performs a similar function for security labels of database objects
6899 that are shared across a database cluster.
6900 </para>
6901
6902 <table>
6903 <title><structname>pg_seclabel</structname> Columns</title>
6904 <tgroup cols="1">
6905 <thead>
6906 <row>
6907 <entry role="catalog_table_entry"><para role="column_definition">
6908 Column Type
6909 </para>
6910 <para>
6911 Description
6912 </para></entry>
6913 </row>
6914 </thead>
6915
6916 <tbody>
6917 <row>
6918 <entry role="catalog_table_entry"><para role="column_definition">
6919 <structfield>objoid</structfield> <type>oid</type>
6920 (references any OID column)
6921 </para>
6922 <para>
6923 The OID of the object this security label pertains to
6924 </para></entry>
6925 </row>
6926
6927 <row>
6928 <entry role="catalog_table_entry"><para role="column_definition">
6929 <structfield>classoid</structfield> <type>oid</type>
6930 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6931 </para>
6932 <para>
6933 The OID of the system catalog this object appears in
6934 </para></entry>
6935 </row>
6936
6937 <row>
6938 <entry role="catalog_table_entry"><para role="column_definition">
6939 <structfield>objsubid</structfield> <type>int4</type>
6940 </para>
6941 <para>
6942 For a security label on a table column, this is the column number (the
6943 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
6944 the table itself). For all other object types, this column is
6945 zero.
6946 </para></entry>
6947 </row>
6948
6949 <row>
6950 <entry role="catalog_table_entry"><para role="column_definition">
6951 <structfield>provider</structfield> <type>text</type>
6952 </para>
6953 <para>
6954 The label provider associated with this label.
6955 </para></entry>
6956 </row>
6957
6958 <row>
6959 <entry role="catalog_table_entry"><para role="column_definition">
6960 <structfield>label</structfield> <type>text</type>
6961 </para>
6962 <para>
6963 The security label applied to this object.
6964 </para></entry>
6965 </row>
6966 </tbody>
6967 </tgroup>
6968 </table>
6969 </sect1>
6970
6971 <sect1 id="catalog-pg-sequence">
6972 <title><structname>pg_sequence</structname></title>
6973
6974 <indexterm zone="catalog-pg-sequence">
6975 <primary>pg_sequence</primary>
6976 </indexterm>
6977
6978 <para>
6979 The catalog <structname>pg_sequence</structname> contains information about
6980 sequences. Some of the information about sequences, such as the name and
6981 the schema, is in
6982 <link linkend="catalog-pg-class"><structname>pg_class</structname></link>
6983 </para>
6984
6985 <table>
6986 <title><structname>pg_sequence</structname> Columns</title>
6987 <tgroup cols="1">
6988 <thead>
6989 <row>
6990 <entry role="catalog_table_entry"><para role="column_definition">
6991 Column Type
6992 </para>
6993 <para>
6994 Description
6995 </para></entry>
6996 </row>
6997 </thead>
6998
6999 <tbody>
7000 <row>
7001 <entry role="catalog_table_entry"><para role="column_definition">
7002 <structfield>seqrelid</structfield> <type>oid</type>
7003 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7004 </para>
7005 <para>
7006 The OID of the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry for this sequence
7007 </para></entry>
7008 </row>
7009
7010 <row>
7011 <entry role="catalog_table_entry"><para role="column_definition">
7012 <structfield>seqtypid</structfield> <type>oid</type>
7013 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
7014 </para>
7015 <para>
7016 Data type of the sequence
7017 </para></entry>
7018 </row>
7019
7020 <row>
7021 <entry role="catalog_table_entry"><para role="column_definition">
7022 <structfield>seqstart</structfield> <type>int8</type>
7023 </para>
7024 <para>
7025 Start value of the sequence
7026 </para></entry>
7027 </row>
7028
7029 <row>
7030 <entry role="catalog_table_entry"><para role="column_definition">
7031 <structfield>seqincrement</structfield> <type>int8</type>
7032 </para>
7033 <para>
7034 Increment value of the sequence
7035 </para></entry>
7036 </row>
7037
7038 <row>
7039 <entry role="catalog_table_entry"><para role="column_definition">
7040 <structfield>seqmax</structfield> <type>int8</type>
7041 </para>
7042 <para>
7043 Maximum value of the sequence
7044 </para></entry>
7045 </row>
7046
7047 <row>
7048 <entry role="catalog_table_entry"><para role="column_definition">
7049 <structfield>seqmin</structfield> <type>int8</type>
7050 </para>
7051 <para>
7052 Minimum value of the sequence
7053 </para></entry>
7054 </row>
7055
7056 <row>
7057 <entry role="catalog_table_entry"><para role="column_definition">
7058 <structfield>seqcache</structfield> <type>int8</type>
7059 </para>
7060 <para>
7061 Cache size of the sequence
7062 </para></entry>
7063 </row>
7064
7065 <row>
7066 <entry role="catalog_table_entry"><para role="column_definition">
7067 <structfield>seqcycle</structfield> <type>bool</type>
7068 </para>
7069 <para>
7070 Whether the sequence cycles
7071 </para></entry>
7072 </row>
7073 </tbody>
7074 </tgroup>
7075 </table>
7076 </sect1>
7077
7078 <sect1 id="catalog-pg-shdepend">
7079 <title><structname>pg_shdepend</structname></title>
7080
7081 <indexterm zone="catalog-pg-shdepend">
7082 <primary>pg_shdepend</primary>
7083 </indexterm>
7084
7085 <para>
7086 The catalog <structname>pg_shdepend</structname> records the
7087 dependency relationships between database objects and shared objects,
7088 such as roles. This information allows
7089 <productname>PostgreSQL</productname> to ensure that those objects are
7090 unreferenced before attempting to delete them.
7091 </para>
7092
7093 <para>
7094 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
7095 which performs a similar function for dependencies involving objects
7096 within a single database.
7097 </para>
7098
7099 <para>
7100 Unlike most system catalogs, <structname>pg_shdepend</structname>
7101 is shared across all databases of a cluster: there is only one
7102 copy of <structname>pg_shdepend</structname> per cluster, not
7103 one per database.
7104 </para>
7105
7106 <table>
7107 <title><structname>pg_shdepend</structname> Columns</title>
7108 <tgroup cols="1">
7109 <thead>
7110 <row>
7111 <entry role="catalog_table_entry"><para role="column_definition">
7112 Column Type
7113 </para>
7114 <para>
7115 Description
7116 </para></entry>
7117 </row>
7118 </thead>
7119
7120 <tbody>
7121 <row>
7122 <entry role="catalog_table_entry"><para role="column_definition">
7123 <structfield>dbid</structfield> <type>oid</type>
7124 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
7125 </para>
7126 <para>
7127 The OID of the database the dependent object is in,
7128 or zero for a shared object
7129 </para></entry>
7130 </row>
7131
7132 <row>
7133 <entry role="catalog_table_entry"><para role="column_definition">
7134 <structfield>classid</structfield> <type>oid</type>
7135 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7136 </para>
7137 <para>
7138 The OID of the system catalog the dependent object is in
7139 </para></entry>
7140 </row>
7141
7142 <row>
7143 <entry role="catalog_table_entry"><para role="column_definition">
7144 <structfield>objid</structfield> <type>oid</type>
7145 (references any OID column)
7146 </para>
7147 <para>
7148 The OID of the specific dependent object
7149 </para></entry>
7150 </row>
7151
7152 <row>
7153 <entry role="catalog_table_entry"><para role="column_definition">
7154 <structfield>objsubid</structfield> <type>int4</type>
7155 </para>
7156 <para>
7157 For a table column, this is the column number (the
7158 <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
7159 table itself). For all other object types, this column is zero.
7160 </para></entry>
7161 </row>
7162
7163 <row>
7164 <entry role="catalog_table_entry"><para role="column_definition">
7165 <structfield>refclassid</structfield> <type>oid</type>
7166 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7167 </para>
7168 <para>
7169 The OID of the system catalog the referenced object is in
7170 (must be a shared catalog)
7171 </para></entry>
7172 </row>
7173
7174 <row>
7175 <entry role="catalog_table_entry"><para role="column_definition">
7176 <structfield>refobjid</structfield> <type>oid</type>
7177 (references any OID column)
7178 </para>
7179 <para>
7180 The OID of the specific referenced object
7181 </para></entry>
7182 </row>
7183
7184 <row>
7185 <entry role="catalog_table_entry"><para role="column_definition">
7186 <structfield>deptype</structfield> <type>char</type>
7187 </para>
7188 <para>
7189 A code defining the specific semantics of this dependency relationship; see text
7190 </para></entry>
7191 </row>
7192 </tbody>
7193 </tgroup>
7194 </table>
7195
7196 <para>
7197 In all cases, a <structname>pg_shdepend</structname> entry indicates that
7198 the referenced object cannot be dropped without also dropping the dependent
7199 object. However, there are several subflavors identified by
7200 <structfield>deptype</structfield>:
7201
7202 <variablelist>
7203 <varlistentry>
7204 <term><symbol>SHARED_DEPENDENCY_OWNER</symbol> (<literal>o</literal>)</term>
7205 <listitem>
7206 <para>
7207 The referenced object (which must be a role) is the owner of the
7208 dependent object.
7209 </para>
7210 </listitem>
7211 </varlistentry>
7212
7213 <varlistentry>
7214 <term><symbol>SHARED_DEPENDENCY_ACL</symbol> (<literal>a</literal>)</term>
7215 <listitem>
7216 <para>
7217 The referenced object (which must be a role) is mentioned in the
7218 <acronym>ACL</acronym> of the
7219 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</symbol> entry is
7220 not made for the owner of the object, since the owner will have
7221 a <symbol>SHARED_DEPENDENCY_OWNER</symbol> entry anyway.)
7222 </para>
7223 </listitem>
7224 </varlistentry>
7225
7226 <varlistentry>
7227 <term><symbol>SHARED_DEPENDENCY_INITACL</symbol> (<literal>i</literal>)</term>
7228 <listitem>
7229 <para>
7230 The referenced object (which must be a role) is mentioned in a
7231 <link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link>
7232 entry for the dependent object.
7233 </para>
7234 </listitem>
7235 </varlistentry>
7236
7237 <varlistentry>
7238 <term><symbol>SHARED_DEPENDENCY_POLICY</symbol> (<literal>r</literal>)</term>
7239 <listitem>
7240 <para>
7241 The referenced object (which must be a role) is mentioned as the
7242 target of a dependent policy object.
7243 </para>
7244 </listitem>
7245 </varlistentry>
7246
7247 <varlistentry>
7248 <term><symbol>SHARED_DEPENDENCY_TABLESPACE</symbol> (<literal>t</literal>)</term>
7249 <listitem>
7250 <para>
7251 The referenced object (which must be a tablespace) is mentioned as
7252 the tablespace for a relation that doesn't have storage.
7253 </para>
7254 </listitem>
7255 </varlistentry>
7256 </variablelist>
7257
7258 Other dependency flavors might be needed in future. Note in particular
7259 that the current definition only supports roles and tablespaces as referenced
7260 objects.
7261 </para>
7262
7263 <para>
7264 As in the <structname>pg_depend</structname> catalog, most objects
7265 created during <application>initdb</application> are
7266 considered <quote>pinned</quote>. No entries are made
7267 in <structname>pg_shdepend</structname> that would have a pinned
7268 object as either referenced or dependent object.
7269 </para>
7270
7271 </sect1>
7272
7273 <sect1 id="catalog-pg-shdescription">
7274 <title><structname>pg_shdescription</structname></title>
7275
7276 <indexterm zone="catalog-pg-shdescription">
7277 <primary>pg_shdescription</primary>
7278 </indexterm>
7279
7280 <para>
7281 The catalog <structname>pg_shdescription</structname> stores optional
7282 descriptions (comments) for shared database objects. Descriptions can be
7283 manipulated with the <link linkend="sql-comment"><command>COMMENT</command></link> command and viewed with
7284 <application>psql</application>'s <literal>\d</literal> commands.
7285 </para>
7286
7287 <para>
7288 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
7289 which performs a similar function for descriptions involving objects
7290 within a single database.
7291 </para>
7292
7293 <para>
7294 Unlike most system catalogs, <structname>pg_shdescription</structname>
7295 is shared across all databases of a cluster: there is only one
7296 copy of <structname>pg_shdescription</structname> per cluster, not
7297 one per database.
7298 </para>
7299
7300 <table>
7301 <title><structname>pg_shdescription</structname> Columns</title>
7302 <tgroup cols="1">
7303 <thead>
7304 <row>
7305 <entry role="catalog_table_entry"><para role="column_definition">
7306 Column Type
7307 </para>
7308 <para>
7309 Description
7310 </para></entry>
7311 </row>
7312 </thead>
7313
7314 <tbody>
7315 <row>
7316 <entry role="catalog_table_entry"><para role="column_definition">
7317 <structfield>objoid</structfield> <type>oid</type>
7318 (references any OID column)
7319 </para>
7320 <para>
7321 The OID of the object this description pertains to
7322 </para></entry>
7323 </row>
7324
7325 <row>
7326 <entry role="catalog_table_entry"><para role="column_definition">
7327 <structfield>classoid</structfield> <type>oid</type>
7328 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7329 </para>
7330 <para>
7331 The OID of the system catalog this object appears in
7332 </para></entry>
7333 </row>
7334
7335 <row>
7336 <entry role="catalog_table_entry"><para role="column_definition">
7337 <structfield>description</structfield> <type>text</type>
7338 </para>
7339 <para>
7340 Arbitrary text that serves as the description of this object
7341 </para></entry>
7342 </row>
7343 </tbody>
7344 </tgroup>
7345 </table>
7346
7347 </sect1>
7348
7349 <sect1 id="catalog-pg-shseclabel">
7350 <title><structname>pg_shseclabel</structname></title>
7351
7352 <indexterm zone="catalog-pg-shseclabel">
7353 <primary>pg_shseclabel</primary>
7354 </indexterm>
7355
7356 <para>
7357 The catalog <structname>pg_shseclabel</structname> stores security
7358 labels on shared database objects. Security labels can be manipulated
7359 with the <link linkend="sql-security-label"><command>SECURITY LABEL</command></link> command. For an easier
7360 way to view security labels, see <xref linkend="view-pg-seclabels"/>.
7361 </para>
7362
7363 <para>
7364 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
7365 which performs a similar function for security labels involving objects
7366 within a single database.
7367 </para>
7368
7369 <para>
7370 Unlike most system catalogs, <structname>pg_shseclabel</structname>
7371 is shared across all databases of a cluster: there is only one
7372 copy of <structname>pg_shseclabel</structname> per cluster, not
7373 one per database.
7374 </para>
7375
7376 <table>
7377 <title><structname>pg_shseclabel</structname> Columns</title>
7378 <tgroup cols="1">
7379 <thead>
7380 <row>
7381 <entry role="catalog_table_entry"><para role="column_definition">
7382 Column Type
7383 </para>
7384 <para>
7385 Description
7386 </para></entry>
7387 </row>
7388 </thead>
7389
7390 <tbody>
7391 <row>
7392 <entry role="catalog_table_entry"><para role="column_definition">
7393 <structfield>objoid</structfield> <type>oid</type>
7394 (references any OID column)
7395 </para>
7396 <para>
7397 The OID of the object this security label pertains to
7398 </para></entry>
7399 </row>
7400
7401 <row>
7402 <entry role="catalog_table_entry"><para role="column_definition">
7403 <structfield>classoid</structfield> <type>oid</type>
7404 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7405 </para>
7406 <para>
7407 The OID of the system catalog this object appears in
7408 </para></entry>
7409 </row>
7410
7411 <row>
7412 <entry role="catalog_table_entry"><para role="column_definition">
7413 <structfield>provider</structfield> <type>text</type>
7414 </para>
7415 <para>
7416 The label provider associated with this label.
7417 </para></entry>
7418 </row>
7419
7420 <row>
7421 <entry role="catalog_table_entry"><para role="column_definition">
7422 <structfield>label</structfield> <type>text</type>
7423 </para>
7424 <para>
7425 The security label applied to this object.
7426 </para></entry>
7427 </row>
7428 </tbody>
7429 </tgroup>
7430 </table>
7431 </sect1>
7432
7433 <sect1 id="catalog-pg-statistic">
7434 <title><structname>pg_statistic</structname></title>
7435
7436 <indexterm zone="catalog-pg-statistic">
7437 <primary>pg_statistic</primary>
7438 </indexterm>
7439
7440 <para>
7441 The catalog <structname>pg_statistic</structname> stores
7442 statistical data about the contents of the database. Entries are
7443 created by <link linkend="sql-analyze"><command>ANALYZE</command></link>
7444 and subsequently used by the query planner. Note that all the
7445 statistical data is inherently approximate, even assuming that it
7446 is up-to-date.
7447 </para>
7448
7449 <para>
7450 Normally there is one entry, with <structfield>stainherit</structfield> =
7451 <literal>false</literal>, for each table column that has been analyzed.
7452 If the table has inheritance children or partitions, a second entry with
7453 <structfield>stainherit</structfield> = <literal>true</literal> is also created. This row
7454 represents the column's statistics over the inheritance tree, i.e.,
7455 statistics for the data you'd see with
7456 <literal>SELECT <replaceable>column</replaceable> FROM <replaceable>table</replaceable>*</literal>,
7457 whereas the <structfield>stainherit</structfield> = <literal>false</literal> row represents
7458 the results of
7459 <literal>SELECT <replaceable>column</replaceable> FROM ONLY <replaceable>table</replaceable></literal>.
7460 </para>
7461
7462 <para>
7463 <structname>pg_statistic</structname> also stores statistical data about
7464 the values of index expressions. These are described as if they were
7465 actual data columns; in particular, <structfield>starelid</structfield>
7466 references the index. No entry is made for an ordinary non-expression
7467 index column, however, since it would be redundant with the entry
7468 for the underlying table column. Currently, entries for index expressions
7469 always have <structfield>stainherit</structfield> = <literal>false</literal>.
7470 </para>
7471
7472 <para>
7473 Since different kinds of statistics might be appropriate for different
7474 kinds of data, <structname>pg_statistic</structname> is designed not
7475 to assume very much about what sort of statistics it stores. Only
7476 extremely general statistics (such as nullness) are given dedicated
7477 columns in <structname>pg_statistic</structname>. Everything else
7478 is stored in <quote>slots</quote>, which are groups of associated columns
7479 whose content is identified by a code number in one of the slot's columns.
7480 For more information see
7481 <filename>src/include/catalog/pg_statistic.h</filename>.
7482 </para>
7483
7484 <para>
7485 <structname>pg_statistic</structname> should not be readable by the
7486 public, since even statistical information about a table's contents
7487 might be considered sensitive. (Example: minimum and maximum values
7488 of a salary column might be quite interesting.)
7489 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
7490 is a publicly readable view on
7491 <structname>pg_statistic</structname> that only exposes information
7492 about those tables that are readable by the current user.
7493 </para>
7494
7495 <table>
7496 <title><structname>pg_statistic</structname> Columns</title>
7497 <tgroup cols="1">
7498 <thead>
7499 <row>
7500 <entry role="catalog_table_entry"><para role="column_definition">
7501 Column Type
7502 </para>
7503 <para>
7504 Description
7505 </para></entry>
7506 </row>
7507 </thead>
7508
7509 <tbody>
7510 <row>
7511 <entry role="catalog_table_entry"><para role="column_definition">
7512 <structfield>starelid</structfield> <type>oid</type>
7513 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7514 </para>
7515 <para>
7516 The table or index that the described column belongs to
7517 </para></entry>
7518 </row>
7519
7520 <row>
7521 <entry role="catalog_table_entry"><para role="column_definition">
7522 <structfield>staattnum</structfield> <type>int2</type>
7523 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
7524 </para>
7525 <para>
7526 The number of the described column
7527 </para></entry>
7528 </row>
7529
7530 <row>
7531 <entry role="catalog_table_entry"><para role="column_definition">
7532 <structfield>stainherit</structfield> <type>bool</type>
7533 </para>
7534 <para>
7535 If true, the stats include values from child tables, not just the
7536 values in the specified relation
7537 </para></entry>
7538 </row>
7539
7540 <row>
7541 <entry role="catalog_table_entry"><para role="column_definition">
7542 <structfield>stanullfrac</structfield> <type>float4</type>
7543 </para>
7544 <para>
7545 The fraction of the column's entries that are null
7546 </para></entry>
7547 </row>
7548
7549 <row>
7550 <entry role="catalog_table_entry"><para role="column_definition">
7551 <structfield>stawidth</structfield> <type>int4</type>
7552 </para>
7553 <para>
7554 The average stored width, in bytes, of nonnull entries
7555 </para></entry>
7556 </row>
7557
7558 <row>
7559 <entry role="catalog_table_entry"><para role="column_definition">
7560 <structfield>stadistinct</structfield> <type>float4</type>
7561 </para>
7562 <para>
7563 The number of distinct nonnull data values in the column.
7564 A value greater than zero is the actual number of distinct values.
7565 A value less than zero is the negative of a multiplier for the number
7566 of rows in the table; for example, a column in which about 80% of the
7567 values are nonnull and each nonnull value appears about twice on
7568 average could be represented by <structfield>stadistinct</structfield> = -0.4.
7569 A zero value means the number of distinct values is unknown.
7570 </para></entry>
7571 </row>
7572
7573 <row>
7574 <entry role="catalog_table_entry"><para role="column_definition">
7575 <structfield>stakind<replaceable>N</replaceable></structfield> <type>int2</type>
7576 </para>
7577 <para>
7578 A code number indicating the kind of statistics stored in the
7579 <replaceable>N</replaceable>th <quote>slot</quote> of the
7580 <structname>pg_statistic</structname> row.
7581 </para></entry>
7582 </row>
7583
7584 <row>
7585 <entry role="catalog_table_entry"><para role="column_definition">
7586 <structfield>staop<replaceable>N</replaceable></structfield> <type>oid</type>
7587 (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
7588 </para>
7589 <para>
7590 An operator used to derive the statistics stored in the
7591 <replaceable>N</replaceable>th <quote>slot</quote>. For example, a
7592 histogram slot would show the <literal>&lt;</literal> operator
7593 that defines the sort order of the data.
7594 Zero if the statistics kind does not require an operator.
7595 </para></entry>
7596 </row>
7597
7598 <row>
7599 <entry role="catalog_table_entry"><para role="column_definition">
7600 <structfield>stacoll<replaceable>N</replaceable></structfield> <type>oid</type>
7601 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
7602 </para>
7603 <para>
7604 The collation used to derive the statistics stored in the
7605 <replaceable>N</replaceable>th <quote>slot</quote>. For example, a
7606 histogram slot for a collatable column would show the collation that
7607 defines the sort order of the data. Zero for noncollatable data.
7608 </para></entry>
7609 </row>
7610
7611 <row>
7612 <entry role="catalog_table_entry"><para role="column_definition">
7613 <structfield>stanumbers<replaceable>N</replaceable></structfield> <type>float4[]</type>
7614 </para>
7615 <para>
7616 Numerical statistics of the appropriate kind for the
7617 <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
7618 kind does not involve numerical values
7619 </para></entry>
7620 </row>
7621
7622 <row>
7623 <entry role="catalog_table_entry"><para role="column_definition">
7624 <structfield>stavalues<replaceable>N</replaceable></structfield> <type>anyarray</type>
7625 </para>
7626 <para>
7627 Column data values of the appropriate kind for the
7628 <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
7629 kind does not store any data values. Each array's element
7630 values are actually of the specific column's data type, or a related
7631 type such as an array's element type, so there is no way to define
7632 these columns' type more specifically than <type>anyarray</type>.
7633 </para></entry>
7634 </row>
7635 </tbody>
7636 </tgroup>
7637 </table>
7638
7639 </sect1>
7640
7641 <sect1 id="catalog-pg-statistic-ext">
7642 <title><structname>pg_statistic_ext</structname></title>
7643
7644 <indexterm zone="catalog-pg-statistic-ext">
7645 <primary>pg_statistic_ext</primary>
7646 </indexterm>
7647
7648 <para>
7649 The catalog <structname>pg_statistic_ext</structname>
7650 holds definitions of extended planner statistics.
7651 Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
7652 created with <link linkend="sql-createstatistics"><command>CREATE STATISTICS</command></link>.
7653 </para>
7654
7655 <table>
7656 <title><structname>pg_statistic_ext</structname> Columns</title>
7657 <tgroup cols="1">
7658 <thead>
7659 <row>
7660 <entry role="catalog_table_entry"><para role="column_definition">
7661 Column Type
7662 </para>
7663 <para>
7664 Description
7665 </para></entry>
7666 </row>
7667 </thead>
7668
7669 <tbody>
7670 <row>
7671 <entry role="catalog_table_entry"><para role="column_definition">
7672 <structfield>oid</structfield> <type>oid</type>
7673 </para>
7674 <para>
7675 Row identifier
7676 </para></entry>
7677 </row>
7678
7679 <row>
7680 <entry role="catalog_table_entry"><para role="column_definition">
7681 <structfield>stxrelid</structfield> <type>oid</type>
7682 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7683 </para>
7684 <para>
7685 Table containing the columns described by this object
7686 </para></entry>
7687 </row>
7688
7689 <row>
7690 <entry role="catalog_table_entry"><para role="column_definition">
7691 <structfield>stxname</structfield> <type>name</type>
7692 </para>
7693 <para>
7694 Name of the statistics object
7695 </para></entry>
7696 </row>
7697
7698 <row>
7699 <entry role="catalog_table_entry"><para role="column_definition">
7700 <structfield>stxnamespace</structfield> <type>oid</type>
7701 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
7702 </para>
7703 <para>
7704 The OID of the namespace that contains this statistics object
7705 </para></entry>
7706 </row>
7707
7708 <row>
7709 <entry role="catalog_table_entry"><para role="column_definition">
7710 <structfield>stxowner</structfield> <type>oid</type>
7711 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7712 </para>
7713 <para>
7714 Owner of the statistics object
7715 </para></entry>
7716 </row>
7717
7718 <row>
7719 <entry role="catalog_table_entry"><para role="column_definition">
7720 <structfield>stxkeys</structfield> <type>int2vector</type>
7721 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
7722 </para>
7723 <para>
7724 An array of attribute numbers, indicating which table columns are
7725 covered by this statistics object;
7726 for example a value of <literal>1 3</literal> would
7727 mean that the first and the third table columns are covered
7728 </para></entry>
7729 </row>
7730
7731 <row>
7732 <entry role="catalog_table_entry"><para role="column_definition">
7733 <structfield>stxstattarget</structfield> <type>int2</type>
7734 </para>
7735 <para>
7736 <structfield>stxstattarget</structfield> controls the level of detail
7737 of statistics accumulated for this statistics object by
7738 <link linkend="sql-analyze"><command>ANALYZE</command></link>.
7739 A zero value indicates that no statistics should be collected.
7740 A null value says to use the maximum of the statistics targets of
7741 the referenced columns, if set, or the system default statistics target.
7742 Positive values of <structfield>stxstattarget</structfield>
7743 determine the target number of <quote>most common values</quote>
7744 to collect.
7745 </para></entry>
7746 </row>
7747
7748 <row>
7749 <entry role="catalog_table_entry"><para role="column_definition">
7750 <structfield>stxkind</structfield> <type>char[]</type>
7751 </para>
7752 <para>
7753 An array containing codes for the enabled statistics kinds;
7754 valid values are:
7755 <literal>d</literal> for n-distinct statistics,
7756 <literal>f</literal> for functional dependency statistics,
7757 <literal>m</literal> for most common values (MCV) list statistics, and
7758 <literal>e</literal> for expression statistics
7759 </para></entry>
7760 </row>
7761
7762 <row>
7763 <entry role="catalog_table_entry"><para role="column_definition">
7764 <structfield>stxexprs</structfield> <type>pg_node_tree</type>
7765 </para>
7766 <para>
7767 Expression trees (in <function>nodeToString()</function>
7768 representation) for statistics object attributes that are not simple
7769 column references. This is a list with one element per expression.
7770 Null if all statistics object attributes are simple references.
7771 </para></entry>
7772 </row>
7773
7774 </tbody>
7775 </tgroup>
7776 </table>
7777
7778 <para>
7779 The <structname>pg_statistic_ext</structname> entry is filled in
7780 completely during <link linkend="sql-createstatistics"><command>CREATE STATISTICS</command></link>, but the actual
7781 statistical values are not computed then.
7782 Subsequent <link linkend="sql-analyze"><command>ANALYZE</command></link> commands compute the desired values
7783 and populate an entry in the
7784 <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
7785 catalog.
7786 </para>
7787 </sect1>
7788
7789 <sect1 id="catalog-pg-statistic-ext-data">
7790 <title><structname>pg_statistic_ext_data</structname></title>
7791
7792 <indexterm zone="catalog-pg-statistic-ext">
7793 <primary>pg_statistic_ext_data</primary>
7794 </indexterm>
7795
7796 <para>
7797 The catalog <structname>pg_statistic_ext_data</structname>
7798 holds data for extended planner statistics defined in
7799 <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.
7800 Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
7801 created with <link linkend="sql-createstatistics"><command>CREATE STATISTICS</command></link>.
7802 </para>
7803
7804 <para>
7805 Normally there is one entry, with <structfield>stxdinherit</structfield> =
7806 <literal>false</literal>, for each statistics object that has been analyzed.
7807 If the table has inheritance children or partitions, a second entry with
7808 <structfield>stxdinherit</structfield> = <literal>true</literal> is also created.
7809 This row represents the statistics object over the inheritance tree, i.e.,
7810 statistics for the data you'd see with
7811 <literal>SELECT * FROM <replaceable>table</replaceable>*</literal>,
7812 whereas the <structfield>stxdinherit</structfield> = <literal>false</literal> row
7813 represents the results of
7814 <literal>SELECT * FROM ONLY <replaceable>table</replaceable></literal>.
7815 </para>
7816
7817 <para>
7818 Like <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>,
7819 <structname>pg_statistic_ext_data</structname> should not be
7820 readable by the public, since the contents might be considered sensitive.
7821 (Example: most common combinations of values in columns might be quite
7822 interesting.)
7823 <link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link>
7824 is a publicly readable view
7825 on <structname>pg_statistic_ext_data</structname> (after joining
7826 with <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>) that only exposes
7827 information about tables the current user owns.
7828 </para>
7829
7830 <table>
7831 <title><structname>pg_statistic_ext_data</structname> Columns</title>
7832 <tgroup cols="1">
7833 <thead>
7834 <row>
7835 <entry role="catalog_table_entry"><para role="column_definition">
7836 Column Type
7837 </para>
7838 <para>
7839 Description
7840 </para></entry>
7841 </row>
7842 </thead>
7843
7844 <tbody>
7845 <row>
7846 <entry role="catalog_table_entry"><para role="column_definition">
7847 <structfield>stxoid</structfield> <type>oid</type>
7848 (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>oid</structfield>)
7849 </para>
7850 <para>
7851 Extended statistics object containing the definition for this data
7852 </para></entry>
7853 </row>
7854
7855 <row>
7856 <entry role="catalog_table_entry"><para role="column_definition">
7857 <structfield>stxdinherit</structfield> <type>bool</type>
7858 </para>
7859 <para>
7860 If true, the stats include values from child tables, not just the
7861 values in the specified relation
7862 </para></entry>
7863 </row>
7864
7865 <row>
7866 <entry role="catalog_table_entry"><para role="column_definition">
7867 <structfield>stxdndistinct</structfield> <type>pg_ndistinct</type>
7868 </para>
7869 <para>
7870 N-distinct counts, serialized as <structname>pg_ndistinct</structname> type
7871 </para></entry>
7872 </row>
7873
7874 <row>
7875 <entry role="catalog_table_entry"><para role="column_definition">
7876 <structfield>stxddependencies</structfield> <type>pg_dependencies</type>
7877 </para>
7878 <para>
7879 Functional dependency statistics, serialized
7880 as <structname>pg_dependencies</structname> type
7881 </para></entry>
7882 </row>
7883
7884 <row>
7885 <entry role="catalog_table_entry"><para role="column_definition">
7886 <structfield>stxdmcv</structfield> <type>pg_mcv_list</type>
7887 </para>
7888 <para>
7889 MCV (most-common values) list statistics, serialized as
7890 <structname>pg_mcv_list</structname> type
7891 </para></entry>
7892 </row>
7893
7894 <row>
7895 <entry role="catalog_table_entry"><para role="column_definition">
7896 <structfield>stxdexpr</structfield> <type>pg_statistic[]</type>
7897 </para>
7898 <para>
7899 Per-expression statistics, serialized as an array of
7900 <structname>pg_statistic</structname> type
7901 </para></entry>
7902 </row>
7903 </tbody>
7904 </tgroup>
7905 </table>
7906
7907 </sect1>
7908
7909 <sect1 id="catalog-pg-subscription">
7910 <title><structname>pg_subscription</structname></title>
7911
7912 <indexterm zone="catalog-pg-subscription">
7913 <primary>pg_subscription</primary>
7914 </indexterm>
7915
7916 <para>
7917 The catalog <structname>pg_subscription</structname> contains all existing
7918 logical replication subscriptions. For more information about logical
7919 replication see <xref linkend="logical-replication"/>.
7920 </para>
7921
7922 <para>
7923 Unlike most system catalogs, <structname>pg_subscription</structname> is
7924 shared across all databases of a cluster: there is only one copy
7925 of <structname>pg_subscription</structname> per cluster, not one per
7926 database.
7927 </para>
7928
7929 <para>
7930 Access to the column <structfield>subconninfo</structfield> is revoked from
7931 normal users, because it could contain plain-text passwords.
7932 </para>
7933
7934 <table>
7935 <title><structname>pg_subscription</structname> Columns</title>
7936 <tgroup cols="1">
7937 <thead>
7938 <row>
7939 <entry role="catalog_table_entry"><para role="column_definition">
7940 Column Type
7941 </para>
7942 <para>
7943 Description
7944 </para></entry>
7945 </row>
7946 </thead>
7947
7948 <tbody>
7949 <row>
7950 <entry role="catalog_table_entry"><para role="column_definition">
7951 <structfield>oid</structfield> <type>oid</type>
7952 </para>
7953 <para>
7954 Row identifier
7955 </para></entry>
7956 </row>
7957
7958 <row>
7959 <entry role="catalog_table_entry"><para role="column_definition">
7960 <structfield>subdbid</structfield> <type>oid</type>
7961 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
7962 </para>
7963 <para>
7964 OID of the database that the subscription resides in
7965 </para></entry>
7966 </row>
7967
7968 <row>
7969 <entry role="catalog_table_entry"><para role="column_definition">
7970 <structfield>subskiplsn</structfield> <type>pg_lsn</type>
7971 </para>
7972 <para>
7973 Finish LSN of the transaction whose changes are to be skipped, if a valid
7974 LSN; otherwise <literal>0/0</literal>.
7975 </para></entry>
7976 </row>
7977
7978 <row>
7979 <entry role="catalog_table_entry"><para role="column_definition">
7980 <structfield>subname</structfield> <type>name</type>
7981 </para>
7982 <para>
7983 Name of the subscription
7984 </para></entry>
7985 </row>
7986
7987 <row>
7988 <entry role="catalog_table_entry"><para role="column_definition">
7989 <structfield>subowner</structfield> <type>oid</type>
7990 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7991 </para>
7992 <para>
7993 Owner of the subscription
7994 </para></entry>
7995 </row>
7996
7997 <row>
7998 <entry role="catalog_table_entry"><para role="column_definition">
7999 <structfield>subenabled</structfield> <type>bool</type>
8000 </para>
8001 <para>
8002 If true, the subscription is enabled and should be replicating
8003 </para></entry>
8004 </row>
8005
8006 <row>
8007 <entry role="catalog_table_entry"><para role="column_definition">
8008 <structfield>subbinary</structfield> <type>bool</type>
8009 </para>
8010 <para>
8011 If true, the subscription will request that the publisher send data
8012 in binary format
8013 </para></entry>
8014 </row>
8015
8016 <row>
8017 <entry role="catalog_table_entry"><para role="column_definition">
8018 <structfield>substream</structfield> <type>char</type>
8019 </para>
8020 <para>
8021 Controls how to handle the streaming of in-progress transactions:
8022 <literal>f</literal> = disallow streaming of in-progress transactions,
8023 <literal>t</literal> = spill the changes of in-progress transactions to
8024 disk and apply at once after the transaction is committed on the
8025 publisher and received by the subscriber,
8026 <literal>p</literal> = apply changes directly using a parallel apply
8027 worker if available (same as <literal>t</literal> if no worker is
8028 available)
8029 </para></entry>
8030 </row>
8031
8032 <row>
8033 <entry role="catalog_table_entry"><para role="column_definition">
8034 <structfield>subtwophasestate</structfield> <type>char</type>
8035 </para>
8036 <para>
8037 State codes for two-phase mode:
8038 <literal>d</literal> = disabled,
8039 <literal>p</literal> = pending enablement,
8040 <literal>e</literal> = enabled
8041 </para></entry>
8042 </row>
8043
8044 <row>
8045 <entry role="catalog_table_entry"><para role="column_definition">
8046 <structfield>subdisableonerr</structfield> <type>bool</type>
8047 </para>
8048 <para>
8049 If true, the subscription will be disabled if one of its workers
8050 detects an error
8051 </para></entry>
8052 </row>
8053
8054 <row>
8055 <entry role="catalog_table_entry"><para role="column_definition">
8056 <structfield>subpasswordrequired</structfield> <type>bool</type>
8057 </para>
8058 <para>
8059 If true, the subscription will be required to specify a password
8060 for authentication
8061 </para></entry>
8062 </row>
8063
8064 <row>
8065 <entry role="catalog_table_entry"><para role="column_definition">
8066 <structfield>subrunasowner</structfield> <type>bool</type>
8067 </para>
8068 <para>
8069 If true, the subscription will be run with the permissions
8070 of the subscription owner
8071 </para></entry>
8072 </row>
8073
8074 <row>
8075 <entry role="catalog_table_entry"><para role="column_definition">
8076 <structfield>subfailover</structfield> <type>bool</type>
8077 </para>
8078 <para>
8079 If true, the associated replication slots (i.e. the main slot and the
8080 table synchronization slots) in the upstream database are enabled to be
8081 synchronized to the standbys
8082 </para></entry>
8083 </row>
8084
8085 <row>
8086 <entry role="catalog_table_entry"><para role="column_definition">
8087 <structfield>subconninfo</structfield> <type>text</type>
8088 </para>
8089 <para>
8090 Connection string to the upstream database
8091 </para></entry>
8092 </row>
8093
8094 <row>
8095 <entry role="catalog_table_entry"><para role="column_definition">
8096 <structfield>subslotname</structfield> <type>name</type>
8097 </para>
8098 <para>
8099 Name of the replication slot in the upstream database (also used
8100 for the local replication origin name);
8101 null represents <literal>NONE</literal>
8102 </para></entry>
8103 </row>
8104
8105 <row>
8106 <entry role="catalog_table_entry"><para role="column_definition">
8107 <structfield>subsynccommit</structfield> <type>text</type>
8108 </para>
8109 <para>
8110 The <varname>synchronous_commit</varname>
8111 setting for the subscription's workers to use
8112 </para></entry>
8113 </row>
8114
8115 <row>
8116 <entry role="catalog_table_entry"><para role="column_definition">
8117 <structfield>subpublications</structfield> <type>text[]</type>
8118 </para>
8119 <para>
8120 Array of subscribed publication names. These reference
8121 publications defined in the upstream database. For more on publications
8122 see <xref linkend="logical-replication-publication"/>.
8123 </para></entry>
8124 </row>
8125
8126 <row>
8127 <entry role="catalog_table_entry"><para role="column_definition">
8128 <structfield>suborigin</structfield> <type>text</type>
8129 </para>
8130 <para>
8131 The origin value must be either <literal>none</literal> or
8132 <literal>any</literal>. The default is <literal>any</literal>.
8133 If <literal>none</literal>, the subscription will request the publisher
8134 to only send changes that don't have an origin. If
8135 <literal>any</literal>, the publisher sends changes regardless of their
8136 origin.
8137 </para></entry>
8138 </row>
8139 </tbody>
8140 </tgroup>
8141 </table>
8142 </sect1>
8143
8144 <sect1 id="catalog-pg-subscription-rel">
8145 <title><structname>pg_subscription_rel</structname></title>
8146
8147 <indexterm zone="catalog-pg-subscription-rel">
8148 <primary>pg_subscription_rel</primary>
8149 </indexterm>
8150
8151 <para>
8152 The catalog <structname>pg_subscription_rel</structname> contains the
8153 state for each replicated relation in each subscription. This is a
8154 many-to-many mapping.
8155 </para>
8156
8157 <para>
8158 This catalog only contains tables known to the subscription after running
8159 either <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link> or
8160 <link linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION ... REFRESH
8161 PUBLICATION</command></link>.
8162 </para>
8163
8164 <table>
8165 <title><structname>pg_subscription_rel</structname> Columns</title>
8166 <tgroup cols="1">
8167 <thead>
8168 <row>
8169 <entry role="catalog_table_entry"><para role="column_definition">
8170 Column Type
8171 </para>
8172 <para>
8173 Description
8174 </para></entry>
8175 </row>
8176 </thead>
8177
8178 <tbody>
8179 <row>
8180 <entry role="catalog_table_entry"><para role="column_definition">
8181 <structfield>srsubid</structfield> <type>oid</type>
8182 (references <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.<structfield>oid</structfield>)
8183 </para>
8184 <para>
8185 Reference to subscription
8186 </para></entry>
8187 </row>
8188
8189 <row>
8190 <entry role="catalog_table_entry"><para role="column_definition">
8191 <structfield>srrelid</structfield> <type>oid</type>
8192 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8193 </para>
8194 <para>
8195 Reference to relation
8196 </para></entry>
8197 </row>
8198
8199 <row>
8200 <entry role="catalog_table_entry"><para role="column_definition">
8201 <structfield>srsubstate</structfield> <type>char</type>
8202 </para>
8203 <para>
8204 State code:
8205 <literal>i</literal> = initialize,
8206 <literal>d</literal> = data is being copied,
8207 <literal>f</literal> = finished table copy,
8208 <literal>s</literal> = synchronized,
8209 <literal>r</literal> = ready (normal replication)
8210 </para></entry>
8211 </row>
8212
8213 <row>
8214 <entry role="catalog_table_entry"><para role="column_definition">
8215 <structfield>srsublsn</structfield> <type>pg_lsn</type>
8216 </para>
8217 <para>
8218 Remote LSN of the state change used for synchronization coordination
8219 when in <literal>s</literal> or <literal>r</literal> states,
8220 otherwise null
8221 </para></entry>
8222 </row>
8223 </tbody>
8224 </tgroup>
8225 </table>
8226 </sect1>
8227
8228 <sect1 id="catalog-pg-tablespace">
8229 <title><structname>pg_tablespace</structname></title>
8230
8231 <indexterm zone="catalog-pg-tablespace">
8232 <primary>pg_tablespace</primary>
8233 </indexterm>
8234
8235 <para>
8236 The catalog <structname>pg_tablespace</structname> stores information
8237 about the available tablespaces. Tables can be placed in particular
8238 tablespaces to aid administration of disk layout.
8239 </para>
8240
8241 <para>
8242 Unlike most system catalogs, <structname>pg_tablespace</structname>
8243 is shared across all databases of a cluster: there is only one
8244 copy of <structname>pg_tablespace</structname> per cluster, not
8245 one per database.
8246 </para>
8247
8248 <table>
8249 <title><structname>pg_tablespace</structname> Columns</title>
8250 <tgroup cols="1">
8251 <thead>
8252 <row>
8253 <entry role="catalog_table_entry"><para role="column_definition">
8254 Column Type
8255 </para>
8256 <para>
8257 Description
8258 </para></entry>
8259 </row>
8260 </thead>
8261
8262 <tbody>
8263 <row>
8264 <entry role="catalog_table_entry"><para role="column_definition">
8265 <structfield>oid</structfield> <type>oid</type>
8266 </para>
8267 <para>
8268 Row identifier
8269 </para></entry>
8270 </row>
8271
8272 <row>
8273 <entry role="catalog_table_entry"><para role="column_definition">
8274 <structfield>spcname</structfield> <type>name</type>
8275 </para>
8276 <para>
8277 Tablespace name
8278 </para></entry>
8279 </row>
8280
8281 <row>
8282 <entry role="catalog_table_entry"><para role="column_definition">
8283 <structfield>spcowner</structfield> <type>oid</type>
8284 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8285 </para>
8286 <para>
8287 Owner of the tablespace, usually the user who created it
8288 </para></entry>
8289 </row>
8290
8291 <row>
8292 <entry role="catalog_table_entry"><para role="column_definition">
8293 <structfield>spcacl</structfield> <type>aclitem[]</type>
8294 </para>
8295 <para>
8296 Access privileges; see <xref linkend="ddl-priv"/> for details
8297 </para></entry>
8298 </row>
8299
8300 <row>
8301 <entry role="catalog_table_entry"><para role="column_definition">
8302 <structfield>spcoptions</structfield> <type>text[]</type>
8303 </para>
8304 <para>
8305 Tablespace-level options, as <quote>keyword=value</quote> strings
8306 </para></entry>
8307 </row>
8308 </tbody>
8309 </tgroup>
8310 </table>
8311 </sect1>
8312
8313
8314 <sect1 id="catalog-pg-transform">
8315 <title><structname>pg_transform</structname></title>
8316
8317 <indexterm zone="catalog-pg-transform">
8318 <primary>pg_transform</primary>
8319 </indexterm>
8320
8321 <para>
8322 The catalog <structname>pg_transform</structname> stores information about
8323 transforms, which are a mechanism to adapt data types to procedural
8324 languages. See <xref linkend="sql-createtransform"/> for more information.
8325 </para>
8326
8327 <table>
8328 <title><structname>pg_transform</structname> Columns</title>
8329 <tgroup cols="1">
8330 <thead>
8331 <row>
8332 <entry role="catalog_table_entry"><para role="column_definition">
8333 Column Type
8334 </para>
8335 <para>
8336 Description
8337 </para></entry>
8338 </row>
8339 </thead>
8340
8341 <tbody>
8342 <row>
8343 <entry role="catalog_table_entry"><para role="column_definition">
8344 <structfield>oid</structfield> <type>oid</type>
8345 </para>
8346 <para>
8347 Row identifier
8348 </para></entry>
8349 </row>
8350
8351 <row>
8352 <entry role="catalog_table_entry"><para role="column_definition">
8353 <structfield>trftype</structfield> <type>oid</type>
8354 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
8355 </para>
8356 <para>
8357 OID of the data type this transform is for
8358 </para></entry>
8359 </row>
8360
8361 <row>
8362 <entry role="catalog_table_entry"><para role="column_definition">
8363 <structfield>trflang</structfield> <type>oid</type>
8364 (references <link linkend="catalog-pg-language"><structname>pg_language</structname></link>.<structfield>oid</structfield>)
8365 </para>
8366 <para>
8367 OID of the language this transform is for
8368 </para></entry>
8369 </row>
8370
8371 <row>
8372 <entry role="catalog_table_entry"><para role="column_definition">
8373 <structfield>trffromsql</structfield> <type>regproc</type>
8374 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8375 </para>
8376 <para>
8377 The OID of the function to use when converting the data type for input
8378 to the procedural language (e.g., function parameters). Zero is stored
8379 if the default behavior should be used.
8380 </para></entry>
8381 </row>
8382
8383 <row>
8384 <entry role="catalog_table_entry"><para role="column_definition">
8385 <structfield>trftosql</structfield> <type>regproc</type>
8386 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8387 </para>
8388 <para>
8389 The OID of the function to use when converting output from the
8390 procedural language (e.g., return values) to the data type. Zero is
8391 stored if the default behavior should be used.
8392 </para></entry>
8393 </row>
8394 </tbody>
8395 </tgroup>
8396 </table>
8397 </sect1>
8398
8399
8400 <sect1 id="catalog-pg-trigger">
8401 <title><structname>pg_trigger</structname></title>
8402
8403 <indexterm zone="catalog-pg-trigger">
8404 <primary>pg_trigger</primary>
8405 </indexterm>
8406
8407 <para>
8408 The catalog <structname>pg_trigger</structname> stores triggers on tables
8409 and views.
8410 See <xref linkend="sql-createtrigger"/>
8411 for more information.
8412 </para>
8413
8414 <table>
8415 <title><structname>pg_trigger</structname> Columns</title>
8416 <tgroup cols="1">
8417 <thead>
8418 <row>
8419 <entry role="catalog_table_entry"><para role="column_definition">
8420 Column Type
8421 </para>
8422 <para>
8423 Description
8424 </para></entry>
8425 </row>
8426 </thead>
8427
8428 <tbody>
8429 <row>
8430 <entry role="catalog_table_entry"><para role="column_definition">
8431 <structfield>oid</structfield> <type>oid</type>
8432 </para>
8433 <para>
8434 Row identifier
8435 </para></entry>
8436 </row>
8437
8438 <row>
8439 <entry role="catalog_table_entry"><para role="column_definition">
8440 <structfield>tgrelid</structfield> <type>oid</type>
8441 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8442 </para>
8443 <para>
8444 The table this trigger is on
8445 </para></entry>
8446 </row>
8447
8448 <row>
8449 <entry role="catalog_table_entry"><para role="column_definition">
8450 <structfield>tgparentid</structfield> <type>oid</type>
8451 (references <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link>.<structfield>oid</structfield>)
8452 </para>
8453 <para>
8454 Parent trigger that this trigger is cloned from (this happens when
8455 partitions are created or attached to a partitioned table);
8456 zero if not a clone
8457 </para></entry>
8458 </row>
8459
8460 <row>
8461 <entry role="catalog_table_entry"><para role="column_definition">
8462 <structfield>tgname</structfield> <type>name</type>
8463 </para>
8464 <para>
8465 Trigger name (must be unique among triggers of same table)
8466 </para></entry>
8467 </row>
8468
8469 <row>
8470 <entry role="catalog_table_entry"><para role="column_definition">
8471 <structfield>tgfoid</structfield> <type>oid</type>
8472 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8473 </para>
8474 <para>
8475 The function to be called
8476 </para></entry>
8477 </row>
8478
8479 <row>
8480 <entry role="catalog_table_entry"><para role="column_definition">
8481 <structfield>tgtype</structfield> <type>int2</type>
8482 </para>
8483 <para>
8484 Bit mask identifying trigger firing conditions
8485 </para></entry>
8486 </row>
8487
8488 <row>
8489 <entry role="catalog_table_entry"><para role="column_definition">
8490 <structfield>tgenabled</structfield> <type>char</type>
8491 </para>
8492 <para>
8493 Controls in which <xref linkend="guc-session-replication-role"/> modes
8494 the trigger fires.
8495 <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
8496 <literal>D</literal> = trigger is disabled,
8497 <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
8498 <literal>A</literal> = trigger fires always.
8499 </para></entry>
8500 </row>
8501
8502 <row>
8503 <entry role="catalog_table_entry"><para role="column_definition">
8504 <structfield>tgisinternal</structfield> <type>bool</type>
8505 </para>
8506 <para>
8507 True if trigger is internally generated (usually, to enforce
8508 the constraint identified by <structfield>tgconstraint</structfield>)
8509 </para></entry>
8510 </row>
8511
8512 <row>
8513 <entry role="catalog_table_entry"><para role="column_definition">
8514 <structfield>tgconstrrelid</structfield> <type>oid</type>
8515 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8516 </para>
8517 <para>
8518 The table referenced by a referential integrity constraint
8519 (zero if trigger is not for a referential integrity constraint)
8520 </para></entry>
8521 </row>
8522
8523 <row>
8524 <entry role="catalog_table_entry"><para role="column_definition">
8525 <structfield>tgconstrindid</structfield> <type>oid</type>
8526 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8527 </para>
8528 <para>
8529 The index supporting a unique, primary key, referential integrity,
8530 or exclusion constraint
8531 (zero if trigger is not for one of these types of constraint)
8532 </para></entry>
8533 </row>
8534
8535 <row>
8536 <entry role="catalog_table_entry"><para role="column_definition">
8537 <structfield>tgconstraint</structfield> <type>oid</type>
8538 (references <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.<structfield>oid</structfield>)
8539 </para>
8540 <para>
8541 The <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> entry associated with the trigger
8542 (zero if trigger is not for a constraint)
8543 </para></entry>
8544 </row>
8545
8546 <row>
8547 <entry role="catalog_table_entry"><para role="column_definition">
8548 <structfield>tgdeferrable</structfield> <type>bool</type>
8549 </para>
8550 <para>
8551 True if constraint trigger is deferrable
8552 </para></entry>
8553 </row>
8554
8555 <row>
8556 <entry role="catalog_table_entry"><para role="column_definition">
8557 <structfield>tginitdeferred</structfield> <type>bool</type>
8558 </para>
8559 <para>
8560 True if constraint trigger is initially deferred
8561 </para></entry>
8562 </row>
8563
8564 <row>
8565 <entry role="catalog_table_entry"><para role="column_definition">
8566 <structfield>tgnargs</structfield> <type>int2</type>
8567 </para>
8568 <para>
8569 Number of argument strings passed to trigger function
8570 </para></entry>
8571 </row>
8572
8573 <row>
8574 <entry role="catalog_table_entry"><para role="column_definition">
8575 <structfield>tgattr</structfield> <type>int2vector</type>
8576 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
8577 </para>
8578 <para>
8579 Column numbers, if trigger is column-specific; otherwise an
8580 empty array
8581 </para></entry>
8582 </row>
8583
8584 <row>
8585 <entry role="catalog_table_entry"><para role="column_definition">
8586 <structfield>tgargs</structfield> <type>bytea</type>
8587 </para>
8588 <para>
8589 Argument strings to pass to trigger, each NULL-terminated
8590 </para></entry>
8591 </row>
8592
8593 <row>
8594 <entry role="catalog_table_entry"><para role="column_definition">
8595 <structfield>tgqual</structfield> <type>pg_node_tree</type>
8596 </para>
8597 <para>
8598 Expression tree (in <function>nodeToString()</function>
8599 representation) for the trigger's <literal>WHEN</literal> condition, or null
8600 if none
8601 </para></entry>
8602 </row>
8603
8604 <row>
8605 <entry role="catalog_table_entry"><para role="column_definition">
8606 <structfield>tgoldtable</structfield> <type>name</type>
8607 </para>
8608 <para>
8609 <literal>REFERENCING</literal> clause name for <literal>OLD TABLE</literal>,
8610 or null if none
8611 </para></entry>
8612 </row>
8613
8614 <row>
8615 <entry role="catalog_table_entry"><para role="column_definition">
8616 <structfield>tgnewtable</structfield> <type>name</type>
8617 </para>
8618 <para>
8619 <literal>REFERENCING</literal> clause name for <literal>NEW TABLE</literal>,
8620 or null if none
8621 </para></entry>
8622 </row>
8623 </tbody>
8624 </tgroup>
8625 </table>
8626
8627 <para>
8628 Currently, column-specific triggering is supported only for
8629 <literal>UPDATE</literal> events, and so <structfield>tgattr</structfield> is relevant
8630 only for that event type. <structfield>tgtype</structfield> might
8631 contain bits for other event types as well, but those are presumed
8632 to be table-wide regardless of what is in <structfield>tgattr</structfield>.
8633 </para>
8634
8635 <note>
8636 <para>
8637 When <structfield>tgconstraint</structfield> is nonzero,
8638 <structfield>tgconstrrelid</structfield>, <structfield>tgconstrindid</structfield>,
8639 <structfield>tgdeferrable</structfield>, and <structfield>tginitdeferred</structfield> are
8640 largely redundant with the referenced <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> entry.
8641 However, it is possible for a non-deferrable trigger to be associated
8642 with a deferrable constraint: foreign key constraints can have some
8643 deferrable and some non-deferrable triggers.
8644 </para>
8645 </note>
8646
8647 <note>
8648 <para>
8649 <literal>pg_class.relhastriggers</literal>
8650 must be true if a relation has any triggers in this catalog.
8651 </para>
8652 </note>
8653
8654 </sect1>
8655
8656
8657 <sect1 id="catalog-pg-ts-config">
8658 <title><structname>pg_ts_config</structname></title>
8659
8660 <indexterm zone="catalog-pg-ts-config">
8661 <primary>pg_ts_config</primary>
8662 </indexterm>
8663
8664 <para>
8665 The <structname>pg_ts_config</structname> catalog contains entries
8666 representing text search configurations. A configuration specifies
8667 a particular text search parser and a list of dictionaries to use
8668 for each of the parser's output token types. The parser is shown
8669 in the <structname>pg_ts_config</structname> entry, but the
8670 token-to-dictionary mapping is defined by subsidiary entries in <link
8671 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
8672 </para>
8673
8674 <para>
8675 <productname>PostgreSQL</productname>'s text search features are
8676 described at length in <xref linkend="textsearch"/>.
8677 </para>
8678
8679 <table>
8680 <title><structname>pg_ts_config</structname> Columns</title>
8681 <tgroup cols="1">
8682 <thead>
8683 <row>
8684 <entry role="catalog_table_entry"><para role="column_definition">
8685 Column Type
8686 </para>
8687 <para>
8688 Description
8689 </para></entry>
8690 </row>
8691 </thead>
8692
8693 <tbody>
8694 <row>
8695 <entry role="catalog_table_entry"><para role="column_definition">
8696 <structfield>oid</structfield> <type>oid</type>
8697 </para>
8698 <para>
8699 Row identifier
8700 </para></entry>
8701 </row>
8702
8703 <row>
8704 <entry role="catalog_table_entry"><para role="column_definition">
8705 <structfield>cfgname</structfield> <type>name</type>
8706 </para>
8707 <para>
8708 Text search configuration name
8709 </para></entry>
8710 </row>
8711
8712 <row>
8713 <entry role="catalog_table_entry"><para role="column_definition">
8714 <structfield>cfgnamespace</structfield> <type>oid</type>
8715 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8716 </para>
8717 <para>
8718 The OID of the namespace that contains this configuration
8719 </para></entry>
8720 </row>
8721
8722 <row>
8723 <entry role="catalog_table_entry"><para role="column_definition">
8724 <structfield>cfgowner</structfield> <type>oid</type>
8725 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8726 </para>
8727 <para>
8728 Owner of the configuration
8729 </para></entry>
8730 </row>
8731
8732 <row>
8733 <entry role="catalog_table_entry"><para role="column_definition">
8734 <structfield>cfgparser</structfield> <type>oid</type>
8735 (references <link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.<structfield>oid</structfield>)
8736 </para>
8737 <para>
8738 The OID of the text search parser for this configuration
8739 </para></entry>
8740 </row>
8741 </tbody>
8742 </tgroup>
8743 </table>
8744 </sect1>
8745
8746
8747 <sect1 id="catalog-pg-ts-config-map">
8748 <title><structname>pg_ts_config_map</structname></title>
8749
8750 <indexterm zone="catalog-pg-ts-config-map">
8751 <primary>pg_ts_config_map</primary>
8752 </indexterm>
8753
8754 <para>
8755 The <structname>pg_ts_config_map</structname> catalog contains entries
8756 showing which text search dictionaries should be consulted, and in
8757 what order, for each output token type of each text search configuration's
8758 parser.
8759 </para>
8760
8761 <para>
8762 <productname>PostgreSQL</productname>'s text search features are
8763 described at length in <xref linkend="textsearch"/>.
8764 </para>
8765
8766 <table>
8767 <title><structname>pg_ts_config_map</structname> Columns</title>
8768 <tgroup cols="1">
8769 <thead>
8770 <row>
8771 <entry role="catalog_table_entry"><para role="column_definition">
8772 Column Type
8773 </para>
8774 <para>
8775 Description
8776 </para></entry>
8777 </row>
8778 </thead>
8779
8780 <tbody>
8781 <row>
8782 <entry role="catalog_table_entry"><para role="column_definition">
8783 <structfield>mapcfg</structfield> <type>oid</type>
8784 (references <link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.<structfield>oid</structfield>)
8785 </para>
8786 <para>
8787 The OID of the <link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link> entry owning this map entry
8788 </para></entry>
8789 </row>
8790
8791 <row>
8792 <entry role="catalog_table_entry"><para role="column_definition">
8793 <structfield>maptokentype</structfield> <type>int4</type>
8794 </para>
8795 <para>
8796 A token type emitted by the configuration's parser
8797 </para></entry>
8798 </row>
8799
8800 <row>
8801 <entry role="catalog_table_entry"><para role="column_definition">
8802 <structfield>mapseqno</structfield> <type>int4</type>
8803 </para>
8804 <para>
8805 Order in which to consult this entry (lower
8806 <structfield>mapseqno</structfield>s first)
8807 </para></entry>
8808 </row>
8809
8810 <row>
8811 <entry role="catalog_table_entry"><para role="column_definition">
8812 <structfield>mapdict</structfield> <type>oid</type>
8813 (references <link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.<structfield>oid</structfield>)
8814 </para>
8815 <para>
8816 The OID of the text search dictionary to consult
8817 </para></entry>
8818 </row>
8819 </tbody>
8820 </tgroup>
8821 </table>
8822 </sect1>
8823
8824
8825 <sect1 id="catalog-pg-ts-dict">
8826 <title><structname>pg_ts_dict</structname></title>
8827
8828 <indexterm zone="catalog-pg-ts-dict">
8829 <primary>pg_ts_dict</primary>
8830 </indexterm>
8831
8832 <para>
8833 The <structname>pg_ts_dict</structname> catalog contains entries
8834 defining text search dictionaries. A dictionary depends on a text
8835 search template, which specifies all the implementation functions
8836 needed; the dictionary itself provides values for the user-settable
8837 parameters supported by the template. This division of labor allows
8838 dictionaries to be created by unprivileged users. The parameters
8839 are specified by a text string <structfield>dictinitoption</structfield>,
8840 whose format and meaning vary depending on the template.
8841 </para>
8842
8843 <para>
8844 <productname>PostgreSQL</productname>'s text search features are
8845 described at length in <xref linkend="textsearch"/>.
8846 </para>
8847
8848 <table>
8849 <title><structname>pg_ts_dict</structname> Columns</title>
8850 <tgroup cols="1">
8851 <thead>
8852 <row>
8853 <entry role="catalog_table_entry"><para role="column_definition">
8854 Column Type
8855 </para>
8856 <para>
8857 Description
8858 </para></entry>
8859 </row>
8860 </thead>
8861
8862 <tbody>
8863 <row>
8864 <entry role="catalog_table_entry"><para role="column_definition">
8865 <structfield>oid</structfield> <type>oid</type>
8866 </para>
8867 <para>
8868 Row identifier
8869 </para></entry>
8870 </row>
8871
8872 <row>
8873 <entry role="catalog_table_entry"><para role="column_definition">
8874 <structfield>dictname</structfield> <type>name</type>
8875 </para>
8876 <para>
8877 Text search dictionary name
8878 </para></entry>
8879 </row>
8880
8881 <row>
8882 <entry role="catalog_table_entry"><para role="column_definition">
8883 <structfield>dictnamespace</structfield> <type>oid</type>
8884 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8885 </para>
8886 <para>
8887 The OID of the namespace that contains this dictionary
8888 </para></entry>
8889 </row>
8890
8891 <row>
8892 <entry role="catalog_table_entry"><para role="column_definition">
8893 <structfield>dictowner</structfield> <type>oid</type>
8894 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8895 </para>
8896 <para>
8897 Owner of the dictionary
8898 </para></entry>
8899 </row>
8900
8901 <row>
8902 <entry role="catalog_table_entry"><para role="column_definition">
8903 <structfield>dicttemplate</structfield> <type>oid</type>
8904 (references <link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.<structfield>oid</structfield>)
8905 </para>
8906 <para>
8907 The OID of the text search template for this dictionary
8908 </para></entry>
8909 </row>
8910
8911 <row>
8912 <entry role="catalog_table_entry"><para role="column_definition">
8913 <structfield>dictinitoption</structfield> <type>text</type>
8914 </para>
8915 <para>
8916 Initialization option string for the template
8917 </para></entry>
8918 </row>
8919 </tbody>
8920 </tgroup>
8921 </table>
8922 </sect1>
8923
8924
8925 <sect1 id="catalog-pg-ts-parser">
8926 <title><structname>pg_ts_parser</structname></title>
8927
8928 <indexterm zone="catalog-pg-ts-parser">
8929 <primary>pg_ts_parser</primary>
8930 </indexterm>
8931
8932 <para>
8933 The <structname>pg_ts_parser</structname> catalog contains entries
8934 defining text search parsers. A parser is responsible for splitting
8935 input text into lexemes and assigning a token type to each lexeme.
8936 Since a parser must be implemented by C-language-level functions,
8937 creation of new parsers is restricted to database superusers.
8938 </para>
8939
8940 <para>
8941 <productname>PostgreSQL</productname>'s text search features are
8942 described at length in <xref linkend="textsearch"/>.
8943 </para>
8944
8945 <table>
8946 <title><structname>pg_ts_parser</structname> Columns</title>
8947 <tgroup cols="1">
8948 <thead>
8949 <row>
8950 <entry role="catalog_table_entry"><para role="column_definition">
8951 Column Type
8952 </para>
8953 <para>
8954 Description
8955 </para></entry>
8956 </row>
8957 </thead>
8958
8959 <tbody>
8960 <row>
8961 <entry role="catalog_table_entry"><para role="column_definition">
8962 <structfield>oid</structfield> <type>oid</type>
8963 </para>
8964 <para>
8965 Row identifier
8966 </para></entry>
8967 </row>
8968
8969 <row>
8970 <entry role="catalog_table_entry"><para role="column_definition">
8971 <structfield>prsname</structfield> <type>name</type>
8972 </para>
8973 <para>
8974 Text search parser name
8975 </para></entry>
8976 </row>
8977
8978 <row>
8979 <entry role="catalog_table_entry"><para role="column_definition">
8980 <structfield>prsnamespace</structfield> <type>oid</type>
8981 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8982 </para>
8983 <para>
8984 The OID of the namespace that contains this parser
8985 </para></entry>
8986 </row>
8987
8988 <row>
8989 <entry role="catalog_table_entry"><para role="column_definition">
8990 <structfield>prsstart</structfield> <type>regproc</type>
8991 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8992 </para>
8993 <para>
8994 OID of the parser's startup function
8995 </para></entry>
8996 </row>
8997
8998 <row>
8999 <entry role="catalog_table_entry"><para role="column_definition">
9000 <structfield>prstoken</structfield> <type>regproc</type>
9001 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9002 </para>
9003 <para>
9004 OID of the parser's next-token function
9005 </para></entry>
9006 </row>
9007
9008 <row>
9009 <entry role="catalog_table_entry"><para role="column_definition">
9010 <structfield>prsend</structfield> <type>regproc</type>
9011 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9012 </para>
9013 <para>
9014 OID of the parser's shutdown function
9015 </para></entry>
9016 </row>
9017
9018 <row>
9019 <entry role="catalog_table_entry"><para role="column_definition">
9020 <structfield>prsheadline</structfield> <type>regproc</type>
9021 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9022 </para>
9023 <para>
9024 OID of the parser's headline function (zero if none)
9025 </para></entry>
9026 </row>
9027
9028 <row>
9029 <entry role="catalog_table_entry"><para role="column_definition">
9030 <structfield>prslextype</structfield> <type>regproc</type>
9031 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9032 </para>
9033 <para>
9034 OID of the parser's lextype function
9035 </para></entry>
9036 </row>
9037 </tbody>
9038 </tgroup>
9039 </table>
9040 </sect1>
9041
9042
9043 <sect1 id="catalog-pg-ts-template">
9044 <title><structname>pg_ts_template</structname></title>
9045
9046 <indexterm zone="catalog-pg-ts-template">
9047 <primary>pg_ts_template</primary>
9048 </indexterm>
9049
9050 <para>
9051 The <structname>pg_ts_template</structname> catalog contains entries
9052 defining text search templates. A template is the implementation
9053 skeleton for a class of text search dictionaries.
9054 Since a template must be implemented by C-language-level functions,
9055 creation of new templates is restricted to database superusers.
9056 </para>
9057
9058 <para>
9059 <productname>PostgreSQL</productname>'s text search features are
9060 described at length in <xref linkend="textsearch"/>.
9061 </para>
9062
9063 <table>
9064 <title><structname>pg_ts_template</structname> Columns</title>
9065 <tgroup cols="1">
9066 <thead>
9067 <row>
9068 <entry role="catalog_table_entry"><para role="column_definition">
9069 Column Type
9070 </para>
9071 <para>
9072 Description
9073 </para></entry>
9074 </row>
9075 </thead>
9076
9077 <tbody>
9078 <row>
9079 <entry role="catalog_table_entry"><para role="column_definition">
9080 <structfield>oid</structfield> <type>oid</type>
9081 </para>
9082 <para>
9083 Row identifier
9084 </para></entry>
9085 </row>
9086
9087 <row>
9088 <entry role="catalog_table_entry"><para role="column_definition">
9089 <structfield>tmplname</structfield> <type>name</type>
9090 </para>
9091 <para>
9092 Text search template name
9093 </para></entry>
9094 </row>
9095
9096 <row>
9097 <entry role="catalog_table_entry"><para role="column_definition">
9098 <structfield>tmplnamespace</structfield> <type>oid</type>
9099 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
9100 </para>
9101 <para>
9102 The OID of the namespace that contains this template
9103 </para></entry>
9104 </row>
9105
9106 <row>
9107 <entry role="catalog_table_entry"><para role="column_definition">
9108 <structfield>tmplinit</structfield> <type>regproc</type>
9109 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9110 </para>
9111 <para>
9112 OID of the template's initialization function (zero if none)
9113 </para></entry>
9114 </row>
9115
9116 <row>
9117 <entry role="catalog_table_entry"><para role="column_definition">
9118 <structfield>tmpllexize</structfield> <type>regproc</type>
9119 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9120 </para>
9121 <para>
9122 OID of the template's lexize function
9123 </para></entry>
9124 </row>
9125 </tbody>
9126 </tgroup>
9127 </table>
9128 </sect1>
9129
9130
9131 <sect1 id="catalog-pg-type">
9132 <title><structname>pg_type</structname></title>
9133
9134 <indexterm zone="catalog-pg-type">
9135 <primary>pg_type</primary>
9136 </indexterm>
9137
9138 <para>
9139 The catalog <structname>pg_type</structname> stores information about data
9140 types. Base types and enum types (scalar types) are created with
9141 <link linkend="sql-createtype"><command>CREATE TYPE</command></link>, and
9142 domains with
9143 <link linkend="sql-createdomain"><command>CREATE DOMAIN</command></link>.
9144 A composite type is automatically created for each table in the database, to
9145 represent the row structure of the table. It is also possible to create
9146 composite types with <command>CREATE TYPE AS</command>.
9147 </para>
9148
9149 <table>
9150 <title><structname>pg_type</structname> Columns</title>
9151 <tgroup cols="1">
9152 <thead>
9153 <row>
9154 <entry role="catalog_table_entry"><para role="column_definition">
9155 Column Type
9156 </para>
9157 <para>
9158 Description
9159 </para></entry>
9160 </row>
9161 </thead>
9162
9163 <tbody>
9164 <row>
9165 <entry role="catalog_table_entry"><para role="column_definition">
9166 <structfield>oid</structfield> <type>oid</type>
9167 </para>
9168 <para>
9169 Row identifier
9170 </para></entry>
9171 </row>
9172
9173 <row>
9174 <entry role="catalog_table_entry"><para role="column_definition">
9175 <structfield>typname</structfield> <type>name</type>
9176 </para>
9177 <para>
9178 Data type name
9179 </para></entry>
9180 </row>
9181
9182 <row>
9183 <entry role="catalog_table_entry"><para role="column_definition">
9184 <structfield>typnamespace</structfield> <type>oid</type>
9185 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
9186 </para>
9187 <para>
9188 The OID of the namespace that contains this type
9189 </para></entry>
9190 </row>
9191
9192 <row>
9193 <entry role="catalog_table_entry"><para role="column_definition">
9194 <structfield>typowner</structfield> <type>oid</type>
9195 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
9196 </para>
9197 <para>
9198 Owner of the type
9199 </para></entry>
9200 </row>
9201
9202 <row>
9203 <entry role="catalog_table_entry"><para role="column_definition">
9204 <structfield>typlen</structfield> <type>int2</type>
9205 </para>
9206 <para>
9207 For a fixed-size type, <structfield>typlen</structfield> is the number
9208 of bytes in the internal representation of the type. But for a
9209 variable-length type, <structfield>typlen</structfield> is negative.
9210 -1 indicates a <quote>varlena</quote> type (one that has a length word),
9211 -2 indicates a null-terminated C string.
9212 </para></entry>
9213 </row>
9214
9215 <row>
9216 <entry role="catalog_table_entry"><para role="column_definition">
9217 <structfield>typbyval</structfield> <type>bool</type>
9218 </para>
9219 <para>
9220 <structfield>typbyval</structfield> determines whether internal
9221 routines pass a value of this type by value or by reference.
9222 <structfield>typbyval</structfield> had better be false if
9223 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
9224 where Datum is 8 bytes).
9225 Variable-length types are always passed by reference. Note that
9226 <structfield>typbyval</structfield> can be false even if the
9227 length would allow pass-by-value.
9228 </para></entry>
9229 </row>
9230
9231 <row>
9232 <entry role="catalog_table_entry"><para role="column_definition">
9233 <structfield>typtype</structfield> <type>char</type>
9234 </para>
9235 <para>
9236 <structfield>typtype</structfield> is
9237 <literal>b</literal> for a base type,
9238 <literal>c</literal> for a composite type (e.g., a table's row type),
9239 <literal>d</literal> for a domain,
9240 <literal>e</literal> for an enum type,
9241 <literal>p</literal> for a pseudo-type,
9242 <literal>r</literal> for a range type, or
9243 <literal>m</literal> for a multirange type.
9244 See also <structfield>typrelid</structfield> and
9245 <structfield>typbasetype</structfield>.
9246 </para></entry>
9247 </row>
9248
9249 <row>
9250 <entry role="catalog_table_entry"><para role="column_definition">
9251 <structfield>typcategory</structfield> <type>char</type>
9252 </para>
9253 <para>
9254 <structfield>typcategory</structfield> is an arbitrary classification
9255 of data types that is used by the parser to determine which implicit
9256 casts should be <quote>preferred</quote>.
9257 See <xref linkend="catalog-typcategory-table"/>.
9258 </para></entry>
9259 </row>
9260
9261 <row>
9262 <entry role="catalog_table_entry"><para role="column_definition">
9263 <structfield>typispreferred</structfield> <type>bool</type>
9264 </para>
9265 <para>
9266 True if the type is a preferred cast target within its
9267 <structfield>typcategory</structfield>
9268 </para></entry>
9269 </row>
9270
9271 <row>
9272 <entry role="catalog_table_entry"><para role="column_definition">
9273 <structfield>typisdefined</structfield> <type>bool</type>
9274 </para>
9275 <para>
9276 True if the type is defined, false if this is a placeholder
9277 entry for a not-yet-defined type. When
9278 <structfield>typisdefined</structfield> is false, nothing
9279 except the type name, namespace, and OID can be relied on.
9280 </para></entry>
9281 </row>
9282
9283 <row>
9284 <entry role="catalog_table_entry"><para role="column_definition">
9285 <structfield>typdelim</structfield> <type>char</type>
9286 </para>
9287 <para>
9288 Character that separates two values of this type when parsing
9289 array input. Note that the delimiter is associated with the array
9290 element data type, not the array data type.
9291 </para></entry>
9292 </row>
9293
9294 <row>
9295 <entry role="catalog_table_entry"><para role="column_definition">
9296 <structfield>typrelid</structfield> <type>oid</type>
9297 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
9298 </para>
9299 <para>
9300 If this is a composite type (see
9301 <structfield>typtype</structfield>), then this column points to
9302 the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry that defines the
9303 corresponding table. (For a free-standing composite type, the
9304 <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry doesn't really represent
9305 a table, but it is needed anyway for the type's
9306 <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link> entries to link to.)
9307 Zero for non-composite types.
9308 </para></entry>
9309 </row>
9310
9311 <row>
9312 <entry role="catalog_table_entry"><para role="column_definition">
9313 <structfield>typsubscript</structfield> <type>regproc</type>
9314 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9315 </para>
9316 <para>
9317 Subscripting handler function's OID, or zero if this type doesn't
9318 support subscripting. Types that are <quote>true</quote> array
9319 types have <structfield>typsubscript</structfield>
9320 = <function>array_subscript_handler</function>, but other types may
9321 have other handler functions to implement specialized subscripting
9322 behavior.
9323 </para></entry>
9324 </row>
9325
9326 <row>
9327 <entry role="catalog_table_entry"><para role="column_definition">
9328 <structfield>typelem</structfield> <type>oid</type>
9329 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
9330 </para>
9331 <para>
9332 If <structfield>typelem</structfield> is not zero then it
9333 identifies another row in <structname>pg_type</structname>,
9334 defining the type yielded by subscripting. This should be zero
9335 if <structfield>typsubscript</structfield> is zero. However, it can
9336 be zero when <structfield>typsubscript</structfield> isn't zero, if the
9337 handler doesn't need <structfield>typelem</structfield> to
9338 determine the subscripting result type.
9339 Note that a <structfield>typelem</structfield> dependency is
9340 considered to imply physical containment of the element type in
9341 this type; so DDL changes on the element type might be restricted
9342 by the presence of this type.
9343 </para></entry>
9344 </row>
9345
9346 <row>
9347 <entry role="catalog_table_entry"><para role="column_definition">
9348 <structfield>typarray</structfield> <type>oid</type>
9349 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
9350 </para>
9351 <para>
9352 If <structfield>typarray</structfield> is not zero then it
9353 identifies another row in <structname>pg_type</structname>, which
9354 is the <quote>true</quote> array type having this type as element
9355 </para></entry>
9356 </row>
9357
9358 <row>
9359 <entry role="catalog_table_entry"><para role="column_definition">
9360 <structfield>typinput</structfield> <type>regproc</type>
9361 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9362 </para>
9363 <para>
9364 Input conversion function (text format)
9365 </para></entry>
9366 </row>
9367
9368 <row>
9369 <entry role="catalog_table_entry"><para role="column_definition">
9370 <structfield>typoutput</structfield> <type>regproc</type>
9371 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9372 </para>
9373 <para>
9374 Output conversion function (text format)
9375 </para></entry>
9376 </row>
9377
9378 <row>
9379 <entry role="catalog_table_entry"><para role="column_definition">
9380 <structfield>typreceive</structfield> <type>regproc</type>
9381 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9382 </para>
9383 <para>
9384 Input conversion function (binary format), or zero if none
9385 </para></entry>
9386 </row>
9387
9388 <row>
9389 <entry role="catalog_table_entry"><para role="column_definition">
9390 <structfield>typsend</structfield> <type>regproc</type>
9391 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9392 </para>
9393 <para>
9394 Output conversion function (binary format), or zero if none
9395 </para></entry>
9396 </row>
9397
9398 <row>
9399 <entry role="catalog_table_entry"><para role="column_definition">
9400 <structfield>typmodin</structfield> <type>regproc</type>
9401 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9402 </para>
9403 <para>
9404 Type modifier input function, or zero if type does not support modifiers
9405 </para></entry>
9406 </row>
9407
9408 <row>
9409 <entry role="catalog_table_entry"><para role="column_definition">
9410 <structfield>typmodout</structfield> <type>regproc</type>
9411 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9412 </para>
9413 <para>
9414 Type modifier output function, or zero to use the standard format
9415 </para></entry>
9416 </row>
9417
9418 <row>
9419 <entry role="catalog_table_entry"><para role="column_definition">
9420 <structfield>typanalyze</structfield> <type>regproc</type>
9421 (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
9422 </para>
9423 <para>
9424 Custom <xref linkend="sql-analyze"/> function,
9425 or zero to use the standard function
9426 </para></entry>
9427 </row>
9428
9429 <row>
9430 <entry role="catalog_table_entry"><para role="column_definition">
9431 <structfield>typalign</structfield> <type>char</type>
9432 </para>
9433 <para>
9434 <structfield>typalign</structfield> is the alignment required
9435 when storing a value of this type. It applies to storage on
9436 disk as well as most representations of the value inside
9437 <productname>PostgreSQL</productname>.
9438 When multiple values are stored consecutively, such
9439 as in the representation of a complete row on disk, padding is
9440 inserted before a datum of this type so that it begins on the
9441 specified boundary. The alignment reference is the beginning
9442 of the first datum in the sequence.
9443 Possible values are:
9444 <itemizedlist>
9445 <listitem>
9446 <para><literal>c</literal> = <type>char</type> alignment, i.e., no alignment needed.</para>
9447 </listitem>
9448 <listitem>
9449 <para><literal>s</literal> = <type>short</type> alignment (2 bytes on most machines).</para>
9450 </listitem>
9451 <listitem>
9452 <para><literal>i</literal> = <type>int</type> alignment (4 bytes on most machines).</para>
9453 </listitem>
9454 <listitem>
9455 <para><literal>d</literal> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
9456 </listitem>
9457 </itemizedlist>
9458 </para></entry>
9459 </row>
9460
9461 <row>
9462 <entry role="catalog_table_entry"><para role="column_definition">
9463 <structfield>typstorage</structfield> <type>char</type>
9464 </para>
9465 <para>
9466 <structfield>typstorage</structfield> tells for varlena
9467 types (those with <structfield>typlen</structfield> = -1) if
9468 the type is prepared for toasting and what the default strategy
9469 for attributes of this type should be.
9470 Possible values are:
9471 <itemizedlist>
9472 <listitem>
9473 <para>
9474 <literal>p</literal> (plain): Values must always be stored plain
9475 (non-varlena types always use this value).
9476 </para>
9477 </listitem>
9478 <listitem>
9479 <para>
9480 <literal>e</literal> (external): Values can be stored in a
9481 secondary <quote>TOAST</quote> relation (if relation has one, see
9482 <literal>pg_class.reltoastrelid</literal>).
9483 </para>
9484 </listitem>
9485 <listitem>
9486 <para>
9487 <literal>m</literal> (main): Values can be compressed and stored
9488 inline.
9489 </para>
9490 </listitem>
9491 <listitem>
9492 <para>
9493 <literal>x</literal> (extended): Values can be compressed and/or
9494 moved to a secondary relation.
9495 </para>
9496 </listitem>
9497 </itemizedlist>
9498 <literal>x</literal> is the usual choice for toast-able types.
9499 Note that <literal>m</literal> values can also be moved out to
9500 secondary storage, but only as a last resort (<literal>e</literal>
9501 and <literal>x</literal> values are moved first).
9502 </para></entry>
9503 </row>
9504
9505 <row>
9506 <entry role="catalog_table_entry"><para role="column_definition">
9507 <structfield>typnotnull</structfield> <type>bool</type>
9508 </para>
9509 <para>
9510 <structfield>typnotnull</structfield> represents a not-null
9511 constraint on a type. Used for domains only.
9512 </para></entry>
9513 </row>
9514
9515 <row>
9516 <entry role="catalog_table_entry"><para role="column_definition">
9517 <structfield>typbasetype</structfield> <type>oid</type>
9518 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
9519 </para>
9520 <para>
9521 If this is a domain (see <structfield>typtype</structfield>), then
9522 <structfield>typbasetype</structfield> identifies the type that this
9523 one is based on. Zero if this type is not a domain.
9524 </para></entry>
9525 </row>
9526
9527 <row>
9528 <entry role="catalog_table_entry"><para role="column_definition">
9529 <structfield>typtypmod</structfield> <type>int4</type>
9530 </para>
9531 <para>
9532 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</literal>
9533 to be applied to their base type (-1 if base type does not use a
9534 <literal>typmod</literal>). -1 if this type is not a domain.
9535 </para></entry>
9536 </row>
9537
9538 <row>
9539 <entry role="catalog_table_entry"><para role="column_definition">
9540 <structfield>typndims</structfield> <type>int4</type>
9541 </para>
9542 <para>
9543 <structfield>typndims</structfield> is the number of array dimensions
9544 for a domain over an array (that is, <structfield>typbasetype</structfield> is
9545 an array type).
9546 Zero for types other than domains over array types.
9547 </para></entry>
9548 </row>
9549
9550 <row>
9551 <entry role="catalog_table_entry"><para role="column_definition">
9552 <structfield>typcollation</structfield> <type>oid</type>
9553 (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
9554 </para>
9555 <para>
9556 <structfield>typcollation</structfield> specifies the collation
9557 of the type. If the type does not support collations, this will
9558 be zero. A base type that supports collations will have a nonzero
9559 value here, typically <symbol>DEFAULT_COLLATION_OID</symbol>.
9560 A domain over a collatable type can have a collation OID different
9561 from its base type's, if one was specified for the domain.
9562 </para></entry>
9563 </row>
9564
9565 <row>
9566 <entry role="catalog_table_entry"><para role="column_definition">
9567 <structfield>typdefaultbin</structfield> <type>pg_node_tree</type>
9568 </para>
9569 <para>
9570 If <structfield>typdefaultbin</structfield> is not null, it is the
9571 <function>nodeToString()</function>
9572 representation of a default expression for the type. This is
9573 only used for domains.
9574 </para></entry>
9575 </row>
9576
9577 <row>
9578 <entry role="catalog_table_entry"><para role="column_definition">
9579 <structfield>typdefault</structfield> <type>text</type>
9580 </para>
9581 <para>
9582 <structfield>typdefault</structfield> is null if the type has no associated
9583 default value. If <structfield>typdefaultbin</structfield> is not null,
9584 <structfield>typdefault</structfield> must contain a human-readable version of the
9585 default expression represented by <structfield>typdefaultbin</structfield>. If
9586 <structfield>typdefaultbin</structfield> is null and <structfield>typdefault</structfield> is
9587 not, then <structfield>typdefault</structfield> is the external representation of
9588 the type's default value, which can be fed to the type's input
9589 converter to produce a constant.
9590 </para></entry>
9591 </row>
9592
9593 <row>
9594 <entry role="catalog_table_entry"><para role="column_definition">
9595 <structfield>typacl</structfield> <type>aclitem[]</type>
9596 </para>
9597 <para>
9598 Access privileges; see <xref linkend="ddl-priv"/> for details
9599 </para></entry>
9600 </row>
9601 </tbody>
9602 </tgroup>
9603 </table>
9604
9605 <note>
9606 <para>
9607 For fixed-width types used in system tables, it is critical that the size
9608 and alignment defined in <structname>pg_type</structname>
9609 agree with the way that the compiler will lay out the column in
9610 a structure representing a table row.
9611 </para>
9612 </note>
9613
9614 <para>
9615 <xref linkend="catalog-typcategory-table"/> lists the system-defined values
9616 of <structfield>typcategory</structfield>. Any future additions to this list will
9617 also be upper-case ASCII letters. All other ASCII characters are reserved
9618 for user-defined categories.
9619 </para>
9620
9621 <table id="catalog-typcategory-table">
9622 <title><structfield>typcategory</structfield> Codes</title>
9623
9624 <tgroup cols="2">
9625 <thead>
9626 <row>
9627 <entry>Code</entry>
9628 <entry>Category</entry>
9629 </row>
9630 </thead>
9631
9632 <tbody>
9633 <row>
9634 <entry><literal>A</literal></entry>
9635 <entry>Array types</entry>
9636 </row>
9637 <row>
9638 <entry><literal>B</literal></entry>
9639 <entry>Boolean types</entry>
9640 </row>
9641 <row>
9642 <entry><literal>C</literal></entry>
9643 <entry>Composite types</entry>
9644 </row>
9645 <row>
9646 <entry><literal>D</literal></entry>
9647 <entry>Date/time types</entry>
9648 </row>
9649 <row>
9650 <entry><literal>E</literal></entry>
9651 <entry>Enum types</entry>
9652 </row>
9653 <row>
9654 <entry><literal>G</literal></entry>
9655 <entry>Geometric types</entry>
9656 </row>
9657 <row>
9658 <entry><literal>I</literal></entry>
9659 <entry>Network address types</entry>
9660 </row>
9661 <row>
9662 <entry><literal>N</literal></entry>
9663 <entry>Numeric types</entry>
9664 </row>
9665 <row>
9666 <entry><literal>P</literal></entry>
9667 <entry>Pseudo-types</entry>
9668 </row>
9669 <row>
9670 <entry><literal>R</literal></entry>
9671 <entry>Range types</entry>
9672 </row>
9673 <row>
9674 <entry><literal>S</literal></entry>
9675 <entry>String types</entry>
9676 </row>
9677 <row>
9678 <entry><literal>T</literal></entry>
9679 <entry>Timespan types</entry>
9680 </row>
9681 <row>
9682 <entry><literal>U</literal></entry>
9683 <entry>User-defined types</entry>
9684 </row>
9685 <row>
9686 <entry><literal>V</literal></entry>
9687 <entry>Bit-string types</entry>
9688 </row>
9689 <row>
9690 <entry><literal>X</literal></entry>
9691 <entry><type>unknown</type> type</entry>
9692 </row>
9693 <row>
9694 <entry><literal>Z</literal></entry>
9695 <entry>Internal-use types</entry>
9696 </row>
9697 </tbody>
9698 </tgroup>
9699 </table>
9700
9701 </sect1>
9702
9703
9704 <sect1 id="catalog-pg-user-mapping">
9705 <title><structname>pg_user_mapping</structname></title>
9706
9707 <indexterm zone="catalog-pg-user-mapping">
9708 <primary>pg_user_mapping</primary>
9709 </indexterm>
9710
9711 <para>
9712 The catalog <structname>pg_user_mapping</structname> stores
9713 the mappings from local user to remote. Access to this catalog is
9714 restricted from normal users, use the view
9715 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
9716 instead.
9717 </para>
9718
9719 <table>
9720 <title><structname>pg_user_mapping</structname> Columns</title>
9721 <tgroup cols="1">
9722 <thead>
9723 <row>
9724 <entry role="catalog_table_entry"><para role="column_definition">
9725 Column Type
9726 </para>
9727 <para>
9728 Description
9729 </para></entry>
9730 </row>
9731 </thead>
9732
9733 <tbody>
9734 <row>
9735 <entry role="catalog_table_entry"><para role="column_definition">
9736 <structfield>oid</structfield> <type>oid</type>
9737 </para>
9738 <para>
9739 Row identifier
9740 </para></entry>
9741 </row>
9742
9743 <row>
9744 <entry role="catalog_table_entry"><para role="column_definition">
9745 <structfield>umuser</structfield> <type>oid</type>
9746 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
9747 </para>
9748 <para>
9749 OID of the local role being mapped, or zero if the user mapping is public
9750 </para></entry>
9751 </row>
9752
9753 <row>
9754 <entry role="catalog_table_entry"><para role="column_definition">
9755 <structfield>umserver</structfield> <type>oid</type>
9756 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
9757 </para>
9758 <para>
9759 The OID of the foreign server that contains this mapping
9760 </para></entry>
9761 </row>
9762
9763 <row>
9764 <entry role="catalog_table_entry"><para role="column_definition">
9765 <structfield>umoptions</structfield> <type>text[]</type>
9766 </para>
9767 <para>
9768 User mapping specific options, as <quote>keyword=value</quote> strings
9769 </para></entry>
9770 </row>
9771 </tbody>
9772 </tgroup>
9773 </table>
9774 </sect1>
9775
9776 </chapter>