Debian Codegraph @

doc/src/sgml/system-views.sgml

raw
1 <!-- doc/src/sgml/system-views.sgml -->
2 <!--
3 Documentation of the system views, directed toward PostgreSQL developers
4 -->
5
6 <chapter id="views">
7 <title>System Views</title>
8
9 <para>
10 In addition to the system catalogs, <productname>PostgreSQL</productname>
11 provides a number of built-in views. Some system views provide convenient
12 access to some commonly used queries on the system catalogs. Other views
13 provide access to internal server state.
14 </para>
15
16 <para>
17 The information schema (<xref linkend="information-schema"/>) provides
18 an alternative set of views which overlap the functionality of the system
19 views. Since the information schema is SQL-standard whereas the views
20 described here are <productname>PostgreSQL</productname>-specific,
21 it's usually better to use the information schema if it provides all
22 the information you need.
23 </para>
24
25 <para>
26 <xref linkend="view-table"/> lists the system views described here.
27 More detailed documentation of each view follows below.
28 There are some additional views that provide access to accumulated
29 statistics; they are described in
30 <xref linkend="monitoring-stats-views-table"/>.
31 </para>
32
33 <sect1 id="views-overview">
34 <title>Overview</title>
35
36 <para>
37 <xref linkend="view-table"/> lists the system views.
38 More detailed documentation of each catalog follows below.
39 Except where noted, all the views described here are read-only.
40 </para>
41
42 <table id="view-table">
43 <title>System Views</title>
44
45 <tgroup cols="2">
46 <thead>
47 <row>
48 <entry>View Name</entry>
49 <entry>Purpose</entry>
50 </row>
51 </thead>
52
53 <tbody>
54 <row>
55 <entry><link linkend="view-pg-aios"><structname>pg_aios</structname></link></entry>
56 <entry>In-use asynchronous IO handles</entry>
57 </row>
58
59 <row>
60 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
61 <entry>available extensions</entry>
62 </row>
63
64 <row>
65 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
66 <entry>available versions of extensions</entry>
67 </row>
68
69 <row>
70 <entry><link linkend="view-pg-backend-memory-contexts"><structname>pg_backend_memory_contexts</structname></link></entry>
71 <entry>backend memory contexts</entry>
72 </row>
73
74 <row>
75 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
76 <entry>compile-time configuration parameters</entry>
77 </row>
78
79 <row>
80 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
81 <entry>open cursors</entry>
82 </row>
83
84 <row>
85 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
86 <entry>summary of configuration file contents</entry>
87 </row>
88
89 <row>
90 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
91 <entry>groups of database users</entry>
92 </row>
93
94 <row>
95 <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
96 <entry>summary of client authentication configuration file contents</entry>
97 </row>
98
99 <row>
100 <entry><link linkend="view-pg-ident-file-mappings"><structname>pg_ident_file_mappings</structname></link></entry>
101 <entry>summary of client user name mapping configuration file contents</entry>
102 </row>
103
104 <row>
105 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
106 <entry>indexes</entry>
107 </row>
108
109 <row>
110 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
111 <entry>locks currently held or awaited</entry>
112 </row>
113
114 <row>
115 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
116 <entry>materialized views</entry>
117 </row>
118
119 <row>
120 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
121 <entry>policies</entry>
122 </row>
123
124 <row>
125 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
126 <entry>prepared statements</entry>
127 </row>
128
129 <row>
130 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
131 <entry>prepared transactions</entry>
132 </row>
133
134 <row>
135 <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
136 <entry>publications and information of their associated tables</entry>
137 </row>
138
139 <row>
140 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
141 <entry>information about replication origins, including replication progress</entry>
142 </row>
143
144 <row>
145 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
146 <entry>replication slot information</entry>
147 </row>
148
149 <row>
150 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
151 <entry>database roles</entry>
152 </row>
153
154 <row>
155 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
156 <entry>rules</entry>
157 </row>
158
159 <row>
160 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
161 <entry>security labels</entry>
162 </row>
163
164 <row>
165 <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
166 <entry>sequences</entry>
167 </row>
168
169 <row>
170 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
171 <entry>parameter settings</entry>
172 </row>
173
174 <row>
175 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
176 <entry>database users</entry>
177 </row>
178
179 <row>
180 <entry><link linkend="view-pg-shmem-allocations"><structname>pg_shmem_allocations</structname></link></entry>
181 <entry>shared memory allocations</entry>
182 </row>
183
184 <row>
185 <entry><link linkend="view-pg-shmem-allocations-numa"><structname>pg_shmem_allocations_numa</structname></link></entry>
186 <entry>NUMA node mappings for shared memory allocations</entry>
187 </row>
188
189 <row>
190 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
191 <entry>planner statistics</entry>
192 </row>
193
194 <row>
195 <entry><link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link></entry>
196 <entry>extended planner statistics</entry>
197 </row>
198
199 <row>
200 <entry><link linkend="view-pg-stats-ext-exprs"><structname>pg_stats_ext_exprs</structname></link></entry>
201 <entry>extended planner statistics for expressions</entry>
202 </row>
203
204 <row>
205 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
206 <entry>tables</entry>
207 </row>
208
209 <row>
210 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
211 <entry>time zone abbreviations</entry>
212 </row>
213
214 <row>
215 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
216 <entry>time zone names</entry>
217 </row>
218
219 <row>
220 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
221 <entry>database users</entry>
222 </row>
223
224 <row>
225 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
226 <entry>user mappings</entry>
227 </row>
228
229 <row>
230 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
231 <entry>views</entry>
232 </row>
233
234 <row>
235 <entry><link linkend="view-pg-wait-events"><structname>pg_wait_events</structname></link></entry>
236 <entry>wait events</entry>
237 </row>
238
239 </tbody>
240 </tgroup>
241 </table>
242 </sect1>
243
244 <sect1 id="view-pg-aios">
245 <title><structname>pg_aios</structname></title>
246
247 <indexterm zone="view-pg-aios">
248 <primary>pg_aios</primary>
249 </indexterm>
250
251 <para>
252 The <structname>pg_aios</structname> view lists all <xref
253 linkend="glossary-aio"/> handles that are currently in-use. An I/O handle
254 is used to reference an I/O operation that is being prepared, executed or
255 is in the process of completing. <structname>pg_aios</structname> contains
256 one row for each I/O handle.
257 </para>
258
259 <para>
260 This view is mainly useful for developers of
261 <productname>PostgreSQL</productname>, but may also be useful when tuning
262 <productname>PostgreSQL</productname>.
263 </para>
264
265 <table>
266 <title><structname>pg_aios</structname> Columns</title>
267 <tgroup cols="1">
268 <thead>
269 <row>
270 <entry role="catalog_table_entry"><para role="column_definition">
271 Column Type
272 </para>
273 <para>
274 Description
275 </para></entry>
276 </row>
277 </thead>
278
279 <tbody>
280 <row>
281 <entry role="catalog_table_entry"><para role="column_definition">
282 <structfield>pid</structfield> <type>int4</type>
283 </para>
284 <para>
285 Process ID of the server process that is issuing this I/O.
286 </para></entry>
287 </row>
288
289 <row>
290 <entry role="catalog_table_entry"><para role="column_definition">
291 <structfield>io_id</structfield> <type>int4</type>
292 </para>
293 <para>
294 Identifier of the I/O handle. Handles are reused once the I/O
295 completed (or if the handle is released before I/O is started). On reuse
296 <link linkend="view-pg-aios-io-generation">
297 <structname>pg_aios</structname>.<structfield>io_generation</structfield>
298 </link>
299 is incremented.
300 </para></entry>
301 </row>
302
303 <row>
304 <entry role="catalog_table_entry" id="view-pg-aios-io-generation"><para role="column_definition">
305 <structfield>io_generation</structfield> <type>int8</type>
306 </para>
307 <para>
308 Generation of the I/O handle.
309 </para></entry>
310 </row>
311
312 <row>
313 <entry role="catalog_table_entry"><para role="column_definition">
314 <structfield>state</structfield> <type>text</type>
315 </para>
316 <para>
317 State of the I/O handle:
318 <itemizedlist>
319 <listitem>
320 <para>
321 <literal>HANDED_OUT</literal>, referenced by code but not yet used
322 </para>
323 </listitem>
324 <listitem>
325 <para>
326 <literal>DEFINED</literal>, information necessary for execution is known
327 </para>
328 </listitem>
329 <listitem>
330 <para>
331 <literal>STAGED</literal>, ready for execution
332 </para>
333 </listitem>
334 <listitem>
335 <para>
336 <literal>SUBMITTED</literal>, submitted for execution
337 </para>
338 </listitem>
339 <listitem>
340 <para>
341 <literal>COMPLETED_IO</literal>, finished, but result has not yet been processed
342 </para>
343 </listitem>
344 <listitem>
345 <para>
346 <literal>COMPLETED_SHARED</literal>, shared completion processing completed
347 </para>
348 </listitem>
349 <listitem>
350 <para>
351 <literal>COMPLETED_LOCAL</literal>, backend local completion processing completed
352 </para>
353 </listitem>
354 </itemizedlist>
355 </para></entry>
356 </row>
357
358 <row>
359 <entry role="catalog_table_entry"><para role="column_definition">
360 <structfield>operation</structfield> <type>text</type>
361 </para>
362 <para>
363 Operation performed using the I/O handle:
364 <itemizedlist>
365 <listitem>
366 <para>
367 <literal>invalid</literal>, not yet known
368 </para>
369 </listitem>
370 <listitem>
371 <para>
372 <literal>readv</literal>, a vectored read
373 </para>
374 </listitem>
375 <listitem>
376 <para>
377 <literal>writev</literal>, a vectored write
378 </para>
379 </listitem>
380 </itemizedlist>
381 </para></entry>
382 </row>
383
384 <row>
385 <entry role="catalog_table_entry"><para role="column_definition">
386 <structfield>off</structfield> <type>int8</type>
387 </para>
388 <para>
389 Offset of the I/O operation.
390 </para></entry>
391 </row>
392
393 <row>
394 <entry role="catalog_table_entry"><para role="column_definition">
395 <structfield>length</structfield> <type>int8</type>
396 </para>
397 <para>
398 Length of the I/O operation.
399 </para></entry>
400 </row>
401
402 <row>
403 <entry role="catalog_table_entry"><para role="column_definition">
404 <structfield>target</structfield> <type>text</type>
405 </para>
406 <para>
407 What kind of object is the I/O targeting:
408 <itemizedlist spacing="compact">
409 <listitem>
410 <para>
411 <literal>smgr</literal>, I/O on relations
412 </para>
413 </listitem>
414 </itemizedlist>
415 </para></entry>
416 </row>
417
418 <row>
419 <entry role="catalog_table_entry"><para role="column_definition">
420 <structfield>handle_data_len</structfield> <type>int2</type>
421 </para>
422 <para>
423 Length of the data associated with the I/O operation. For I/O to/from
424 <xref linkend="guc-shared-buffers"/> and <xref
425 linkend="guc-temp-buffers"/>, this indicates the number of buffers the
426 I/O is operating on.
427 </para></entry>
428 </row>
429
430 <row>
431 <entry role="catalog_table_entry"><para role="column_definition">
432 <structfield>raw_result</structfield> <type>int4</type>
433 </para>
434 <para>
435 Low-level result of the I/O operation, or NULL if the operation has not
436 yet completed.
437 </para></entry>
438 </row>
439
440 <row>
441 <entry role="catalog_table_entry"><para role="column_definition">
442 <structfield>result</structfield> <type>text</type>
443 </para>
444 <para>
445 High-level result of the I/O operation:
446 <itemizedlist>
447 <listitem>
448 <para>
449 <literal>UNKNOWN</literal> means that the result of the
450 operation is not yet known.
451 </para>
452 </listitem>
453 <listitem>
454 <para>
455 <literal>OK</literal> means the I/O completed successfully.
456 </para>
457 </listitem>
458 <listitem>
459 <para>
460 <literal>PARTIAL</literal> means that the I/O completed without
461 error, but did not process all data. Commonly callers will need to
462 retry and perform the remainder of the work in a separate I/O.
463 </para>
464 </listitem>
465 <listitem>
466 <para>
467 <literal>WARNING</literal> means that the I/O completed without
468 error, but that execution of the IO triggered a warning. E.g. when
469 encountering a corrupted buffer with <xref
470 linkend="guc-zero-damaged-pages"/> enabled.
471 </para>
472 </listitem>
473 <listitem>
474 <para>
475 <literal>ERROR</literal> means the I/O failed with an error.
476 </para>
477 </listitem>
478 </itemizedlist>
479 </para></entry>
480 </row>
481
482 <row>
483 <entry role="catalog_table_entry"><para role="column_definition">
484 <structfield>target_desc</structfield> <type>text</type>
485 </para>
486 <para>
487 Description of what the I/O operation is targeting.
488 </para></entry>
489 </row>
490
491 <row>
492 <entry role="catalog_table_entry"><para role="column_definition">
493 <structfield>f_sync</structfield> <type>bool</type>
494 </para>
495 <para>
496 Flag indicating whether the I/O is executed synchronously.
497 </para></entry>
498 </row>
499
500 <row>
501 <entry role="catalog_table_entry"><para role="column_definition">
502 <structfield>f_localmem</structfield> <type>bool</type>
503 </para>
504 <para>
505 Flag indicating whether the I/O references process local memory.
506 </para></entry>
507 </row>
508
509 <row>
510 <entry role="catalog_table_entry"><para role="column_definition">
511 <structfield>f_buffered</structfield> <type>bool</type>
512 </para>
513 <para>
514 Flag indicating whether the I/O is buffered I/O.
515 </para></entry>
516 </row>
517
518 </tbody>
519 </tgroup>
520 </table>
521
522 <para>
523 The <structname>pg_aios</structname> view is read-only.
524 </para>
525
526 <para>
527 By default, the <structname>pg_aios</structname> view can be read only by
528 superusers or roles with privileges of the
529 <literal>pg_read_all_stats</literal> role.
530 </para>
531 </sect1>
532
533 <sect1 id="view-pg-available-extensions">
534 <title><structname>pg_available_extensions</structname></title>
535
536 <indexterm zone="view-pg-available-extensions">
537 <primary>pg_available_extensions</primary>
538 </indexterm>
539
540 <para>
541 The <structname>pg_available_extensions</structname> view lists the
542 extensions that are available for installation.
543 See also the
544 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
545 catalog, which shows the extensions currently installed.
546 </para>
547
548 <table>
549 <title><structname>pg_available_extensions</structname> Columns</title>
550 <tgroup cols="1">
551 <thead>
552 <row>
553 <entry role="catalog_table_entry"><para role="column_definition">
554 Column Type
555 </para>
556 <para>
557 Description
558 </para></entry>
559 </row>
560 </thead>
561
562 <tbody>
563 <row>
564 <entry role="catalog_table_entry"><para role="column_definition">
565 <structfield>name</structfield> <type>name</type>
566 </para>
567 <para>
568 Extension name
569 </para></entry>
570 </row>
571
572 <row>
573 <entry role="catalog_table_entry"><para role="column_definition">
574 <structfield>default_version</structfield> <type>text</type>
575 </para>
576 <para>
577 Name of default version, or <literal>NULL</literal> if none is
578 specified
579 </para></entry>
580 </row>
581
582 <row>
583 <entry role="catalog_table_entry"><para role="column_definition">
584 <structfield>installed_version</structfield> <type>text</type>
585 </para>
586 <para>
587 Currently installed version of the extension,
588 or <literal>NULL</literal> if not installed
589 </para></entry>
590 </row>
591
592 <row>
593 <entry role="catalog_table_entry"><para role="column_definition">
594 <structfield>comment</structfield> <type>text</type>
595 </para>
596 <para>
597 Comment string from the extension's control file
598 </para></entry>
599 </row>
600 </tbody>
601 </tgroup>
602 </table>
603
604 <para>
605 The <structname>pg_available_extensions</structname> view is read-only.
606 </para>
607 </sect1>
608
609 <sect1 id="view-pg-available-extension-versions">
610 <title><structname>pg_available_extension_versions</structname></title>
611
612 <indexterm zone="view-pg-available-extension-versions">
613 <primary>pg_available_extension_versions</primary>
614 </indexterm>
615
616 <para>
617 The <structname>pg_available_extension_versions</structname> view lists the
618 specific extension versions that are available for installation.
619 See also the <link
620 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
621 catalog, which shows the extensions currently installed.
622 </para>
623
624 <table>
625 <title><structname>pg_available_extension_versions</structname> Columns</title>
626 <tgroup cols="1">
627 <thead>
628 <row>
629 <entry role="catalog_table_entry"><para role="column_definition">
630 Column Type
631 </para>
632 <para>
633 Description
634 </para></entry>
635 </row>
636 </thead>
637
638 <tbody>
639 <row>
640 <entry role="catalog_table_entry"><para role="column_definition">
641 <structfield>name</structfield> <type>name</type>
642 </para>
643 <para>
644 Extension name
645 </para></entry>
646 </row>
647
648 <row>
649 <entry role="catalog_table_entry"><para role="column_definition">
650 <structfield>version</structfield> <type>text</type>
651 </para>
652 <para>
653 Version name
654 </para></entry>
655 </row>
656
657 <row>
658 <entry role="catalog_table_entry"><para role="column_definition">
659 <structfield>installed</structfield> <type>bool</type>
660 </para>
661 <para>
662 True if this version of this extension is currently
663 installed
664 </para></entry>
665 </row>
666
667 <row>
668 <entry role="catalog_table_entry"><para role="column_definition">
669 <structfield>superuser</structfield> <type>bool</type>
670 </para>
671 <para>
672 True if only superusers are allowed to install this extension
673 (but see <structfield>trusted</structfield>)
674 </para></entry>
675 </row>
676
677 <row>
678 <entry role="catalog_table_entry"><para role="column_definition">
679 <structfield>trusted</structfield> <type>bool</type>
680 </para>
681 <para>
682 True if the extension can be installed by non-superusers
683 with appropriate privileges
684 </para></entry>
685 </row>
686
687 <row>
688 <entry role="catalog_table_entry"><para role="column_definition">
689 <structfield>relocatable</structfield> <type>bool</type>
690 </para>
691 <para>
692 True if extension can be relocated to another schema
693 </para></entry>
694 </row>
695
696 <row>
697 <entry role="catalog_table_entry"><para role="column_definition">
698 <structfield>schema</structfield> <type>name</type>
699 </para>
700 <para>
701 Name of the schema that the extension must be installed into,
702 or <literal>NULL</literal> if partially or fully relocatable
703 </para></entry>
704 </row>
705
706 <row>
707 <entry role="catalog_table_entry"><para role="column_definition">
708 <structfield>requires</structfield> <type>name[]</type>
709 </para>
710 <para>
711 Names of prerequisite extensions,
712 or <literal>NULL</literal> if none
713 </para></entry>
714 </row>
715
716 <row>
717 <entry role="catalog_table_entry"><para role="column_definition">
718 <structfield>comment</structfield> <type>text</type>
719 </para>
720 <para>
721 Comment string from the extension's control file
722 </para></entry>
723 </row>
724 </tbody>
725 </tgroup>
726 </table>
727
728 <para>
729 The <structname>pg_available_extension_versions</structname> view is
730 read-only.
731 </para>
732 </sect1>
733
734 <sect1 id="view-pg-backend-memory-contexts">
735 <title><structname>pg_backend_memory_contexts</structname></title>
736
737 <indexterm zone="view-pg-backend-memory-contexts">
738 <primary>pg_backend_memory_contexts</primary>
739 </indexterm>
740
741 <para>
742 The view <structname>pg_backend_memory_contexts</structname> displays all
743 the memory contexts of the server process attached to the current session.
744 </para>
745 <para>
746 <structname>pg_backend_memory_contexts</structname> contains one row
747 for each memory context.
748 </para>
749
750 <table>
751 <title><structname>pg_backend_memory_contexts</structname> Columns</title>
752 <tgroup cols="1">
753 <thead>
754 <row>
755 <entry role="catalog_table_entry"><para role="column_definition">
756 Column Type
757 </para>
758 <para>
759 Description
760 </para></entry>
761 </row>
762 </thead>
763
764 <tbody>
765 <row>
766 <entry role="catalog_table_entry"><para role="column_definition">
767 <structfield>name</structfield> <type>text</type>
768 </para>
769 <para>
770 Name of the memory context
771 </para></entry>
772 </row>
773
774 <row>
775 <entry role="catalog_table_entry"><para role="column_definition">
776 <structfield>ident</structfield> <type>text</type>
777 </para>
778 <para>
779 Identification information of the memory context. This field is truncated at 1024 bytes
780 </para></entry>
781 </row>
782
783 <row>
784 <entry role="catalog_table_entry"><para role="column_definition">
785 <structfield>type</structfield> <type>text</type>
786 </para>
787 <para>
788 Type of the memory context
789 </para></entry>
790 </row>
791
792 <row>
793 <entry role="catalog_table_entry"><para role="column_definition">
794 <structfield>level</structfield> <type>int4</type>
795 </para>
796 <para>
797 The 1-based level of the context in the memory context hierarchy. The
798 level of a context also shows the position of that context in the
799 <structfield>path</structfield> column.
800 </para></entry>
801 </row>
802
803 <row>
804 <entry role="catalog_table_entry"><para role="column_definition">
805 <structfield>path</structfield> <type>int4[]</type>
806 </para>
807 <para>
808 Array of transient numerical identifiers to describe the memory
809 context hierarchy. The first element is for
810 <literal>TopMemoryContext</literal>, subsequent elements contain
811 intermediate parents and the final element contains the identifier for
812 the current context.
813 </para></entry>
814 </row>
815
816 <row>
817 <entry role="catalog_table_entry"><para role="column_definition">
818 <structfield>total_bytes</structfield> <type>int8</type>
819 </para>
820 <para>
821 Total bytes allocated for this memory context
822 </para></entry>
823 </row>
824
825 <row>
826 <entry role="catalog_table_entry"><para role="column_definition">
827 <structfield>total_nblocks</structfield> <type>int8</type>
828 </para>
829 <para>
830 Total number of blocks allocated for this memory context
831 </para></entry>
832 </row>
833
834 <row>
835 <entry role="catalog_table_entry"><para role="column_definition">
836 <structfield>free_bytes</structfield> <type>int8</type>
837 </para>
838 <para>
839 Free space in bytes
840 </para></entry>
841 </row>
842
843 <row>
844 <entry role="catalog_table_entry"><para role="column_definition">
845 <structfield>free_chunks</structfield> <type>int8</type>
846 </para>
847 <para>
848 Total number of free chunks
849 </para></entry>
850 </row>
851
852 <row>
853 <entry role="catalog_table_entry"><para role="column_definition">
854 <structfield>used_bytes</structfield> <type>int8</type>
855 </para>
856 <para>
857 Used space in bytes
858 </para></entry>
859 </row>
860 </tbody>
861 </tgroup>
862 </table>
863
864 <para>
865 By default, the <structname>pg_backend_memory_contexts</structname> view can be
866 read only by superusers or roles with the privileges of the
867 <literal>pg_read_all_stats</literal> role.
868 </para>
869
870 <para>
871 Since memory contexts are created and destroyed during the running of a
872 query, the identifiers stored in the <structfield>path</structfield> column
873 can be unstable between multiple invocations of the view in the same query.
874 The example below demonstrates an effective usage of this column and
875 calculates the total number of bytes used by
876 <literal>CacheMemoryContext</literal> and all of its children:
877
878 <programlisting>
879 WITH memory_contexts AS (
880 SELECT * FROM pg_backend_memory_contexts
881 )
882 SELECT sum(c1.total_bytes)
883 FROM memory_contexts c1, memory_contexts c2
884 WHERE c2.name = 'CacheMemoryContext'
885 AND c1.path[c2.level] = c2.path[c2.level];
886 </programlisting>
887
888 The <link linkend="queries-with">Common Table Expression</link> is used
889 to ensure the context IDs in the <structfield>path</structfield> column
890 match between both evaluations of the view.
891 </para>
892 </sect1>
893
894 <sect1 id="view-pg-config">
895 <title><structname>pg_config</structname></title>
896
897 <indexterm zone="view-pg-config">
898 <primary>pg_config</primary>
899 </indexterm>
900
901 <para>
902 The view <structname>pg_config</structname> describes the
903 compile-time configuration parameters of the currently installed
904 version of <productname>PostgreSQL</productname>. It is intended, for example, to
905 be used by software packages that want to interface to
906 <productname>PostgreSQL</productname> to facilitate finding the required header
907 files and libraries. It provides the same basic information as the
908 <xref linkend="app-pgconfig"/> <productname>PostgreSQL</productname> client
909 application.
910 </para>
911
912 <para>
913 By default, the <structname>pg_config</structname> view can be read
914 only by superusers.
915 </para>
916
917 <table>
918 <title><structname>pg_config</structname> Columns</title>
919 <tgroup cols="1">
920 <thead>
921 <row>
922 <entry role="catalog_table_entry"><para role="column_definition">
923 Column Type
924 </para>
925 <para>
926 Description
927 </para></entry>
928 </row>
929 </thead>
930
931 <tbody>
932 <row>
933 <entry role="catalog_table_entry"><para role="column_definition">
934 <structfield>name</structfield> <type>text</type>
935 </para>
936 <para>
937 The parameter name
938 </para></entry>
939 </row>
940
941 <row>
942 <entry role="catalog_table_entry"><para role="column_definition">
943 <structfield>setting</structfield> <type>text</type>
944 </para>
945 <para>
946 The parameter value
947 </para></entry>
948 </row>
949 </tbody>
950 </tgroup>
951 </table>
952
953 </sect1>
954
955 <sect1 id="view-pg-cursors">
956 <title><structname>pg_cursors</structname></title>
957
958 <indexterm zone="view-pg-cursors">
959 <primary>pg_cursors</primary>
960 </indexterm>
961
962 <para>
963 The <structname>pg_cursors</structname> view lists the cursors that
964 are currently available. Cursors can be defined in several ways:
965 <itemizedlist>
966 <listitem>
967 <para>
968 via the <link linkend="sql-declare"><command>DECLARE</command></link>
969 statement in SQL
970 </para>
971 </listitem>
972
973 <listitem>
974 <para>
975 via the Bind message in the frontend/backend protocol, as
976 described in <xref linkend="protocol-flow-ext-query"/>
977 </para>
978 </listitem>
979
980 <listitem>
981 <para>
982 via the Server Programming Interface (SPI), as described in
983 <xref linkend="spi-interface"/>
984 </para>
985 </listitem>
986 </itemizedlist>
987
988 The <structname>pg_cursors</structname> view displays cursors
989 created by any of these means. Cursors only exist for the duration
990 of the transaction that defines them, unless they have been
991 declared <literal>WITH HOLD</literal>. Therefore non-holdable
992 cursors are only present in the view until the end of their
993 creating transaction.
994
995 <note>
996 <para>
997 Cursors are used internally to implement some of the components
998 of <productname>PostgreSQL</productname>, such as procedural languages.
999 Therefore, the <structname>pg_cursors</structname> view might include cursors
1000 that have not been explicitly created by the user.
1001 </para>
1002 </note>
1003 </para>
1004
1005 <table>
1006 <title><structname>pg_cursors</structname> Columns</title>
1007 <tgroup cols="1">
1008 <thead>
1009 <row>
1010 <entry role="catalog_table_entry"><para role="column_definition">
1011 Column Type
1012 </para>
1013 <para>
1014 Description
1015 </para></entry>
1016 </row>
1017 </thead>
1018
1019 <tbody>
1020 <row>
1021 <entry role="catalog_table_entry"><para role="column_definition">
1022 <structfield>name</structfield> <type>text</type>
1023 </para>
1024 <para>
1025 The name of the cursor
1026 </para></entry>
1027 </row>
1028
1029 <row>
1030 <entry role="catalog_table_entry"><para role="column_definition">
1031 <structfield>statement</structfield> <type>text</type>
1032 </para>
1033 <para>
1034 The verbatim query string submitted to declare this cursor
1035 </para></entry>
1036 </row>
1037
1038 <row>
1039 <entry role="catalog_table_entry"><para role="column_definition">
1040 <structfield>is_holdable</structfield> <type>bool</type>
1041 </para>
1042 <para>
1043 <literal>true</literal> if the cursor is holdable (that is, it
1044 can be accessed after the transaction that declared the cursor
1045 has committed); <literal>false</literal> otherwise
1046 </para></entry>
1047 </row>
1048
1049 <row>
1050 <entry role="catalog_table_entry"><para role="column_definition">
1051 <structfield>is_binary</structfield> <type>bool</type>
1052 </para>
1053 <para>
1054 <literal>true</literal> if the cursor was declared
1055 <literal>BINARY</literal>; <literal>false</literal>
1056 otherwise
1057 </para></entry>
1058 </row>
1059
1060 <row>
1061 <entry role="catalog_table_entry"><para role="column_definition">
1062 <structfield>is_scrollable</structfield> <type>bool</type>
1063 </para>
1064 <para>
1065 <literal>true</literal> if the cursor is scrollable (that is, it
1066 allows rows to be retrieved in a nonsequential manner);
1067 <literal>false</literal> otherwise
1068 </para></entry>
1069 </row>
1070
1071 <row>
1072 <entry role="catalog_table_entry"><para role="column_definition">
1073 <structfield>creation_time</structfield> <type>timestamptz</type>
1074 </para>
1075 <para>
1076 The time at which the cursor was declared
1077 </para></entry>
1078 </row>
1079 </tbody>
1080 </tgroup>
1081 </table>
1082
1083 <para>
1084 The <structname>pg_cursors</structname> view is read-only.
1085 </para>
1086
1087 </sect1>
1088
1089 <sect1 id="view-pg-file-settings">
1090 <title><structname>pg_file_settings</structname></title>
1091
1092 <indexterm zone="view-pg-file-settings">
1093 <primary>pg_file_settings</primary>
1094 </indexterm>
1095
1096 <para>
1097 The view <structname>pg_file_settings</structname> provides a summary of
1098 the contents of the server's configuration file(s). A row appears in
1099 this view for each <quote>name = value</quote> entry appearing in the files,
1100 with annotations indicating whether the value could be applied
1101 successfully. Additional row(s) may appear for problems not linked to
1102 a <quote>name = value</quote> entry, such as syntax errors in the files.
1103 </para>
1104
1105 <para>
1106 This view is helpful for checking whether planned changes in the
1107 configuration files will work, or for diagnosing a previous failure.
1108 Note that this view reports on the <emphasis>current</emphasis> contents of the
1109 files, not on what was last applied by the server. (The
1110 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
1111 view is usually sufficient to determine that.)
1112 </para>
1113
1114 <para>
1115 By default, the <structname>pg_file_settings</structname> view can be read
1116 only by superusers.
1117 </para>
1118
1119 <table>
1120 <title><structname>pg_file_settings</structname> Columns</title>
1121 <tgroup cols="1">
1122 <thead>
1123 <row>
1124 <entry role="catalog_table_entry"><para role="column_definition">
1125 Column Type
1126 </para>
1127 <para>
1128 Description
1129 </para></entry>
1130 </row>
1131 </thead>
1132
1133 <tbody>
1134 <row>
1135 <entry role="catalog_table_entry"><para role="column_definition">
1136 <structfield>sourcefile</structfield> <type>text</type>
1137 </para>
1138 <para>
1139 Full path name of the configuration file
1140 </para></entry>
1141 </row>
1142
1143 <row>
1144 <entry role="catalog_table_entry"><para role="column_definition">
1145 <structfield>sourceline</structfield> <type>int4</type>
1146 </para>
1147 <para>
1148 Line number within the configuration file where the entry appears
1149 </para></entry>
1150 </row>
1151
1152 <row>
1153 <entry role="catalog_table_entry"><para role="column_definition">
1154 <structfield>seqno</structfield> <type>int4</type>
1155 </para>
1156 <para>
1157 Order in which the entries are processed (1..<replaceable>n</replaceable>)
1158 </para></entry>
1159 </row>
1160
1161 <row>
1162 <entry role="catalog_table_entry"><para role="column_definition">
1163 <structfield>name</structfield> <type>text</type>
1164 </para>
1165 <para>
1166 Configuration parameter name
1167 </para></entry>
1168 </row>
1169
1170 <row>
1171 <entry role="catalog_table_entry"><para role="column_definition">
1172 <structfield>setting</structfield> <type>text</type>
1173 </para>
1174 <para>
1175 Value to be assigned to the parameter
1176 </para></entry>
1177 </row>
1178
1179 <row>
1180 <entry role="catalog_table_entry"><para role="column_definition">
1181 <structfield>applied</structfield> <type>bool</type>
1182 </para>
1183 <para>
1184 True if the value can be applied successfully
1185 </para></entry>
1186 </row>
1187
1188 <row>
1189 <entry role="catalog_table_entry"><para role="column_definition">
1190 <structfield>error</structfield> <type>text</type>
1191 </para>
1192 <para>
1193 If not null, an error message indicating why this entry could
1194 not be applied
1195 </para></entry>
1196 </row>
1197 </tbody>
1198 </tgroup>
1199 </table>
1200
1201 <para>
1202 If the configuration file contains syntax errors or invalid parameter
1203 names, the server will not attempt to apply any settings from it, and
1204 therefore all the <structfield>applied</structfield> fields will read as false.
1205 In such a case there will be one or more rows with
1206 non-null <structfield>error</structfield> fields indicating the
1207 problem(s). Otherwise, individual settings will be applied if possible.
1208 If an individual setting cannot be applied (e.g., invalid value, or the
1209 setting cannot be changed after server start) it will have an appropriate
1210 message in the <structfield>error</structfield> field. Another way that
1211 an entry might have <structfield>applied</structfield> = false is that it is
1212 overridden by a later entry for the same parameter name; this case is not
1213 considered an error so nothing appears in
1214 the <structfield>error</structfield> field.
1215 </para>
1216
1217 <para>
1218 See <xref linkend="config-setting"/> for more information about the various
1219 ways to change run-time parameters.
1220 </para>
1221
1222 </sect1>
1223
1224 <sect1 id="view-pg-group">
1225 <title><structname>pg_group</structname></title>
1226
1227 <indexterm zone="view-pg-group">
1228 <primary>pg_group</primary>
1229 </indexterm>
1230
1231 <!-- Unlike information_schema.applicable_roles, this shows no members for
1232 pg_database_owner. The v8.1 catalog would have shown no members if
1233 that role had existed at the time. -->
1234 <para>
1235 The view <structname>pg_group</structname> exists for backwards
1236 compatibility: it emulates a catalog that existed in
1237 <productname>PostgreSQL</productname> before version 8.1.
1238 It shows the names and members of all roles that are marked as not
1239 <structfield>rolcanlogin</structfield>, which is an approximation to the set
1240 of roles that are being used as groups.
1241 </para>
1242
1243 <table>
1244 <title><structname>pg_group</structname> Columns</title>
1245 <tgroup cols="1">
1246 <thead>
1247 <row>
1248 <entry role="catalog_table_entry"><para role="column_definition">
1249 Column Type
1250 </para>
1251 <para>
1252 Description
1253 </para></entry>
1254 </row>
1255 </thead>
1256
1257 <tbody>
1258 <row>
1259 <entry role="catalog_table_entry"><para role="column_definition">
1260 <structfield>groname</structfield> <type>name</type>
1261 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
1262 </para>
1263 <para>
1264 Name of the group
1265 </para></entry>
1266 </row>
1267
1268 <row>
1269 <entry role="catalog_table_entry"><para role="column_definition">
1270 <structfield>grosysid</structfield> <type>oid</type>
1271 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1272 </para>
1273 <para>
1274 ID of this group
1275 </para></entry>
1276 </row>
1277
1278 <row>
1279 <entry role="catalog_table_entry"><para role="column_definition">
1280 <structfield>grolist</structfield> <type>oid[]</type>
1281 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1282 </para>
1283 <para>
1284 An array containing the IDs of the roles in this group
1285 </para></entry>
1286 </row>
1287 </tbody>
1288 </tgroup>
1289 </table>
1290
1291 </sect1>
1292
1293 <sect1 id="view-pg-hba-file-rules">
1294 <title><structname>pg_hba_file_rules</structname></title>
1295
1296 <indexterm zone="view-pg-hba-file-rules">
1297 <primary>pg_hba_file_rules</primary>
1298 </indexterm>
1299
1300 <para>
1301 The view <structname>pg_hba_file_rules</structname> provides a summary of
1302 the contents of the client authentication configuration file,
1303 <link linkend="auth-pg-hba-conf"><filename>pg_hba.conf</filename></link>.
1304 A row appears in this view for each
1305 non-empty, non-comment line in the file, with annotations indicating
1306 whether the rule could be applied successfully.
1307 </para>
1308
1309 <para>
1310 This view can be helpful for checking whether planned changes in the
1311 authentication configuration file will work, or for diagnosing a previous
1312 failure. Note that this view reports on the <emphasis>current</emphasis> contents
1313 of the file, not on what was last loaded by the server.
1314 </para>
1315
1316 <para>
1317 By default, the <structname>pg_hba_file_rules</structname> view can be read
1318 only by superusers.
1319 </para>
1320
1321 <table>
1322 <title><structname>pg_hba_file_rules</structname> Columns</title>
1323 <tgroup cols="1">
1324 <thead>
1325 <row>
1326 <entry role="catalog_table_entry"><para role="column_definition">
1327 Column Type
1328 </para>
1329 <para>
1330 Description
1331 </para></entry>
1332 </row>
1333 </thead>
1334
1335 <tbody>
1336 <row>
1337 <entry role="catalog_table_entry"><para role="column_definition">
1338 <structfield>rule_number</structfield> <type>int4</type>
1339 </para>
1340 <para>
1341 Number of this rule, if valid, otherwise <literal>NULL</literal>.
1342 This indicates the order in which each rule is considered
1343 until a match is found during authentication.
1344 </para></entry>
1345 </row>
1346
1347 <row>
1348 <entry role="catalog_table_entry"><para role="column_definition">
1349 <structfield>file_name</structfield> <type>text</type>
1350 </para>
1351 <para>
1352 Name of the file containing this rule
1353 </para></entry>
1354 </row>
1355
1356 <row>
1357 <entry role="catalog_table_entry"><para role="column_definition">
1358 <structfield>line_number</structfield> <type>int4</type>
1359 </para>
1360 <para>
1361 Line number of this rule in <literal>file_name</literal>
1362 </para></entry>
1363 </row>
1364
1365 <row>
1366 <entry role="catalog_table_entry"><para role="column_definition">
1367 <structfield>type</structfield> <type>text</type>
1368 </para>
1369 <para>
1370 Type of connection
1371 </para></entry>
1372 </row>
1373
1374 <row>
1375 <entry role="catalog_table_entry"><para role="column_definition">
1376 <structfield>database</structfield> <type>text[]</type>
1377 </para>
1378 <para>
1379 List of database name(s) to which this rule applies
1380 </para></entry>
1381 </row>
1382
1383 <row>
1384 <entry role="catalog_table_entry"><para role="column_definition">
1385 <structfield>user_name</structfield> <type>text[]</type>
1386 </para>
1387 <para>
1388 List of user and group name(s) to which this rule applies
1389 </para></entry>
1390 </row>
1391
1392 <row>
1393 <entry role="catalog_table_entry"><para role="column_definition">
1394 <structfield>address</structfield> <type>text</type>
1395 </para>
1396 <para>
1397 Host name or IP address, or one
1398 of <literal>all</literal>, <literal>samehost</literal>,
1399 or <literal>samenet</literal>, or null for local connections
1400 </para></entry>
1401 </row>
1402
1403 <row>
1404 <entry role="catalog_table_entry"><para role="column_definition">
1405 <structfield>netmask</structfield> <type>text</type>
1406 </para>
1407 <para>
1408 IP address mask, or null if not applicable
1409 </para></entry>
1410 </row>
1411
1412 <row>
1413 <entry role="catalog_table_entry"><para role="column_definition">
1414 <structfield>auth_method</structfield> <type>text</type>
1415 </para>
1416 <para>
1417 Authentication method
1418 </para></entry>
1419 </row>
1420
1421 <row>
1422 <entry role="catalog_table_entry"><para role="column_definition">
1423 <structfield>options</structfield> <type>text[]</type>
1424 </para>
1425 <para>
1426 Options specified for authentication method, if any
1427 </para></entry>
1428 </row>
1429
1430 <row>
1431 <entry role="catalog_table_entry"><para role="column_definition">
1432 <structfield>error</structfield> <type>text</type>
1433 </para>
1434 <para>
1435 If not null, an error message indicating why this
1436 line could not be processed
1437 </para></entry>
1438 </row>
1439 </tbody>
1440 </tgroup>
1441 </table>
1442
1443 <para>
1444 Usually, a row reflecting an incorrect entry will have values for only
1445 the <structfield>line_number</structfield> and <structfield>error</structfield> fields.
1446 </para>
1447
1448 <para>
1449 See <xref linkend="client-authentication"/> for more information about
1450 client authentication configuration.
1451 </para>
1452 </sect1>
1453
1454 <sect1 id="view-pg-ident-file-mappings">
1455 <title><structname>pg_ident_file_mappings</structname></title>
1456
1457 <indexterm zone="view-pg-ident-file-mappings">
1458 <primary>pg_ident_file_mappings</primary>
1459 </indexterm>
1460
1461 <para>
1462 The view <structname>pg_ident_file_mappings</structname> provides a summary
1463 of the contents of the client user name mapping configuration file,
1464 <link linkend="auth-username-maps"><filename>pg_ident.conf</filename></link>.
1465 A row appears in this view for each non-empty, non-comment line in the file,
1466 with annotations indicating whether the map could be applied successfully.
1467 </para>
1468
1469 <para>
1470 This view can be helpful for checking whether planned changes in the
1471 authentication configuration file will work, or for diagnosing a previous
1472 failure. Note that this view reports on the <emphasis>current</emphasis>
1473 contents of the file, not on what was last loaded by the server.
1474 </para>
1475
1476 <para>
1477 By default, the <structname>pg_ident_file_mappings</structname> view can be
1478 read only by superusers.
1479 </para>
1480
1481 <table>
1482 <title><structname>pg_ident_file_mappings</structname> Columns</title> <tgroup
1483 cols="1">
1484 <thead>
1485 <row>
1486 <entry role="catalog_table_entry"><para role="column_definition">
1487 Column Type
1488 </para>
1489 <para>
1490 Description
1491 </para></entry>
1492 </row>
1493 </thead>
1494
1495 <tbody>
1496 <row>
1497 <entry role="catalog_table_entry"><para role="column_definition">
1498 <structfield>map_number</structfield> <type>int4</type>
1499 </para>
1500 <para>
1501 Number of this map, in priority order, if valid, otherwise
1502 <literal>NULL</literal>
1503 </para></entry>
1504 </row>
1505
1506 <row>
1507 <entry role="catalog_table_entry"><para role="column_definition">
1508 <structfield>file_name</structfield> <type>text</type>
1509 </para>
1510 <para>
1511 Name of the file containing this map
1512 </para></entry>
1513 </row>
1514
1515 <row>
1516 <entry role="catalog_table_entry"><para role="column_definition">
1517 <structfield>line_number</structfield> <type>int4</type>
1518 </para>
1519 <para>
1520 Line number of this map in <literal>file_name</literal>
1521 </para></entry>
1522 </row>
1523
1524 <row>
1525 <entry role="catalog_table_entry"><para role="column_definition">
1526 <structfield>map_name</structfield> <type>text</type>
1527 </para>
1528 <para>
1529 Name of the map
1530 </para></entry>
1531 </row>
1532
1533 <row>
1534 <entry role="catalog_table_entry"><para role="column_definition">
1535 <structfield>sys_name</structfield> <type>text</type>
1536 </para>
1537 <para>
1538 Detected user name of the client
1539 </para></entry>
1540 </row>
1541
1542 <row>
1543 <entry role="catalog_table_entry"><para role="column_definition">
1544 <structfield>pg_username</structfield> <type>text</type>
1545 </para>
1546 <para>
1547 Requested PostgreSQL user name
1548 </para></entry>
1549 </row>
1550
1551 <row>
1552 <entry role="catalog_table_entry"><para role="column_definition">
1553 <structfield>error</structfield> <type>text</type>
1554 </para>
1555 <para>
1556 If not <literal>NULL</literal>, an error message indicating why this
1557 line could not be processed
1558 </para></entry>
1559 </row>
1560 </tbody>
1561 </tgroup>
1562 </table>
1563
1564 <para>
1565 Usually, a row reflecting an incorrect entry will have values for only
1566 the <structfield>line_number</structfield> and <structfield>error</structfield> fields.
1567 </para>
1568
1569 <para>
1570 See <xref linkend="client-authentication"/> for more information about
1571 client authentication configuration.
1572 </para>
1573 </sect1>
1574
1575 <sect1 id="view-pg-indexes">
1576 <title><structname>pg_indexes</structname></title>
1577
1578 <indexterm zone="view-pg-indexes">
1579 <primary>pg_indexes</primary>
1580 </indexterm>
1581
1582 <para>
1583 The view <structname>pg_indexes</structname> provides access to
1584 useful information about each index in the database.
1585 </para>
1586
1587 <table>
1588 <title><structname>pg_indexes</structname> Columns</title>
1589 <tgroup cols="1">
1590 <thead>
1591 <row>
1592 <entry role="catalog_table_entry"><para role="column_definition">
1593 Column Type
1594 </para>
1595 <para>
1596 Description
1597 </para></entry>
1598 </row>
1599 </thead>
1600
1601 <tbody>
1602 <row>
1603 <entry role="catalog_table_entry"><para role="column_definition">
1604 <structfield>schemaname</structfield> <type>name</type>
1605 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
1606 </para>
1607 <para>
1608 Name of schema containing table and index
1609 </para></entry>
1610 </row>
1611
1612 <row>
1613 <entry role="catalog_table_entry"><para role="column_definition">
1614 <structfield>tablename</structfield> <type>name</type>
1615 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
1616 </para>
1617 <para>
1618 Name of table the index is for
1619 </para></entry>
1620 </row>
1621
1622 <row>
1623 <entry role="catalog_table_entry"><para role="column_definition">
1624 <structfield>indexname</structfield> <type>name</type>
1625 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
1626 </para>
1627 <para>
1628 Name of index
1629 </para></entry>
1630 </row>
1631
1632 <row>
1633 <entry role="catalog_table_entry"><para role="column_definition">
1634 <structfield>tablespace</structfield> <type>name</type>
1635 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
1636 </para>
1637 <para>
1638 Name of tablespace containing index (null if default for database)
1639 </para></entry>
1640 </row>
1641
1642 <row>
1643 <entry role="catalog_table_entry"><para role="column_definition">
1644 <structfield>indexdef</structfield> <type>text</type>
1645 </para>
1646 <para>
1647 Index definition (a reconstructed <xref linkend="sql-createindex"/>
1648 command)
1649 </para></entry>
1650 </row>
1651 </tbody>
1652 </tgroup>
1653 </table>
1654
1655 </sect1>
1656
1657 <sect1 id="view-pg-locks">
1658 <title><structname>pg_locks</structname></title>
1659
1660 <indexterm zone="view-pg-locks">
1661 <primary>pg_locks</primary>
1662 </indexterm>
1663
1664 <para>
1665 The view <structname>pg_locks</structname> provides access to
1666 information about the locks held by active processes within the
1667 database server. See <xref linkend="mvcc"/> for more discussion
1668 of locking.
1669 </para>
1670
1671 <para>
1672 <structname>pg_locks</structname> contains one row per active lockable
1673 object, requested lock mode, and relevant process. Thus, the same
1674 lockable object might
1675 appear many times, if multiple processes are holding or waiting
1676 for locks on it. However, an object that currently has no locks on it
1677 will not appear at all.
1678 </para>
1679
1680 <para>
1681 There are several distinct types of lockable objects:
1682 whole relations (e.g., tables), individual pages of relations,
1683 individual tuples of relations,
1684 transaction IDs (both virtual and permanent IDs),
1685 and general database objects (identified by class OID and object OID,
1686 in the same way as in <link linkend="catalog-pg-description"><structname>pg_description</structname></link> or
1687 <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>). Also, the right to extend a
1688 relation is represented as a separate lockable object, as is the right to
1689 update <structname>pg_database</structname>.<structfield>datfrozenxid</structfield>.
1690 Also, <quote>advisory</quote> locks can be taken on numbers that have
1691 user-defined meanings.
1692 </para>
1693
1694 <table>
1695 <title><structname>pg_locks</structname> Columns</title>
1696 <tgroup cols="1">
1697 <thead>
1698 <row>
1699 <entry role="catalog_table_entry"><para role="column_definition">
1700 Column Type
1701 </para>
1702 <para>
1703 Description
1704 </para></entry>
1705 </row>
1706 </thead>
1707
1708 <tbody>
1709 <row>
1710 <entry role="catalog_table_entry"><para role="column_definition">
1711 <structfield>locktype</structfield> <type>text</type>
1712 </para>
1713 <para>
1714 Type of the lockable object:
1715 <literal>relation</literal>,
1716 <literal>extend</literal>,
1717 <literal>frozenid</literal>,
1718 <literal>page</literal>,
1719 <literal>tuple</literal>,
1720 <literal>transactionid</literal>,
1721 <literal>virtualxid</literal>,
1722 <literal>spectoken</literal>,
1723 <literal>object</literal>,
1724 <literal>userlock</literal>,
1725 <literal>advisory</literal>, or
1726 <literal>applytransaction</literal>.
1727 (See also <xref linkend="wait-event-lock-table"/>.)
1728 </para></entry>
1729 </row>
1730
1731 <row>
1732 <entry role="catalog_table_entry"><para role="column_definition">
1733 <structfield>database</structfield> <type>oid</type>
1734 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
1735 </para>
1736 <para>
1737 OID of the database in which the lock target exists, or
1738 zero if the target is a shared object, or
1739 null if the target is a transaction ID
1740 </para></entry>
1741 </row>
1742
1743 <row>
1744 <entry role="catalog_table_entry"><para role="column_definition">
1745 <structfield>relation</structfield> <type>oid</type>
1746 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1747 </para>
1748 <para>
1749 OID of the relation targeted by the lock, or null if the target is not
1750 a relation or part of a relation
1751 </para></entry>
1752 </row>
1753
1754 <row>
1755 <entry role="catalog_table_entry"><para role="column_definition">
1756 <structfield>page</structfield> <type>int4</type>
1757 </para>
1758 <para>
1759 Page number targeted by the lock within the relation,
1760 or null if the target is not a relation page or tuple
1761 </para></entry>
1762 </row>
1763
1764 <row>
1765 <entry role="catalog_table_entry"><para role="column_definition">
1766 <structfield>tuple</structfield> <type>int2</type>
1767 </para>
1768 <para>
1769 Tuple number targeted by the lock within the page,
1770 or null if the target is not a tuple
1771 </para></entry>
1772 </row>
1773
1774 <row>
1775 <entry role="catalog_table_entry"><para role="column_definition">
1776 <structfield>virtualxid</structfield> <type>text</type>
1777 </para>
1778 <para>
1779 Virtual ID of the transaction targeted by the lock,
1780 or null if the target is not a virtual transaction ID; see
1781 <xref linkend="transactions"/>
1782 </para></entry>
1783 </row>
1784
1785 <row>
1786 <entry role="catalog_table_entry"><para role="column_definition">
1787 <structfield>transactionid</structfield> <type>xid</type>
1788 </para>
1789 <para>
1790 ID of the transaction targeted by the lock, or null if the target
1791 is not a transaction ID; <xref linkend="transactions"/>
1792 </para></entry>
1793 </row>
1794
1795 <row>
1796 <entry role="catalog_table_entry"><para role="column_definition">
1797 <structfield>classid</structfield> <type>oid</type>
1798 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1799 </para>
1800 <para>
1801 OID of the system catalog containing the lock target, or null if the
1802 target is not a general database object
1803 </para></entry>
1804 </row>
1805
1806 <row>
1807 <entry role="catalog_table_entry"><para role="column_definition">
1808 <structfield>objid</structfield> <type>oid</type>
1809 (references any OID column)
1810 </para>
1811 <para>
1812 OID of the lock target within its system catalog, or null if the
1813 target is not a general database object
1814 </para></entry>
1815 </row>
1816
1817 <row>
1818 <entry role="catalog_table_entry"><para role="column_definition">
1819 <structfield>objsubid</structfield> <type>int2</type>
1820 </para>
1821 <para>
1822 Column number targeted by the lock (the
1823 <structfield>classid</structfield> and <structfield>objid</structfield> refer to the
1824 table itself),
1825 or zero if the target is some other general database object,
1826 or null if the target is not a general database object
1827 </para></entry>
1828 </row>
1829
1830 <row>
1831 <entry role="catalog_table_entry"><para role="column_definition">
1832 <structfield>virtualtransaction</structfield> <type>text</type>
1833 </para>
1834 <para>
1835 Virtual ID of the transaction that is holding or awaiting this lock
1836 </para></entry>
1837 </row>
1838
1839 <row>
1840 <entry role="catalog_table_entry"><para role="column_definition">
1841 <structfield>pid</structfield> <type>int4</type>
1842 </para>
1843 <para>
1844 Process ID of the server process holding or awaiting this
1845 lock, or null if the lock is held by a prepared transaction
1846 </para></entry>
1847 </row>
1848
1849 <row>
1850 <entry role="catalog_table_entry"><para role="column_definition">
1851 <structfield>mode</structfield> <type>text</type>
1852 </para>
1853 <para>
1854 Name of the lock mode held or desired by this process (see <xref linkend="locking-tables"/> and <xref linkend="xact-serializable"/>)
1855 </para></entry>
1856 </row>
1857
1858 <row>
1859 <entry role="catalog_table_entry"><para role="column_definition">
1860 <structfield>granted</structfield> <type>bool</type>
1861 </para>
1862 <para>
1863 True if lock is held, false if lock is awaited
1864 </para></entry>
1865 </row>
1866
1867 <row>
1868 <entry role="catalog_table_entry"><para role="column_definition">
1869 <structfield>fastpath</structfield> <type>bool</type>
1870 </para>
1871 <para>
1872 True if lock was taken via fast path, false if taken via main
1873 lock table
1874 </para></entry>
1875 </row>
1876
1877 <row>
1878 <entry role="catalog_table_entry"><para role="column_definition">
1879 <structfield>waitstart</structfield> <type>timestamptz</type>
1880 </para>
1881 <para>
1882 Time when the server process started waiting for this lock,
1883 or null if the lock is held.
1884 Note that this can be null for a very short period of time after
1885 the wait started even though <structfield>granted</structfield>
1886 is <literal>false</literal>.
1887 </para></entry>
1888 </row>
1889 </tbody>
1890 </tgroup>
1891 </table>
1892
1893 <para>
1894 <structfield>granted</structfield> is true in a row representing a lock
1895 held by the indicated process. False indicates that this process is
1896 currently waiting to acquire this lock, which implies that at least one
1897 other process is holding or waiting for a conflicting lock mode on the same
1898 lockable object. The waiting process will sleep until the other lock is
1899 released (or a deadlock situation is detected). A single process can be
1900 waiting to acquire at most one lock at a time.
1901 </para>
1902
1903 <para>
1904 Throughout running a transaction, a server process holds an exclusive lock
1905 on the transaction's virtual transaction ID. If a permanent ID is assigned
1906 to the transaction (which normally happens only if the transaction changes
1907 the state of the database), it also holds an exclusive lock on the
1908 transaction's permanent transaction ID until it ends. When a process finds
1909 it necessary to wait specifically for another transaction to end, it does
1910 so by attempting to acquire share lock on the other transaction's ID
1911 (either virtual or permanent ID depending on the situation). That will
1912 succeed only when the other transaction terminates and releases its locks.
1913 </para>
1914
1915 <para>
1916 Although tuples are a lockable type of object,
1917 information about row-level locks is stored on disk, not in memory,
1918 and therefore row-level locks normally do not appear in this view.
1919 If a process is waiting for a
1920 row-level lock, it will usually appear in the view as waiting for the
1921 permanent transaction ID of the current holder of that row lock.
1922 </para>
1923
1924 <para>
1925 A speculative insertion lock consists of a transaction ID and a speculative
1926 insertion token. The speculative insertion token is displayed in the
1927 <structfield>objid</structfield> column.
1928 </para>
1929
1930 <para>
1931 Advisory locks can be acquired on keys consisting of either a single
1932 <type>bigint</type> value or two integer values.
1933 A <type>bigint</type> key is displayed with its
1934 high-order half in the <structfield>classid</structfield> column, its low-order half
1935 in the <structfield>objid</structfield> column, and <structfield>objsubid</structfield> equal
1936 to 1. The original <type>bigint</type> value can be reassembled with the
1937 expression <literal>(classid::bigint &lt;&lt; 32) |
1938 objid::bigint</literal>. Integer keys are displayed with the
1939 first key in the
1940 <structfield>classid</structfield> column, the second key in the <structfield>objid</structfield>
1941 column, and <structfield>objsubid</structfield> equal to 2. The actual meaning of
1942 the keys is up to the user. Advisory locks are local to each database,
1943 so the <structfield>database</structfield> column is meaningful for an advisory lock.
1944 </para>
1945
1946 <para>
1947 Apply transaction locks are used in parallel mode to apply the transaction
1948 in logical replication. The remote transaction ID is displayed in the
1949 <structfield>transactionid</structfield> column. The <structfield>objsubid</structfield>
1950 displays the lock subtype which is 0 for the lock used to synchronize the
1951 set of changes, and 1 for the lock used to wait for the transaction to
1952 finish to ensure commit order.
1953 </para>
1954
1955 <para>
1956 <structname>pg_locks</structname> provides a global view of all locks
1957 in the database cluster, not only those relevant to the current database.
1958 Although its <structfield>relation</structfield> column can be joined
1959 against <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield> to identify locked
1960 relations, this will only work correctly for relations in the current
1961 database (those for which the <structfield>database</structfield> column
1962 is either the current database's OID or zero).
1963 </para>
1964
1965 <para>
1966 The <structfield>pid</structfield> column can be joined to the
1967 <structfield>pid</structfield> column of the
1968 <link linkend="monitoring-pg-stat-activity-view">
1969 <structname>pg_stat_activity</structname></link>
1970 view to get more
1971 information on the session holding or awaiting each lock,
1972 for example
1973 <programlisting>
1974 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
1975 ON pl.pid = psa.pid;
1976 </programlisting>
1977 Also, if you are using prepared transactions, the
1978 <structfield>virtualtransaction</structfield> column can be joined to the
1979 <structfield>transaction</structfield> column of the <link
1980 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
1981 view to get more information on prepared transactions that hold locks.
1982 (A prepared transaction can never be waiting for a lock,
1983 but it continues to hold the locks it acquired while running.)
1984 For example:
1985 <programlisting>
1986 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
1987 ON pl.virtualtransaction = '-1/' || ppx.transaction;
1988 </programlisting>
1989 </para>
1990
1991 <para>
1992 While it is possible to obtain information about which processes block
1993 which other processes by joining <structname>pg_locks</structname> against
1994 itself, this is very difficult to get right in detail. Such a query would
1995 have to encode knowledge about which lock modes conflict with which
1996 others. Worse, the <structname>pg_locks</structname> view does not expose
1997 information about which processes are ahead of which others in lock wait
1998 queues, nor information about which processes are parallel workers running
1999 on behalf of which other client sessions. It is better to use
2000 the <function>pg_blocking_pids()</function> function
2001 (see <xref linkend="functions-info-session-table"/>) to identify which
2002 process(es) a waiting process is blocked behind.
2003 </para>
2004
2005 <para>
2006 The <structname>pg_locks</structname> view displays data from both the
2007 regular lock manager and the predicate lock manager, which are
2008 separate systems; in addition, the regular lock manager subdivides its
2009 locks into regular and <firstterm>fast-path</firstterm> locks.
2010 This data is not guaranteed to be entirely consistent.
2011 When the view is queried,
2012 data on fast-path locks (with <structfield>fastpath</structfield> = <literal>true</literal>)
2013 is gathered from each backend one at a time, without freezing the state of
2014 the entire lock manager, so it is possible for locks to be taken or
2015 released while information is gathered. Note, however, that these locks are
2016 known not to conflict with any other lock currently in place. After
2017 all backends have been queried for fast-path locks, the remainder of the
2018 regular lock manager is locked as a unit, and a consistent snapshot of all
2019 remaining locks is collected as an atomic action. After unlocking the
2020 regular lock manager, the predicate lock manager is similarly locked and all
2021 predicate locks are collected as an atomic action. Thus, with the exception
2022 of fast-path locks, each lock manager will deliver a consistent set of
2023 results, but as we do not lock both lock managers simultaneously, it is
2024 possible for locks to be taken or released after we interrogate the regular
2025 lock manager and before we interrogate the predicate lock manager.
2026 </para>
2027
2028 <para>
2029 Locking the regular and/or predicate lock manager could have some
2030 impact on database performance if this view is very frequently accessed.
2031 The locks are held only for the minimum amount of time necessary to
2032 obtain data from the lock managers, but this does not completely eliminate
2033 the possibility of a performance impact.
2034 </para>
2035
2036 </sect1>
2037
2038 <sect1 id="view-pg-matviews">
2039 <title><structname>pg_matviews</structname></title>
2040
2041 <indexterm zone="view-pg-matviews">
2042 <primary>pg_matviews</primary>
2043 </indexterm>
2044
2045 <indexterm zone="view-pg-matviews">
2046 <primary>materialized views</primary>
2047 </indexterm>
2048
2049 <para>
2050 The view <structname>pg_matviews</structname> provides access to
2051 useful information about each materialized view in the database.
2052 </para>
2053
2054 <table>
2055 <title><structname>pg_matviews</structname> Columns</title>
2056 <tgroup cols="1">
2057 <thead>
2058 <row>
2059 <entry role="catalog_table_entry"><para role="column_definition">
2060 Column Type
2061 </para>
2062 <para>
2063 Description
2064 </para></entry>
2065 </row>
2066 </thead>
2067
2068 <tbody>
2069 <row>
2070 <entry role="catalog_table_entry"><para role="column_definition">
2071 <structfield>schemaname</structfield> <type>name</type>
2072 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
2073 </para>
2074 <para>
2075 Name of schema containing materialized view
2076 </para></entry>
2077 </row>
2078
2079 <row>
2080 <entry role="catalog_table_entry"><para role="column_definition">
2081 <structfield>matviewname</structfield> <type>name</type>
2082 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
2083 </para>
2084 <para>
2085 Name of materialized view
2086 </para></entry>
2087 </row>
2088
2089 <row>
2090 <entry role="catalog_table_entry"><para role="column_definition">
2091 <structfield>matviewowner</structfield> <type>name</type>
2092 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
2093 </para>
2094 <para>
2095 Name of materialized view's owner
2096 </para></entry>
2097 </row>
2098
2099 <row>
2100 <entry role="catalog_table_entry"><para role="column_definition">
2101 <structfield>tablespace</structfield> <type>name</type>
2102 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
2103 </para>
2104 <para>
2105 Name of tablespace containing materialized view (null if default for database)
2106 </para></entry>
2107 </row>
2108
2109 <row>
2110 <entry role="catalog_table_entry"><para role="column_definition">
2111 <structfield>hasindexes</structfield> <type>bool</type>
2112 </para>
2113 <para>
2114 True if materialized view has (or recently had) any indexes
2115 </para></entry>
2116 </row>
2117
2118 <row>
2119 <entry role="catalog_table_entry"><para role="column_definition">
2120 <structfield>ispopulated</structfield> <type>bool</type>
2121 </para>
2122 <para>
2123 True if materialized view is currently populated
2124 </para></entry>
2125 </row>
2126
2127 <row>
2128 <entry role="catalog_table_entry"><para role="column_definition">
2129 <structfield>definition</structfield> <type>text</type>
2130 </para>
2131 <para>
2132 Materialized view definition (a reconstructed <xref linkend="sql-select"/> query)
2133 </para></entry>
2134 </row>
2135 </tbody>
2136 </tgroup>
2137 </table>
2138
2139 </sect1>
2140
2141 <sect1 id="view-pg-policies">
2142 <title><structname>pg_policies</structname></title>
2143
2144 <indexterm zone="view-pg-policies">
2145 <primary>pg_policies</primary>
2146 </indexterm>
2147
2148 <para>
2149 The view <structname>pg_policies</structname> provides access to
2150 useful information about each row-level security policy in the database.
2151 </para>
2152
2153 <table>
2154 <title><structname>pg_policies</structname> Columns</title>
2155 <tgroup cols="1">
2156 <thead>
2157 <row>
2158 <entry role="catalog_table_entry"><para role="column_definition">
2159 Column Type
2160 </para>
2161 <para>
2162 Description
2163 </para></entry>
2164 </row>
2165 </thead>
2166
2167 <tbody>
2168 <row>
2169 <entry role="catalog_table_entry"><para role="column_definition">
2170 <structfield>schemaname</structfield> <type>name</type>
2171 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
2172 </para>
2173 <para>
2174 Name of schema containing table policy is on
2175 </para></entry>
2176 </row>
2177
2178 <row>
2179 <entry role="catalog_table_entry"><para role="column_definition">
2180 <structfield>tablename</structfield> <type>name</type>
2181 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
2182 </para>
2183 <para>
2184 Name of table policy is on
2185 </para></entry>
2186 </row>
2187
2188 <row>
2189 <entry role="catalog_table_entry"><para role="column_definition">
2190 <structfield>policyname</structfield> <type>name</type>
2191 (references <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.<structfield>polname</structfield>)
2192 </para>
2193 <para>
2194 Name of policy
2195 </para></entry>
2196 </row>
2197
2198 <row>
2199 <entry role="catalog_table_entry"><para role="column_definition">
2200 <structfield>permissive</structfield> <type>text</type>
2201 </para>
2202 <para>
2203 Is the policy permissive or restrictive?
2204 </para></entry>
2205 </row>
2206
2207 <row>
2208 <entry role="catalog_table_entry"><para role="column_definition">
2209 <structfield>roles</structfield> <type>name[]</type>
2210 </para>
2211 <para>
2212 The roles to which this policy applies
2213 </para></entry>
2214 </row>
2215
2216 <row>
2217 <entry role="catalog_table_entry"><para role="column_definition">
2218 <structfield>cmd</structfield> <type>text</type>
2219 </para>
2220 <para>
2221 The command type to which the policy is applied
2222 </para></entry>
2223 </row>
2224
2225 <row>
2226 <entry role="catalog_table_entry"><para role="column_definition">
2227 <structfield>qual</structfield> <type>text</type>
2228 </para>
2229 <para>
2230 The expression added to the security barrier qualifications for
2231 queries that this policy applies to
2232 </para></entry>
2233 </row>
2234
2235 <row>
2236 <entry role="catalog_table_entry"><para role="column_definition">
2237 <structfield>with_check</structfield> <type>text</type>
2238 </para>
2239 <para>
2240 The expression added to the WITH CHECK qualifications for
2241 queries that attempt to add rows to this table
2242 </para></entry>
2243 </row>
2244 </tbody>
2245 </tgroup>
2246 </table>
2247
2248 </sect1>
2249
2250 <sect1 id="view-pg-prepared-statements">
2251 <title><structname>pg_prepared_statements</structname></title>
2252
2253 <indexterm zone="view-pg-prepared-statements">
2254 <primary>pg_prepared_statements</primary>
2255 </indexterm>
2256
2257 <para>
2258 The <structname>pg_prepared_statements</structname> view displays
2259 all the prepared statements that are available in the current
2260 session. See <xref linkend="sql-prepare"/> for more information about prepared
2261 statements.
2262 </para>
2263
2264 <para>
2265 <structname>pg_prepared_statements</structname> contains one row
2266 for each prepared statement. Rows are added to the view when a new
2267 prepared statement is created and removed when a prepared statement
2268 is released (for example, via the <link linkend="sql-deallocate"><command>DEALLOCATE</command></link> command).
2269 </para>
2270
2271 <table>
2272 <title><structname>pg_prepared_statements</structname> Columns</title>
2273 <tgroup cols="1">
2274 <thead>
2275 <row>
2276 <entry role="catalog_table_entry"><para role="column_definition">
2277 Column Type
2278 </para>
2279 <para>
2280 Description
2281 </para></entry>
2282 </row>
2283 </thead>
2284
2285 <tbody>
2286 <row>
2287 <entry role="catalog_table_entry"><para role="column_definition">
2288 <structfield>name</structfield> <type>text</type>
2289 </para>
2290 <para>
2291 The identifier of the prepared statement
2292 </para></entry>
2293 </row>
2294
2295 <row>
2296 <entry role="catalog_table_entry"><para role="column_definition">
2297 <structfield>statement</structfield> <type>text</type>
2298 </para>
2299 <para>
2300 The query string submitted by the client to create this
2301 prepared statement. For prepared statements created via SQL,
2302 this is the <command>PREPARE</command> statement submitted by
2303 the client. For prepared statements created via the
2304 frontend/backend protocol, this is the text of the prepared
2305 statement itself.
2306 </para></entry>
2307 </row>
2308
2309 <row>
2310 <entry role="catalog_table_entry"><para role="column_definition">
2311 <structfield>prepare_time</structfield> <type>timestamptz</type>
2312 </para>
2313 <para>
2314 The time at which the prepared statement was created
2315 </para></entry>
2316 </row>
2317
2318 <row>
2319 <entry role="catalog_table_entry"><para role="column_definition">
2320 <structfield>parameter_types</structfield> <type>regtype[]</type>
2321 </para>
2322 <para>
2323 The expected parameter types for the prepared statement in the
2324 form of an array of <type>regtype</type>. The OID corresponding
2325 to an element of this array can be obtained by casting the
2326 <type>regtype</type> value to <type>oid</type>.
2327 </para></entry>
2328 </row>
2329
2330 <row>
2331 <entry role="catalog_table_entry"><para role="column_definition">
2332 <structfield>result_types</structfield> <type>regtype[]</type>
2333 </para>
2334 <para>
2335 The types of the columns returned by the prepared statement in the
2336 form of an array of <type>regtype</type>. The OID corresponding
2337 to an element of this array can be obtained by casting the
2338 <type>regtype</type> value to <type>oid</type>.
2339 If the prepared statement does not provide a result (e.g., a DML
2340 statement), then this field will be null.
2341 </para></entry>
2342 </row>
2343
2344 <row>
2345 <entry role="catalog_table_entry"><para role="column_definition">
2346 <structfield>from_sql</structfield> <type>bool</type>
2347 </para>
2348 <para>
2349 <literal>true</literal> if the prepared statement was created
2350 via the <command>PREPARE</command> SQL command;
2351 <literal>false</literal> if the statement was prepared via the
2352 frontend/backend protocol
2353 </para></entry>
2354 </row>
2355
2356 <row>
2357 <entry role="catalog_table_entry"><para role="column_definition">
2358 <structfield>generic_plans</structfield> <type>int8</type>
2359 </para>
2360 <para>
2361 Number of times generic plan was chosen
2362 </para></entry>
2363 </row>
2364
2365 <row>
2366 <entry role="catalog_table_entry"><para role="column_definition">
2367 <structfield>custom_plans</structfield> <type>int8</type>
2368 </para>
2369 <para>
2370 Number of times custom plan was chosen
2371 </para></entry>
2372 </row>
2373 </tbody>
2374 </tgroup>
2375 </table>
2376
2377 <para>
2378 The <structname>pg_prepared_statements</structname> view is read-only.
2379 </para>
2380 </sect1>
2381
2382 <sect1 id="view-pg-prepared-xacts">
2383 <title><structname>pg_prepared_xacts</structname></title>
2384
2385 <indexterm zone="view-pg-prepared-xacts">
2386 <primary>pg_prepared_xacts</primary>
2387 </indexterm>
2388
2389 <para>
2390 The view <structname>pg_prepared_xacts</structname> displays
2391 information about transactions that are currently prepared for two-phase
2392 commit (see <xref linkend="sql-prepare-transaction"/> for details).
2393 </para>
2394
2395 <para>
2396 <structname>pg_prepared_xacts</structname> contains one row per prepared
2397 transaction. An entry is removed when the transaction is committed or
2398 rolled back.
2399 </para>
2400
2401 <table>
2402 <title><structname>pg_prepared_xacts</structname> Columns</title>
2403 <tgroup cols="1">
2404 <thead>
2405 <row>
2406 <entry role="catalog_table_entry"><para role="column_definition">
2407 Column Type
2408 </para>
2409 <para>
2410 Description
2411 </para></entry>
2412 </row>
2413 </thead>
2414
2415 <tbody>
2416 <row>
2417 <entry role="catalog_table_entry"><para role="column_definition">
2418 <structfield>transaction</structfield> <type>xid</type>
2419 </para>
2420 <para>
2421 Numeric transaction identifier of the prepared transaction
2422 </para></entry>
2423 </row>
2424
2425 <row>
2426 <entry role="catalog_table_entry"><para role="column_definition">
2427 <structfield>gid</structfield> <type>text</type>
2428 </para>
2429 <para>
2430 Global transaction identifier that was assigned to the transaction
2431 </para></entry>
2432 </row>
2433
2434 <row>
2435 <entry role="catalog_table_entry"><para role="column_definition">
2436 <structfield>prepared</structfield> <type>timestamptz</type>
2437 </para>
2438 <para>
2439 Time at which the transaction was prepared for commit
2440 </para></entry>
2441 </row>
2442
2443 <row>
2444 <entry role="catalog_table_entry"><para role="column_definition">
2445 <structfield>owner</structfield> <type>name</type>
2446 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
2447 </para>
2448 <para>
2449 Name of the user that executed the transaction
2450 </para></entry>
2451 </row>
2452
2453 <row>
2454 <entry role="catalog_table_entry"><para role="column_definition">
2455 <structfield>database</structfield> <type>name</type>
2456 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>datname</structfield>)
2457 </para>
2458 <para>
2459 Name of the database in which the transaction was executed
2460 </para></entry>
2461 </row>
2462 </tbody>
2463 </tgroup>
2464 </table>
2465
2466 <para>
2467 When the <structname>pg_prepared_xacts</structname> view is accessed, the
2468 internal transaction manager data structures are momentarily locked, and
2469 a copy is made for the view to display. This ensures that the
2470 view produces a consistent set of results, while not blocking
2471 normal operations longer than necessary. Nonetheless
2472 there could be some impact on database performance if this view is
2473 frequently accessed.
2474 </para>
2475
2476 </sect1>
2477
2478 <sect1 id="view-pg-publication-tables">
2479 <title><structname>pg_publication_tables</structname></title>
2480
2481 <indexterm zone="view-pg-publication-tables">
2482 <primary>pg_publication_tables</primary>
2483 </indexterm>
2484
2485 <para>
2486 The view <structname>pg_publication_tables</structname> provides
2487 information about the mapping between publications and information of
2488 tables they contain. Unlike the underlying catalog
2489 <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>,
2490 this view expands publications defined as
2491 <link linkend="sql-createpublication-params-for-all-tables"><literal>FOR ALL TABLES</literal></link>
2492 and <link linkend="sql-createpublication-params-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
2493 so for such publications there will be a row for each eligible table.
2494 </para>
2495
2496 <table>
2497 <title><structname>pg_publication_tables</structname> Columns</title>
2498 <tgroup cols="1">
2499 <thead>
2500 <row>
2501 <entry role="catalog_table_entry"><para role="column_definition">
2502 Column Type
2503 </para>
2504 <para>
2505 Description
2506 </para></entry>
2507 </row>
2508 </thead>
2509
2510 <tbody>
2511 <row>
2512 <entry role="catalog_table_entry"><para role="column_definition">
2513 <structfield>pubname</structfield> <type>name</type>
2514 (references <link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.<structfield>pubname</structfield>)
2515 </para>
2516 <para>
2517 Name of publication
2518 </para></entry>
2519 </row>
2520
2521 <row>
2522 <entry role="catalog_table_entry"><para role="column_definition">
2523 <structfield>schemaname</structfield> <type>name</type>
2524 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
2525 </para>
2526 <para>
2527 Name of schema containing table
2528 </para></entry>
2529 </row>
2530
2531 <row>
2532 <entry role="catalog_table_entry"><para role="column_definition">
2533 <structfield>tablename</structfield> <type>name</type>
2534 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
2535 </para>
2536 <para>
2537 Name of table
2538 </para></entry>
2539 </row>
2540
2541 <row>
2542 <entry role="catalog_table_entry"><para role="column_definition">
2543 <structfield>attnames</structfield> <type>name[]</type>
2544 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
2545 </para>
2546 <para>
2547 Names of table columns included in the publication. This contains all
2548 the columns of the table when the user didn't specify the column list
2549 for the table.
2550 </para></entry>
2551 </row>
2552
2553 <row>
2554 <entry role="catalog_table_entry"><para role="column_definition">
2555 <structfield>rowfilter</structfield> <type>text</type>
2556 </para>
2557 <para>
2558 Expression for the table's publication qualifying condition
2559 </para></entry>
2560 </row>
2561 </tbody>
2562 </tgroup>
2563 </table>
2564 </sect1>
2565
2566 <sect1 id="view-pg-replication-origin-status">
2567 <title><structname>pg_replication_origin_status</structname></title>
2568
2569 <indexterm zone="view-pg-replication-origin-status">
2570 <primary>pg_replication_origin_status</primary>
2571 </indexterm>
2572
2573 <para>
2574 The <structname>pg_replication_origin_status</structname> view
2575 contains information about how far replay for a certain origin has
2576 progressed. For more on replication origins
2577 see <xref linkend="replication-origins"/>.
2578 </para>
2579
2580 <table>
2581 <title><structname>pg_replication_origin_status</structname> Columns</title>
2582 <tgroup cols="1">
2583 <thead>
2584 <row>
2585 <entry role="catalog_table_entry"><para role="column_definition">
2586 Column Type
2587 </para>
2588 <para>
2589 Description
2590 </para></entry>
2591 </row>
2592 </thead>
2593
2594 <tbody>
2595 <row>
2596 <entry role="catalog_table_entry"><para role="column_definition">
2597 <structfield>local_id</structfield> <type>oid</type>
2598 (references <link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.<structfield>roident</structfield>)
2599 </para>
2600 <para>
2601 internal node identifier
2602 </para></entry>
2603 </row>
2604
2605 <row>
2606 <entry role="catalog_table_entry"><para role="column_definition">
2607 <structfield>external_id</structfield> <type>text</type>
2608 (references <link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.<structfield>roname</structfield>)
2609 </para>
2610 <para>
2611 external node identifier
2612 </para></entry>
2613 </row>
2614
2615 <row>
2616 <entry role="catalog_table_entry"><para role="column_definition">
2617 <structfield>remote_lsn</structfield> <type>pg_lsn</type>
2618 </para>
2619 <para>
2620 The origin node's LSN up to which data has been replicated.
2621 </para></entry>
2622 </row>
2623
2624 <row>
2625 <entry role="catalog_table_entry"><para role="column_definition">
2626 <structfield>local_lsn</structfield> <type>pg_lsn</type>
2627 </para>
2628 <para>
2629 This node's LSN at which <literal>remote_lsn</literal> has
2630 been replicated. Used to flush commit records before persisting
2631 data to disk when using asynchronous commits.
2632 </para></entry>
2633 </row>
2634 </tbody>
2635 </tgroup>
2636 </table>
2637 </sect1>
2638
2639 <sect1 id="view-pg-replication-slots">
2640 <title><structname>pg_replication_slots</structname></title>
2641
2642 <indexterm zone="view-pg-replication-slots">
2643 <primary>pg_replication_slots</primary>
2644 </indexterm>
2645
2646 <para>
2647 The <structname>pg_replication_slots</structname> view provides a listing
2648 of all replication slots that currently exist on the database cluster,
2649 along with their current state.
2650 </para>
2651
2652 <para>
2653 For more on replication slots,
2654 see <xref linkend="streaming-replication-slots"/> and <xref linkend="logicaldecoding"/>.
2655 </para>
2656
2657 <table>
2658 <title><structname>pg_replication_slots</structname> Columns</title>
2659 <tgroup cols="1">
2660 <thead>
2661 <row>
2662 <entry role="catalog_table_entry"><para role="column_definition">
2663 Column Type
2664 </para>
2665 <para>
2666 Description
2667 </para></entry>
2668 </row>
2669 </thead>
2670
2671 <tbody>
2672 <row>
2673 <entry role="catalog_table_entry"><para role="column_definition">
2674 <structfield>slot_name</structfield> <type>name</type>
2675 </para>
2676 <para>
2677 A unique, cluster-wide identifier for the replication slot
2678 </para></entry>
2679 </row>
2680
2681 <row>
2682 <entry role="catalog_table_entry"><para role="column_definition">
2683 <structfield>plugin</structfield> <type>name</type>
2684 </para>
2685 <para>
2686 The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.
2687 </para></entry>
2688 </row>
2689
2690 <row>
2691 <entry role="catalog_table_entry"><para role="column_definition">
2692 <structfield>slot_type</structfield> <type>text</type>
2693 </para>
2694 <para>
2695 The slot type: <literal>physical</literal> or <literal>logical</literal>
2696 </para></entry>
2697 </row>
2698
2699 <row>
2700 <entry role="catalog_table_entry"><para role="column_definition">
2701 <structfield>datoid</structfield> <type>oid</type>
2702 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
2703 </para>
2704 <para>
2705 The OID of the database this slot is associated with, or
2706 null. Only logical slots have an associated database.
2707 </para></entry>
2708 </row>
2709
2710 <row>
2711 <entry role="catalog_table_entry"><para role="column_definition">
2712 <structfield>database</structfield> <type>name</type>
2713 (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>datname</structfield>)
2714 </para>
2715 <para>
2716 The name of the database this slot is associated with, or
2717 null. Only logical slots have an associated database.
2718 </para></entry>
2719 </row>
2720
2721 <row>
2722 <entry role="catalog_table_entry"><para role="column_definition">
2723 <structfield>temporary</structfield> <type>bool</type>
2724 </para>
2725 <para>
2726 True if this is a temporary replication slot. Temporary slots are
2727 not saved to disk and are automatically dropped on error or when
2728 the session has finished.
2729 </para></entry>
2730 </row>
2731
2732 <row>
2733 <entry role="catalog_table_entry"><para role="column_definition">
2734 <structfield>active</structfield> <type>bool</type>
2735 </para>
2736 <para>
2737 True if this slot is currently being streamed
2738 </para></entry>
2739 </row>
2740
2741 <row>
2742 <entry role="catalog_table_entry"><para role="column_definition">
2743 <structfield>active_pid</structfield> <type>int4</type>
2744 </para>
2745 <para>
2746 The process ID of the session streaming data for this slot.
2747 <literal>NULL</literal> if inactive.
2748 </para></entry>
2749 </row>
2750
2751 <row>
2752 <entry role="catalog_table_entry"><para role="column_definition">
2753 <structfield>xmin</structfield> <type>xid</type>
2754 </para>
2755 <para>
2756 The oldest transaction that this slot needs the database to
2757 retain. <literal>VACUUM</literal> cannot remove tuples deleted
2758 by any later transaction.
2759 </para></entry>
2760 </row>
2761
2762 <row>
2763 <entry role="catalog_table_entry"><para role="column_definition">
2764 <structfield>catalog_xmin</structfield> <type>xid</type>
2765 </para>
2766 <para>
2767 The oldest transaction affecting the system catalogs that this
2768 slot needs the database to retain. <literal>VACUUM</literal> cannot
2769 remove catalog tuples deleted by any later transaction.
2770 </para></entry>
2771 </row>
2772
2773 <row>
2774 <entry role="catalog_table_entry"><para role="column_definition">
2775 <structfield>restart_lsn</structfield> <type>pg_lsn</type>
2776 </para>
2777 <para>
2778 The address (<literal>LSN</literal>) of oldest WAL which still
2779 might be required by the consumer of this slot and thus won't be
2780 automatically removed during checkpoints unless this LSN
2781 gets behind more than <xref linkend="guc-max-slot-wal-keep-size"/>
2782 from the current LSN. <literal>NULL</literal>
2783 if the <literal>LSN</literal> of this slot has never been reserved.
2784 </para></entry>
2785 </row>
2786
2787 <row>
2788 <entry role="catalog_table_entry"><para role="column_definition">
2789 <structfield>confirmed_flush_lsn</structfield> <type>pg_lsn</type>
2790 </para>
2791 <para>
2792 The address (<literal>LSN</literal>) up to which the logical
2793 slot's consumer has confirmed receiving data. Data corresponding to the
2794 transactions committed before this <literal>LSN</literal> is not
2795 available anymore. <literal>NULL</literal> for physical slots.
2796 </para></entry>
2797 </row>
2798
2799 <row>
2800 <entry role="catalog_table_entry"><para role="column_definition">
2801 <structfield>wal_status</structfield> <type>text</type>
2802 </para>
2803 <para>
2804 Availability of WAL files claimed by this slot.
2805 Possible values are:
2806 <itemizedlist>
2807 <listitem>
2808 <para><literal>reserved</literal> means that the claimed files
2809 are within <varname>max_wal_size</varname>.</para>
2810 </listitem>
2811 <listitem>
2812 <para><literal>extended</literal> means
2813 that <varname>max_wal_size</varname> is exceeded but the files are
2814 still retained, either by the replication slot or
2815 by <varname>wal_keep_size</varname>.
2816 </para>
2817 </listitem>
2818 <listitem>
2819 <para>
2820 <literal>unreserved</literal> means that the slot no longer
2821 retains the required WAL files and some of them are to be removed at
2822 the next checkpoint. This typically occurs when
2823 <xref linkend="guc-max-slot-wal-keep-size"/> is set to
2824 a non-negative value. This state can return
2825 to <literal>reserved</literal> or <literal>extended</literal>.
2826 </para>
2827 </listitem>
2828 <listitem>
2829 <para>
2830 <literal>lost</literal> means that this slot is no longer usable.
2831 </para>
2832 </listitem>
2833 </itemizedlist>
2834 </para></entry>
2835 </row>
2836
2837 <row>
2838 <entry role="catalog_table_entry"><para role="column_definition">
2839 <structfield>safe_wal_size</structfield> <type>int8</type>
2840 </para>
2841 <para>
2842 The number of bytes that can be written to WAL such that this slot
2843 is not in danger of getting in state "lost". It is NULL for lost
2844 slots, as well as if <varname>max_slot_wal_keep_size</varname>
2845 is <literal>-1</literal>.
2846 </para></entry>
2847 </row>
2848
2849 <row>
2850 <entry role="catalog_table_entry"><para role="column_definition">
2851 <structfield>two_phase</structfield> <type>bool</type>
2852 </para>
2853 <para>
2854 True if the slot is enabled for decoding prepared transactions. Always
2855 false for physical slots.
2856 </para></entry>
2857 </row>
2858
2859 <row>
2860 <entry role="catalog_table_entry"><para role="column_definition">
2861 <structfield>two_phase_at</structfield> <type>pg_lsn</type>
2862 </para>
2863 <para>
2864 The address (<literal>LSN</literal>) from which the decoding of prepared
2865 transactions is enabled. <literal>NULL</literal> for logical slots
2866 where <structfield>two_phase</structfield> is false and for physical slots.
2867 </para></entry>
2868 </row>
2869
2870 <row>
2871 <entry role="catalog_table_entry"><para role="column_definition">
2872 <structfield>inactive_since</structfield> <type>timestamptz</type>
2873 </para>
2874 <para>
2875 The time when the slot became inactive. <literal>NULL</literal> if the
2876 slot is currently being streamed. If the slot becomes invalid,
2877 this value will never be updated.
2878 For standby slots that are being synced from a
2879 primary server (whose <structfield>synced</structfield> field is
2880 <literal>true</literal>), the <structfield>inactive_since</structfield>
2881 indicates the time when slot synchronization (see <xref
2882 linkend="logicaldecoding-replication-slots-synchronization"/>)
2883 was most recently stopped. <literal>NULL</literal> if the slot
2884 has always been synchronized. This helps standby slots track when
2885 synchronization was interrupted.
2886 </para></entry>
2887 </row>
2888
2889 <row>
2890 <entry role="catalog_table_entry"><para role="column_definition">
2891 <structfield>conflicting</structfield> <type>bool</type>
2892 </para>
2893 <para>
2894 True if this logical slot conflicted with recovery (and so is now
2895 invalidated). When this column is true, check
2896 <structfield>invalidation_reason</structfield> column for the conflict
2897 reason. Always <literal>NULL</literal> for physical slots.
2898 </para></entry>
2899 </row>
2900
2901 <row>
2902 <entry role="catalog_table_entry"><para role="column_definition">
2903 <structfield>invalidation_reason</structfield> <type>text</type>
2904 </para>
2905 <para>
2906 The reason for the slot's invalidation. It is set for both logical and
2907 physical slots. <literal>NULL</literal> if the slot is not invalidated.
2908 Possible values are:
2909 <itemizedlist spacing="compact">
2910 <listitem>
2911 <para>
2912 <literal>wal_removed</literal> means that the required WAL has been
2913 removed.
2914 </para>
2915 </listitem>
2916 <listitem>
2917 <para>
2918 <literal>rows_removed</literal> means that the required rows have
2919 been removed. It is set only for logical slots.
2920 </para>
2921 </listitem>
2922 <listitem>
2923 <para>
2924 <literal>wal_level_insufficient</literal> means that the
2925 primary doesn't have a <xref linkend="guc-wal-level"/> sufficient to
2926 perform logical decoding. It is set only for logical slots.
2927 </para>
2928 </listitem>
2929 <listitem>
2930 <para>
2931 <literal>idle_timeout</literal> means that the slot has remained
2932 inactive longer than the configured
2933 <xref linkend="guc-idle-replication-slot-timeout"/> duration.
2934 </para>
2935 </listitem>
2936 </itemizedlist>
2937 </para></entry>
2938 </row>
2939
2940 <row>
2941 <entry role="catalog_table_entry"><para role="column_definition">
2942 <structfield>failover</structfield> <type>bool</type>
2943 </para>
2944 <para>
2945 True if this is a logical slot enabled to be synced to the standbys
2946 so that logical replication can be resumed from the new primary
2947 after failover. Always false for physical slots.
2948 </para></entry>
2949 </row>
2950
2951 <row>
2952 <entry role="catalog_table_entry"><para role="column_definition">
2953 <structfield>synced</structfield> <type>bool</type>
2954 </para>
2955 <para>
2956 True if this is a logical slot that was synced from a primary server.
2957 On a hot standby, the slots with the synced column marked as true can
2958 neither be used for logical decoding nor dropped manually. The value
2959 of this column has no meaning on the primary server; the column value on
2960 the primary is default false for all slots but may (if leftover from a
2961 promoted standby) also be true.
2962 </para></entry>
2963 </row>
2964
2965 </tbody>
2966 </tgroup>
2967 </table>
2968 </sect1>
2969
2970 <sect1 id="view-pg-roles">
2971 <title><structname>pg_roles</structname></title>
2972
2973 <indexterm zone="view-pg-roles">
2974 <primary>pg_roles</primary>
2975 </indexterm>
2976
2977 <para>
2978 The view <structname>pg_roles</structname> provides access to
2979 information about database roles. This is simply a publicly
2980 readable view of
2981 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
2982 that blanks out the password field.
2983 </para>
2984
2985 <table>
2986 <title><structname>pg_roles</structname> Columns</title>
2987 <tgroup cols="1">
2988 <thead>
2989 <row>
2990 <entry role="catalog_table_entry"><para role="column_definition">
2991 Column Type
2992 </para>
2993 <para>
2994 Description
2995 </para></entry>
2996 </row>
2997 </thead>
2998
2999 <tbody>
3000 <row>
3001 <entry role="catalog_table_entry"><para role="column_definition">
3002 <structfield>rolname</structfield> <type>name</type>
3003 </para>
3004 <para>
3005 Role name
3006 </para></entry>
3007 </row>
3008
3009 <row>
3010 <entry role="catalog_table_entry"><para role="column_definition">
3011 <structfield>rolsuper</structfield> <type>bool</type>
3012 </para>
3013 <para>
3014 Role has superuser privileges
3015 </para></entry>
3016 </row>
3017
3018 <row>
3019 <entry role="catalog_table_entry"><para role="column_definition">
3020 <structfield>rolinherit</structfield> <type>bool</type>
3021 </para>
3022 <para>
3023 Role automatically inherits privileges of roles it is a
3024 member of
3025 </para></entry>
3026 </row>
3027
3028 <row>
3029 <entry role="catalog_table_entry"><para role="column_definition">
3030 <structfield>rolcreaterole</structfield> <type>bool</type>
3031 </para>
3032 <para>
3033 Role can create more roles
3034 </para></entry>
3035 </row>
3036
3037 <row>
3038 <entry role="catalog_table_entry"><para role="column_definition">
3039 <structfield>rolcreatedb</structfield> <type>bool</type>
3040 </para>
3041 <para>
3042 Role can create databases
3043 </para></entry>
3044 </row>
3045
3046 <row>
3047 <entry role="catalog_table_entry"><para role="column_definition">
3048 <structfield>rolcanlogin</structfield> <type>bool</type>
3049 </para>
3050 <para>
3051 Role can log in. That is, this role can be given as the initial
3052 session authorization identifier
3053 </para></entry>
3054 </row>
3055
3056 <row>
3057 <entry role="catalog_table_entry"><para role="column_definition">
3058 <structfield>rolreplication</structfield> <type>bool</type>
3059 </para>
3060 <para>
3061 Role is a replication role. A replication role can initiate replication
3062 connections and create and drop replication slots.
3063 </para></entry>
3064 </row>
3065
3066 <row>
3067 <entry role="catalog_table_entry"><para role="column_definition">
3068 <structfield>rolconnlimit</structfield> <type>int4</type>
3069 </para>
3070 <para>
3071 For roles that can log in, this sets maximum number of concurrent
3072 connections this role can make. -1 means no limit.
3073 </para></entry>
3074 </row>
3075
3076 <row>
3077 <entry role="catalog_table_entry"><para role="column_definition">
3078 <structfield>rolpassword</structfield> <type>text</type>
3079 </para>
3080 <para>
3081 Not the password (always reads as <literal>********</literal>)
3082 </para></entry>
3083 </row>
3084
3085 <row>
3086 <entry role="catalog_table_entry"><para role="column_definition">
3087 <structfield>rolvaliduntil</structfield> <type>timestamptz</type>
3088 </para>
3089 <para>
3090 Password expiry time (only used for password authentication);
3091 null if no expiration
3092 </para></entry>
3093 </row>
3094
3095 <row>
3096 <entry role="catalog_table_entry"><para role="column_definition">
3097 <structfield>rolbypassrls</structfield> <type>bool</type>
3098 </para>
3099 <para>
3100 Role bypasses every row-level security policy, see
3101 <xref linkend="ddl-rowsecurity"/> for more information.
3102 </para></entry>
3103 </row>
3104
3105 <row>
3106 <entry role="catalog_table_entry"><para role="column_definition">
3107 <structfield>rolconfig</structfield> <type>text[]</type>
3108 </para>
3109 <para>
3110 Role-specific defaults for run-time configuration variables
3111 </para></entry>
3112 </row>
3113
3114 <row>
3115 <entry role="catalog_table_entry"><para role="column_definition">
3116 <structfield>oid</structfield> <type>oid</type>
3117 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3118 </para>
3119 <para>
3120 ID of role
3121 </para></entry>
3122 </row>
3123 </tbody>
3124 </tgroup>
3125 </table>
3126
3127 </sect1>
3128
3129 <sect1 id="view-pg-rules">
3130 <title><structname>pg_rules</structname></title>
3131
3132 <indexterm zone="view-pg-rules">
3133 <primary>pg_rules</primary>
3134 </indexterm>
3135
3136 <para>
3137 The view <structname>pg_rules</structname> provides access to
3138 useful information about query rewrite rules.
3139 </para>
3140
3141 <table>
3142 <title><structname>pg_rules</structname> Columns</title>
3143 <tgroup cols="1">
3144 <thead>
3145 <row>
3146 <entry role="catalog_table_entry"><para role="column_definition">
3147 Column Type
3148 </para>
3149 <para>
3150 Description
3151 </para></entry>
3152 </row>
3153 </thead>
3154
3155 <tbody>
3156 <row>
3157 <entry role="catalog_table_entry"><para role="column_definition">
3158 <structfield>schemaname</structfield> <type>name</type>
3159 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
3160 </para>
3161 <para>
3162 Name of schema containing table
3163 </para></entry>
3164 </row>
3165
3166 <row>
3167 <entry role="catalog_table_entry"><para role="column_definition">
3168 <structfield>tablename</structfield> <type>name</type>
3169 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
3170 </para>
3171 <para>
3172 Name of table the rule is for
3173 </para></entry>
3174 </row>
3175
3176 <row>
3177 <entry role="catalog_table_entry"><para role="column_definition">
3178 <structfield>rulename</structfield> <type>name</type>
3179 (references <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.<structfield>rulename</structfield>)
3180 </para>
3181 <para>
3182 Name of rule
3183 </para></entry>
3184 </row>
3185
3186 <row>
3187 <entry role="catalog_table_entry"><para role="column_definition">
3188 <structfield>definition</structfield> <type>text</type>
3189 </para>
3190 <para>
3191 Rule definition (a reconstructed creation command)
3192 </para></entry>
3193 </row>
3194 </tbody>
3195 </tgroup>
3196 </table>
3197
3198 <para>
3199 The <structname>pg_rules</structname> view excludes the <literal>ON SELECT</literal> rules
3200 of views and materialized views; those can be seen in
3201 <link linkend="view-pg-views"><structname>pg_views</structname></link> and <link linkend="view-pg-matviews"><structname>pg_matviews</structname></link>.
3202 </para>
3203
3204 </sect1>
3205
3206 <sect1 id="view-pg-seclabels">
3207 <title><structname>pg_seclabels</structname></title>
3208
3209 <indexterm zone="view-pg-seclabels">
3210 <primary>pg_seclabels</primary>
3211 </indexterm>
3212
3213 <para>
3214 The view <structname>pg_seclabels</structname> provides information about
3215 security labels. It as an easier-to-query version of the
3216 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link> catalog.
3217 </para>
3218
3219 <table>
3220 <title><structname>pg_seclabels</structname> Columns</title>
3221 <tgroup cols="1">
3222 <thead>
3223 <row>
3224 <entry role="catalog_table_entry"><para role="column_definition">
3225 Column Type
3226 </para>
3227 <para>
3228 Description
3229 </para></entry>
3230 </row>
3231 </thead>
3232
3233 <tbody>
3234 <row>
3235 <entry role="catalog_table_entry"><para role="column_definition">
3236 <structfield>objoid</structfield> <type>oid</type>
3237 (references any OID column)
3238 </para>
3239 <para>
3240 The OID of the object this security label pertains to
3241 </para></entry>
3242 </row>
3243
3244 <row>
3245 <entry role="catalog_table_entry"><para role="column_definition">
3246 <structfield>classoid</structfield> <type>oid</type>
3247 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3248 </para>
3249 <para>
3250 The OID of the system catalog this object appears in
3251 </para></entry>
3252 </row>
3253
3254 <row>
3255 <entry role="catalog_table_entry"><para role="column_definition">
3256 <structfield>objsubid</structfield> <type>int4</type>
3257 </para>
3258 <para>
3259 For a security label on a table column, this is the column number (the
3260 <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
3261 the table itself). For all other object types, this column is
3262 zero.
3263 </para></entry>
3264 </row>
3265
3266 <row>
3267 <entry role="catalog_table_entry"><para role="column_definition">
3268 <structfield>objtype</structfield> <type>text</type>
3269 </para>
3270 <para>
3271 The type of object to which this label applies, as text.
3272 </para></entry>
3273 </row>
3274
3275 <row>
3276 <entry role="catalog_table_entry"><para role="column_definition">
3277 <structfield>objnamespace</structfield> <type>oid</type>
3278 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
3279 </para>
3280 <para>
3281 The OID of the namespace for this object, if applicable;
3282 otherwise NULL.
3283 </para></entry>
3284 </row>
3285
3286 <row>
3287 <entry role="catalog_table_entry"><para role="column_definition">
3288 <structfield>objname</structfield> <type>text</type>
3289 </para>
3290 <para>
3291 The name of the object to which this label applies, as text.
3292 </para></entry>
3293 </row>
3294
3295 <row>
3296 <entry role="catalog_table_entry"><para role="column_definition">
3297 <structfield>provider</structfield> <type>text</type>
3298 (references <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.<structfield>provider</structfield>)
3299 </para>
3300 <para>
3301 The label provider associated with this label.
3302 </para></entry>
3303 </row>
3304
3305 <row>
3306 <entry role="catalog_table_entry"><para role="column_definition">
3307 <structfield>label</structfield> <type>text</type>
3308 (references <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.<structfield>label</structfield>)
3309 </para>
3310 <para>
3311 The security label applied to this object.
3312 </para></entry>
3313 </row>
3314 </tbody>
3315 </tgroup>
3316 </table>
3317 </sect1>
3318
3319 <sect1 id="view-pg-sequences">
3320 <title><structname>pg_sequences</structname></title>
3321
3322 <indexterm zone="view-pg-sequences">
3323 <primary>pg_sequences</primary>
3324 </indexterm>
3325
3326 <para>
3327 The view <structname>pg_sequences</structname> provides access to
3328 useful information about each sequence in the database.
3329 </para>
3330
3331 <table>
3332 <title><structname>pg_sequences</structname> Columns</title>
3333 <tgroup cols="1">
3334 <thead>
3335 <row>
3336 <entry role="catalog_table_entry"><para role="column_definition">
3337 Column Type
3338 </para>
3339 <para>
3340 Description
3341 </para></entry>
3342 </row>
3343 </thead>
3344
3345 <tbody>
3346 <row>
3347 <entry role="catalog_table_entry"><para role="column_definition">
3348 <structfield>schemaname</structfield> <type>name</type>
3349 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
3350 </para>
3351 <para>
3352 Name of schema containing sequence
3353 </para></entry>
3354 </row>
3355
3356 <row>
3357 <entry role="catalog_table_entry"><para role="column_definition">
3358 <structfield>sequencename</structfield> <type>name</type>
3359 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
3360 </para>
3361 <para>
3362 Name of sequence
3363 </para></entry>
3364 </row>
3365
3366 <row>
3367 <entry role="catalog_table_entry"><para role="column_definition">
3368 <structfield>sequenceowner</structfield> <type>name</type>
3369 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
3370 </para>
3371 <para>
3372 Name of sequence's owner
3373 </para></entry>
3374 </row>
3375
3376 <row>
3377 <entry role="catalog_table_entry"><para role="column_definition">
3378 <structfield>data_type</structfield> <type>regtype</type>
3379 (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
3380 </para>
3381 <para>
3382 Data type of the sequence
3383 </para></entry>
3384 </row>
3385
3386 <row>
3387 <entry role="catalog_table_entry"><para role="column_definition">
3388 <structfield>start_value</structfield> <type>int8</type>
3389 </para>
3390 <para>
3391 Start value of the sequence
3392 </para></entry>
3393 </row>
3394
3395 <row>
3396 <entry role="catalog_table_entry"><para role="column_definition">
3397 <structfield>min_value</structfield> <type>int8</type>
3398 </para>
3399 <para>
3400 Minimum value of the sequence
3401 </para></entry>
3402 </row>
3403
3404 <row>
3405 <entry role="catalog_table_entry"><para role="column_definition">
3406 <structfield>max_value</structfield> <type>int8</type>
3407 </para>
3408 <para>
3409 Maximum value of the sequence
3410 </para></entry>
3411 </row>
3412
3413 <row>
3414 <entry role="catalog_table_entry"><para role="column_definition">
3415 <structfield>increment_by</structfield> <type>int8</type>
3416 </para>
3417 <para>
3418 Increment value of the sequence
3419 </para></entry>
3420 </row>
3421
3422 <row>
3423 <entry role="catalog_table_entry"><para role="column_definition">
3424 <structfield>cycle</structfield> <type>bool</type>
3425 </para>
3426 <para>
3427 Whether the sequence cycles
3428 </para></entry>
3429 </row>
3430
3431 <row>
3432 <entry role="catalog_table_entry"><para role="column_definition">
3433 <structfield>cache_size</structfield> <type>int8</type>
3434 </para>
3435 <para>
3436 Cache size of the sequence
3437 </para></entry>
3438 </row>
3439
3440 <row>
3441 <entry role="catalog_table_entry"><para role="column_definition">
3442 <structfield>last_value</structfield> <type>int8</type>
3443 </para>
3444 <para>
3445 The last sequence value written to disk. If caching is used,
3446 this value can be greater than the last value handed out from the
3447 sequence.
3448 </para></entry>
3449 </row>
3450 </tbody>
3451 </tgroup>
3452 </table>
3453
3454 <para>
3455 The <structfield>last_value</structfield> column will read as null if any of
3456 the following are true:
3457 <itemizedlist>
3458 <listitem>
3459 <para>
3460 The sequence has not been read from yet.
3461 </para>
3462 </listitem>
3463 <listitem>
3464 <para>
3465 The current user does not have <literal>USAGE</literal> or
3466 <literal>SELECT</literal> privilege on the sequence.
3467 </para>
3468 </listitem>
3469 <listitem>
3470 <para>
3471 The sequence is unlogged and the server is a standby.
3472 </para>
3473 </listitem>
3474 </itemizedlist>
3475 </para>
3476
3477 </sect1>
3478
3479 <sect1 id="view-pg-settings">
3480 <title><structname>pg_settings</structname></title>
3481
3482 <indexterm zone="view-pg-settings">
3483 <primary>pg_settings</primary>
3484 </indexterm>
3485
3486 <para>
3487 The view <structname>pg_settings</structname> provides access to
3488 run-time parameters of the server. It is essentially an alternative
3489 interface to the <link linkend="sql-show"><command>SHOW</command></link>
3490 and <link linkend="sql-set"><command>SET</command></link> commands.
3491 It also provides access to some facts about each parameter that are
3492 not directly available from <link linkend="sql-show"><command>SHOW</command></link>, such as minimum and
3493 maximum values.
3494 </para>
3495
3496 <table>
3497 <title><structname>pg_settings</structname> Columns</title>
3498 <tgroup cols="1">
3499 <thead>
3500 <row>
3501 <entry role="catalog_table_entry"><para role="column_definition">
3502 Column Type
3503 </para>
3504 <para>
3505 Description
3506 </para></entry>
3507 </row>
3508 </thead>
3509
3510 <tbody>
3511 <row>
3512 <entry role="catalog_table_entry"><para role="column_definition">
3513 <structfield>name</structfield> <type>text</type>
3514 </para>
3515 <para>
3516 Run-time configuration parameter name
3517 </para></entry>
3518 </row>
3519
3520 <row>
3521 <entry role="catalog_table_entry"><para role="column_definition">
3522 <structfield>setting</structfield> <type>text</type>
3523 </para>
3524 <para>
3525 Current value of the parameter
3526 </para></entry>
3527 </row>
3528
3529 <row>
3530 <entry role="catalog_table_entry"><para role="column_definition">
3531 <structfield>unit</structfield> <type>text</type>
3532 </para>
3533 <para>
3534 Implicit unit of the parameter
3535 </para></entry>
3536 </row>
3537
3538 <row>
3539 <entry role="catalog_table_entry"><para role="column_definition">
3540 <structfield>category</structfield> <type>text</type>
3541 </para>
3542 <para>
3543 Logical group of the parameter
3544 </para></entry>
3545 </row>
3546
3547 <row>
3548 <entry role="catalog_table_entry"><para role="column_definition">
3549 <structfield>short_desc</structfield> <type>text</type>
3550 </para>
3551 <para>
3552 A brief description of the parameter
3553 </para></entry>
3554 </row>
3555
3556 <row>
3557 <entry role="catalog_table_entry"><para role="column_definition">
3558 <structfield>extra_desc</structfield> <type>text</type>
3559 </para>
3560 <para>
3561 Additional, more detailed, description of the parameter
3562 </para></entry>
3563 </row>
3564
3565 <row>
3566 <entry role="catalog_table_entry"><para role="column_definition">
3567 <structfield>context</structfield> <type>text</type>
3568 </para>
3569 <para>
3570 Context required to set the parameter's value (see below)
3571 </para></entry>
3572 </row>
3573
3574 <row>
3575 <entry role="catalog_table_entry"><para role="column_definition">
3576 <structfield>vartype</structfield> <type>text</type>
3577 </para>
3578 <para>
3579 Parameter type (<literal>bool</literal>, <literal>enum</literal>,
3580 <literal>integer</literal>, <literal>real</literal>, or <literal>string</literal>)
3581 </para></entry>
3582 </row>
3583
3584 <row>
3585 <entry role="catalog_table_entry"><para role="column_definition">
3586 <structfield>source</structfield> <type>text</type>
3587 </para>
3588 <para>
3589 Source of the current parameter value
3590 </para></entry>
3591 </row>
3592
3593 <row>
3594 <entry role="catalog_table_entry"><para role="column_definition">
3595 <structfield>min_val</structfield> <type>text</type>
3596 </para>
3597 <para>
3598 Minimum allowed value of the parameter (null for non-numeric
3599 values)
3600 </para></entry>
3601 </row>
3602
3603 <row>
3604 <entry role="catalog_table_entry"><para role="column_definition">
3605 <structfield>max_val</structfield> <type>text</type>
3606 </para>
3607 <para>
3608 Maximum allowed value of the parameter (null for non-numeric
3609 values)
3610 </para></entry>
3611 </row>
3612
3613 <row>
3614 <entry role="catalog_table_entry"><para role="column_definition">
3615 <structfield>enumvals</structfield> <type>text[]</type>
3616 </para>
3617 <para>
3618 Allowed values of an enum parameter (null for non-enum
3619 values)
3620 </para></entry>
3621 </row>
3622
3623 <row>
3624 <entry role="catalog_table_entry"><para role="column_definition">
3625 <structfield>boot_val</structfield> <type>text</type>
3626 </para>
3627 <para>
3628 Parameter value assumed at server startup if the parameter is
3629 not otherwise set
3630 </para></entry>
3631 </row>
3632
3633 <row>
3634 <entry role="catalog_table_entry"><para role="column_definition">
3635 <structfield>reset_val</structfield> <type>text</type>
3636 </para>
3637 <para>
3638 Value that <link linkend="sql-reset"><command>RESET</command></link> would reset the parameter to
3639 in the current session
3640 </para></entry>
3641 </row>
3642
3643 <row>
3644 <entry role="catalog_table_entry"><para role="column_definition">
3645 <structfield>sourcefile</structfield> <type>text</type>
3646 </para>
3647 <para>
3648 Configuration file the current value was set in (null for
3649 values set from sources other than configuration files, or when
3650 examined by a user who neither is a superuser nor has privileges of
3651 <literal>pg_read_all_settings</literal>); helpful when using
3652 <literal>include</literal> directives in configuration files
3653 </para></entry>
3654 </row>
3655
3656 <row>
3657 <entry role="catalog_table_entry"><para role="column_definition">
3658 <structfield>sourceline</structfield> <type>int4</type>
3659 </para>
3660 <para>
3661 Line number within the configuration file the current value was
3662 set at (null for values set from sources other than configuration files,
3663 or when examined by a user who neither is a superuser nor has privileges of
3664 <literal>pg_read_all_settings</literal>).
3665 </para></entry>
3666 </row>
3667
3668 <row>
3669 <entry role="catalog_table_entry"><para role="column_definition">
3670 <structfield>pending_restart</structfield> <type>bool</type>
3671 </para>
3672 <para>
3673 <literal>true</literal> if the value has been changed in the
3674 configuration file but needs a restart; or <literal>false</literal>
3675 otherwise.
3676 </para></entry>
3677 </row>
3678 </tbody>
3679 </tgroup>
3680 </table>
3681
3682 <para>
3683 There are several possible values of <structfield>context</structfield>.
3684 In order of decreasing difficulty of changing the setting, they are:
3685 </para>
3686
3687 <variablelist>
3688 <varlistentry>
3689 <!-- PGC_INTERNAL -->
3690 <term><literal>internal</literal></term>
3691 <listitem>
3692 <para>
3693 These settings cannot be changed directly; they reflect internally
3694 determined values. Some of them may be adjustable by rebuilding the
3695 server with different configuration options, or by changing options
3696 supplied to <application>initdb</application>.
3697 </para>
3698 </listitem>
3699 </varlistentry>
3700 <varlistentry>
3701 <!-- PGC_POSTMASTER -->
3702 <term><literal>postmaster</literal></term>
3703 <listitem>
3704 <para>
3705 These settings can only be applied when the server starts, so any change
3706 requires restarting the server. Values for these settings are typically
3707 stored in the <filename>postgresql.conf</filename> file, or passed on
3708 the command line when starting the server. Of course, settings with any
3709 of the lower <structfield>context</structfield> types can also be
3710 set at server start time.
3711 </para>
3712 </listitem>
3713 </varlistentry>
3714 <varlistentry>
3715 <!-- PGC_SIGHUP -->
3716 <term><literal>sighup</literal></term>
3717 <listitem>
3718 <para>
3719 Changes to these settings can be made in
3720 <filename>postgresql.conf</filename> without restarting the server.
3721 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
3722 cause it to re-read <filename>postgresql.conf</filename> and apply
3723 the changes. The postmaster will also forward the
3724 <systemitem>SIGHUP</systemitem> signal to its child processes so that
3725 they all pick up the new value.
3726 </para>
3727 </listitem>
3728 </varlistentry>
3729 <varlistentry>
3730 <!-- PGC_SU_BACKEND -->
3731 <term><literal>superuser-backend</literal></term>
3732 <listitem>
3733 <para>
3734 Changes to these settings can be made in
3735 <filename>postgresql.conf</filename> without restarting the server.
3736 They can also be set for a particular session in the connection request
3737 packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
3738 environment variable), but only if the connecting user is a superuser
3739 or has been granted the appropriate <literal>SET</literal> privilege.
3740 However, these settings never change in a session after it is started.
3741 If you change them in <filename>postgresql.conf</filename>, send a
3742 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
3743 re-read <filename>postgresql.conf</filename>. The new values will only
3744 affect subsequently-launched sessions.
3745 </para>
3746 </listitem>
3747 </varlistentry>
3748 <varlistentry>
3749 <!-- PGC_BACKEND -->
3750 <term><literal>backend</literal></term>
3751 <listitem>
3752 <para>
3753 Changes to these settings can be made in
3754 <filename>postgresql.conf</filename> without restarting the server.
3755 They can also be set for a particular session in the connection request
3756 packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
3757 environment variable); any user can make such a change for their session.
3758 However, these settings never change in a session after it is started.
3759 If you change them in <filename>postgresql.conf</filename>, send a
3760 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
3761 re-read <filename>postgresql.conf</filename>. The new values will only
3762 affect subsequently-launched sessions.
3763 </para>
3764 </listitem>
3765 </varlistentry>
3766 <varlistentry>
3767 <!-- PGC_SUSET -->
3768 <term><literal>superuser</literal></term>
3769 <listitem>
3770 <para>
3771 These settings can be set from <filename>postgresql.conf</filename>,
3772 or within a session via the <command>SET</command> command; but only superusers
3773 and users with the appropriate <literal>SET</literal> privilege
3774 can change them via <command>SET</command>. Changes in
3775 <filename>postgresql.conf</filename> will affect existing sessions
3776 only if no session-local value has been established with <command>SET</command>.
3777 </para>
3778 </listitem>
3779 </varlistentry>
3780 <varlistentry>
3781 <!-- PGC_USERSET -->
3782 <term><literal>user</literal></term>
3783 <listitem>
3784 <para>
3785 These settings can be set from <filename>postgresql.conf</filename>,
3786 or within a session via the <command>SET</command> command. Any user is
3787 allowed to change their session-local value. Changes in
3788 <filename>postgresql.conf</filename> will affect existing sessions
3789 only if no session-local value has been established with <command>SET</command>.
3790 </para>
3791 </listitem>
3792 </varlistentry>
3793 </variablelist>
3794
3795 <para>
3796 See <xref linkend="config-setting"/> for more information about the various
3797 ways to change these parameters.
3798 </para>
3799
3800 <para>
3801 This view cannot be inserted into or deleted from, but it can be updated. An
3802 <command>UPDATE</command> applied to a row of <structname>pg_settings</structname>
3803 is equivalent to executing the <command>SET</command> command on that named
3804 parameter. The change only affects the value used by the current
3805 session. If an <command>UPDATE</command> is issued within a transaction
3806 that is later aborted, the effects of the <command>UPDATE</command> command
3807 disappear when the transaction is rolled back. Once the surrounding
3808 transaction is committed, the effects will persist until the end of the
3809 session, unless overridden by another <command>UPDATE</command> or
3810 <command>SET</command>.
3811 </para>
3812
3813 <para>
3814 This view does not
3815 display <link linkend="runtime-config-custom">customized options</link>
3816 unless the extension module that defines them has been loaded by the
3817 backend process executing the query (e.g., via a mention in
3818 <xref linkend="guc-shared-preload-libraries"/>,
3819 a call to a C function in the extension, or the
3820 <link linkend="sql-load"><command>LOAD</command></link> command).
3821 For example, since <link linkend="archive-modules">archive modules</link>
3822 are normally loaded only by the archiver process not regular sessions,
3823 this view will not display any customized options defined by such modules
3824 unless special action is taken to load them into the backend process
3825 executing the query.
3826 </para>
3827
3828 </sect1>
3829
3830 <sect1 id="view-pg-shadow">
3831 <title><structname>pg_shadow</structname></title>
3832
3833 <indexterm zone="view-pg-shadow">
3834 <primary>pg_shadow</primary>
3835 </indexterm>
3836
3837 <para>
3838 The view <structname>pg_shadow</structname> exists for backwards
3839 compatibility: it emulates a catalog that existed in
3840 <productname>PostgreSQL</productname> before version 8.1.
3841 It shows properties of all roles that are marked as
3842 <structfield>rolcanlogin</structfield> in
3843 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
3844 </para>
3845
3846 <para>
3847 The name stems from the fact that this table
3848 should not be readable by the public since it contains passwords.
3849 <link linkend="view-pg-user"><structname>pg_user</structname></link>
3850 is a publicly readable view on
3851 <structname>pg_shadow</structname> that blanks out the password field.
3852 </para>
3853
3854 <table>
3855 <title><structname>pg_shadow</structname> Columns</title>
3856 <tgroup cols="1">
3857 <thead>
3858 <row>
3859 <entry role="catalog_table_entry"><para role="column_definition">
3860 Column Type
3861 </para>
3862 <para>
3863 Description
3864 </para></entry>
3865 </row>
3866 </thead>
3867
3868 <tbody>
3869 <row>
3870 <entry role="catalog_table_entry"><para role="column_definition">
3871 <structfield>usename</structfield> <type>name</type>
3872 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
3873 </para>
3874 <para>
3875 User name
3876 </para></entry>
3877 </row>
3878
3879 <row>
3880 <entry role="catalog_table_entry"><para role="column_definition">
3881 <structfield>usesysid</structfield> <type>oid</type>
3882 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3883 </para>
3884 <para>
3885 ID of this user
3886 </para></entry>
3887 </row>
3888
3889 <row>
3890 <entry role="catalog_table_entry"><para role="column_definition">
3891 <structfield>usecreatedb</structfield> <type>bool</type>
3892 </para>
3893 <para>
3894 User can create databases
3895 </para></entry>
3896 </row>
3897
3898 <row>
3899 <entry role="catalog_table_entry"><para role="column_definition">
3900 <structfield>usesuper</structfield> <type>bool</type>
3901 </para>
3902 <para>
3903 User is a superuser
3904 </para></entry>
3905 </row>
3906
3907 <row>
3908 <entry role="catalog_table_entry"><para role="column_definition">
3909 <structfield>userepl</structfield> <type>bool</type>
3910 </para>
3911 <para>
3912 User can initiate streaming replication and put the system in and
3913 out of backup mode.
3914 </para></entry>
3915 </row>
3916
3917 <row>
3918 <entry role="catalog_table_entry"><para role="column_definition">
3919 <structfield>usebypassrls</structfield> <type>bool</type>
3920 </para>
3921 <para>
3922 User bypasses every row-level security policy, see
3923 <xref linkend="ddl-rowsecurity"/> for more information.
3924 </para></entry>
3925 </row>
3926
3927 <row>
3928 <entry role="catalog_table_entry"><para role="column_definition">
3929 <structfield>passwd</structfield> <type>text</type>
3930 </para>
3931 <para>
3932 Encrypted password; null if none. See
3933 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
3934 for details of how encrypted passwords are stored.
3935 </para></entry>
3936 </row>
3937
3938 <row>
3939 <entry role="catalog_table_entry"><para role="column_definition">
3940 <structfield>valuntil</structfield> <type>timestamptz</type>
3941 </para>
3942 <para>
3943 Password expiry time (only used for password authentication)
3944 </para></entry>
3945 </row>
3946
3947 <row>
3948 <entry role="catalog_table_entry"><para role="column_definition">
3949 <structfield>useconfig</structfield> <type>text[]</type>
3950 </para>
3951 <para>
3952 Session defaults for run-time configuration variables
3953 </para></entry>
3954 </row>
3955 </tbody>
3956 </tgroup>
3957 </table>
3958
3959 </sect1>
3960
3961 <sect1 id="view-pg-shmem-allocations">
3962 <title><structname>pg_shmem_allocations</structname></title>
3963
3964 <indexterm zone="view-pg-shmem-allocations">
3965 <primary>pg_shmem_allocations</primary>
3966 </indexterm>
3967
3968 <para>
3969 The <structname>pg_shmem_allocations</structname> view shows allocations
3970 made from the server's main shared memory segment. This includes both
3971 memory allocated by <productname>PostgreSQL</productname> itself and memory
3972 allocated by extensions using the mechanisms detailed in
3973 <xref linkend="xfunc-shared-addin" />.
3974 </para>
3975
3976 <para>
3977 Note that this view does not include memory allocated using the dynamic
3978 shared memory infrastructure.
3979 </para>
3980
3981 <table>
3982 <title><structname>pg_shmem_allocations</structname> Columns</title>
3983 <tgroup cols="1">
3984 <thead>
3985 <row>
3986 <entry role="catalog_table_entry"><para role="column_definition">
3987 Column Type
3988 </para>
3989 <para>
3990 Description
3991 </para></entry>
3992 </row>
3993 </thead>
3994
3995 <tbody>
3996 <row>
3997 <entry role="catalog_table_entry"><para role="column_definition">
3998 <structfield>name</structfield> <type>text</type>
3999 </para>
4000 <para>
4001 The name of the shared memory allocation. NULL for unused memory
4002 and <literal>&lt;anonymous&gt;</literal> for anonymous
4003 allocations.
4004 </para></entry>
4005 </row>
4006
4007 <row>
4008 <entry role="catalog_table_entry"><para role="column_definition">
4009 <structfield>off</structfield> <type>int8</type>
4010 </para>
4011 <para>
4012 The offset at which the allocation starts. NULL for anonymous
4013 allocations, since details related to them are not known.
4014 </para></entry>
4015 </row>
4016
4017 <row>
4018 <entry role="catalog_table_entry"><para role="column_definition">
4019 <structfield>size</structfield> <type>int8</type>
4020 </para>
4021 <para>
4022 Size of the allocation in bytes
4023 </para></entry>
4024 </row>
4025
4026 <row>
4027 <entry role="catalog_table_entry"><para role="column_definition">
4028 <structfield>allocated_size</structfield> <type>int8</type>
4029 </para>
4030 <para>
4031 Size of the allocation in bytes including padding. For anonymous
4032 allocations, no information about padding is available, so the
4033 <literal>size</literal> and <literal>allocated_size</literal> columns
4034 will always be equal. Padding is not meaningful for free memory, so
4035 the columns will be equal in that case also.
4036 </para></entry>
4037 </row>
4038 </tbody>
4039 </tgroup>
4040 </table>
4041
4042 <para>
4043 Anonymous allocations are allocations that have been made
4044 with <literal>ShmemAlloc()</literal> directly, rather than via
4045 <literal>ShmemInitStruct()</literal> or
4046 <literal>ShmemInitHash()</literal>.
4047 </para>
4048
4049 <para>
4050 By default, the <structname>pg_shmem_allocations</structname> view can be
4051 read only by superusers or roles with privileges of the
4052 <literal>pg_read_all_stats</literal> role.
4053 </para>
4054 </sect1>
4055
4056 <sect1 id="view-pg-shmem-allocations-numa">
4057 <title><structname>pg_shmem_allocations_numa</structname></title>
4058
4059 <indexterm zone="view-pg-shmem-allocations-numa">
4060 <primary>pg_shmem_allocations_numa</primary>
4061 </indexterm>
4062
4063 <para>
4064 The <structname>pg_shmem_allocations_numa</structname> shows how shared
4065 memory allocations in the server's main shared memory segment are distributed
4066 across NUMA nodes. This includes both memory allocated by
4067 <productname>PostgreSQL</productname> itself and memory allocated
4068 by extensions using the mechanisms detailed in
4069 <xref linkend="xfunc-shared-addin" />. This view will output multiple rows
4070 for each of the shared memory segments provided that they are spread across
4071 multiple NUMA nodes. This view should not be queried by monitoring systems
4072 as it is very slow and may end up allocating shared memory in case it was not
4073 used earlier.
4074 Current limitation for this view is that won't show anonymous shared memory
4075 allocations.
4076 </para>
4077
4078 <para>
4079 Note that this view does not include memory allocated using the dynamic
4080 shared memory infrastructure.
4081 </para>
4082
4083 <warning>
4084 <para>
4085 When determining the <acronym>NUMA</acronym> node, the view touches
4086 all memory pages for the shared memory segment. This will force
4087 allocation of the shared memory, if it wasn't allocated already,
4088 and the memory may get allocated in a single <acronym>NUMA</acronym>
4089 node (depending on system configuration).
4090 </para>
4091 </warning>
4092
4093 <table>
4094 <title><structname>pg_shmem_allocations_numa</structname> Columns</title>
4095 <tgroup cols="1">
4096 <thead>
4097 <row>
4098 <entry role="catalog_table_entry"><para role="column_definition">
4099 Column Type
4100 </para>
4101 <para>
4102 Description
4103 </para></entry>
4104 </row>
4105 </thead>
4106
4107 <tbody>
4108 <row>
4109 <entry role="catalog_table_entry"><para role="column_definition">
4110 <structfield>name</structfield> <type>text</type>
4111 </para>
4112 <para>
4113 The name of the shared memory allocation.
4114 </para></entry>
4115 </row>
4116
4117 <row>
4118 <entry role="catalog_table_entry"><para role="column_definition">
4119 <structfield>numa_node</structfield> <type>int4</type>
4120 </para>
4121 <para>
4122 ID of <acronym>NUMA</acronym> node
4123 </para></entry>
4124 </row>
4125
4126 <row>
4127 <entry role="catalog_table_entry"><para role="column_definition">
4128 <structfield>size</structfield> <type>int8</type>
4129 </para>
4130 <para>
4131 Size of the allocation on this particular NUMA memory node in bytes
4132 </para></entry>
4133 </row>
4134
4135 </tbody>
4136 </tgroup>
4137 </table>
4138
4139 <para>
4140 By default, the <structname>pg_shmem_allocations_numa</structname> view can be
4141 read only by superusers or roles with privileges of the
4142 <literal>pg_read_all_stats</literal> role.
4143 </para>
4144 </sect1>
4145
4146 <sect1 id="view-pg-stats">
4147 <title><structname>pg_stats</structname></title>
4148
4149 <indexterm zone="view-pg-stats">
4150 <primary>pg_stats</primary>
4151 </indexterm>
4152
4153 <para>
4154 The view <structname>pg_stats</structname> provides access to
4155 the information stored in the <link
4156 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
4157 catalog. This view allows access only to rows of
4158 <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> that correspond to tables the
4159 user has permission to read, and therefore it is safe to allow public
4160 read access to this view.
4161 </para>
4162
4163 <para>
4164 <structname>pg_stats</structname> is also designed to present the
4165 information in a more readable format than the underlying catalog
4166 &mdash; at the cost that its schema must be extended whenever new slot types
4167 are defined for <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>.
4168 </para>
4169
4170 <table>
4171 <title><structname>pg_stats</structname> Columns</title>
4172 <tgroup cols="1">
4173 <thead>
4174 <row>
4175 <entry role="catalog_table_entry"><para role="column_definition">
4176 Column Type
4177 </para>
4178 <para>
4179 Description
4180 </para></entry>
4181 </row>
4182 </thead>
4183
4184 <tbody>
4185 <row>
4186 <entry role="catalog_table_entry"><para role="column_definition">
4187 <structfield>schemaname</structfield> <type>name</type>
4188 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
4189 </para>
4190 <para>
4191 Name of schema containing table
4192 </para></entry>
4193 </row>
4194
4195 <row>
4196 <entry role="catalog_table_entry"><para role="column_definition">
4197 <structfield>tablename</structfield> <type>name</type>
4198 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
4199 </para>
4200 <para>
4201 Name of table
4202 </para></entry>
4203 </row>
4204
4205 <row>
4206 <entry role="catalog_table_entry"><para role="column_definition">
4207 <structfield>attname</structfield> <type>name</type>
4208 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
4209 </para>
4210 <para>
4211 Name of column described by this row
4212 </para></entry>
4213 </row>
4214
4215 <row>
4216 <entry role="catalog_table_entry"><para role="column_definition">
4217 <structfield>inherited</structfield> <type>bool</type>
4218 </para>
4219 <para>
4220 If true, this row includes values from child tables, not just the
4221 values in the specified table
4222 </para></entry>
4223 </row>
4224
4225 <row>
4226 <entry role="catalog_table_entry"><para role="column_definition">
4227 <structfield>null_frac</structfield> <type>float4</type>
4228 </para>
4229 <para>
4230 Fraction of column entries that are null
4231 </para></entry>
4232 </row>
4233
4234 <row>
4235 <entry role="catalog_table_entry"><para role="column_definition">
4236 <structfield>avg_width</structfield> <type>int4</type>
4237 </para>
4238 <para>
4239 Average width in bytes of column's entries
4240 </para></entry>
4241 </row>
4242
4243 <row>
4244 <entry role="catalog_table_entry"><para role="column_definition">
4245 <structfield>n_distinct</structfield> <type>float4</type>
4246 </para>
4247 <para>
4248 If greater than zero, the estimated number of distinct values in the
4249 column. If less than zero, the negative of the number of distinct
4250 values divided by the number of rows. (The negated form is used when
4251 <command>ANALYZE</command> believes that the number of distinct values is
4252 likely to increase as the table grows; the positive form is used when
4253 the column seems to have a fixed number of possible values.) For
4254 example, -1 indicates a unique column in which the number of distinct
4255 values is the same as the number of rows.
4256 </para></entry>
4257 </row>
4258
4259 <row>
4260 <entry role="catalog_table_entry"><para role="column_definition">
4261 <structfield>most_common_vals</structfield> <type>anyarray</type>
4262 </para>
4263 <para>
4264 A list of the most common values in the column. (Null if
4265 no values seem to be more common than any others.)
4266 </para></entry>
4267 </row>
4268
4269 <row>
4270 <entry role="catalog_table_entry"><para role="column_definition">
4271 <structfield>most_common_freqs</structfield> <type>float4[]</type>
4272 </para>
4273 <para>
4274 A list of the frequencies of the most common values,
4275 i.e., number of occurrences of each divided by total number of rows.
4276 (Null when <structfield>most_common_vals</structfield> is.)
4277 </para></entry>
4278 </row>
4279
4280 <row>
4281 <entry role="catalog_table_entry"><para role="column_definition">
4282 <structfield>histogram_bounds</structfield> <type>anyarray</type>
4283 </para>
4284 <para>
4285 A list of values that divide the column's values into groups of
4286 approximately equal population. The values in
4287 <structfield>most_common_vals</structfield>, if present, are omitted from this
4288 histogram calculation. (This column is null if the column data type
4289 does not have a <literal>&lt;</literal> operator or if the
4290 <structfield>most_common_vals</structfield> list accounts for the entire
4291 population.)
4292 </para></entry>
4293 </row>
4294
4295 <row>
4296 <entry role="catalog_table_entry"><para role="column_definition">
4297 <structfield>correlation</structfield> <type>float4</type>
4298 </para>
4299 <para>
4300 Statistical correlation between physical row ordering and
4301 logical ordering of the column values. This ranges from -1 to +1.
4302 When the value is near -1 or +1, an index scan on the column will
4303 be estimated to be cheaper than when it is near zero, due to reduction
4304 of random access to the disk. (This column is null if the column data
4305 type does not have a <literal>&lt;</literal> operator.)
4306 </para></entry>
4307 </row>
4308
4309 <row>
4310 <entry role="catalog_table_entry"><para role="column_definition">
4311 <structfield>most_common_elems</structfield> <type>anyarray</type>
4312 </para>
4313 <para>
4314 A list of non-null element values most often appearing within values of
4315 the column. (Null for scalar types.)
4316 </para></entry>
4317 </row>
4318
4319 <row>
4320 <entry role="catalog_table_entry"><para role="column_definition">
4321 <structfield>most_common_elem_freqs</structfield> <type>float4[]</type>
4322 </para>
4323 <para>
4324 A list of the frequencies of the most common element values, i.e., the
4325 fraction of rows containing at least one instance of the given value.
4326 Two or three additional values follow the per-element frequencies;
4327 these are the minimum and maximum of the preceding per-element
4328 frequencies, and optionally the frequency of null elements.
4329 (Null when <structfield>most_common_elems</structfield> is.)
4330 </para></entry>
4331 </row>
4332
4333 <row>
4334 <entry role="catalog_table_entry"><para role="column_definition">
4335 <structfield>elem_count_histogram</structfield> <type>float4[]</type>
4336 </para>
4337 <para>
4338 A histogram of the counts of distinct non-null element values within the
4339 values of the column, followed by the average number of distinct
4340 non-null elements. (Null for scalar types.)
4341 </para></entry>
4342 </row>
4343
4344 <row>
4345 <entry role="catalog_table_entry"><para role="column_definition">
4346 <structfield>range_length_histogram</structfield> <type>anyarray</type>
4347 </para>
4348 <para>
4349 A histogram of the lengths of non-empty and non-null range values of a
4350 range type column. (Null for non-range types.)
4351 </para>
4352 <para>
4353 This histogram is calculated using the <function>subtype_diff</function>
4354 range function regardless of whether range bounds are inclusive.
4355 </para></entry>
4356 </row>
4357
4358 <row>
4359 <entry role="catalog_table_entry"><para role="column_definition">
4360 <structfield>range_empty_frac</structfield> <type>float4</type>
4361 </para>
4362 <para>
4363 Fraction of column entries whose values are empty ranges.
4364 (Null for non-range types.)
4365 </para></entry>
4366 </row>
4367
4368 <row>
4369 <entry role="catalog_table_entry"><para role="column_definition">
4370 <structfield>range_bounds_histogram</structfield> <type>anyarray</type>
4371 </para>
4372 <para>
4373 A histogram of lower and upper bounds of non-empty and non-null range
4374 values. (Null for non-range types.)
4375 </para>
4376 <para>
4377 These two histograms are represented as a single array of ranges, whose
4378 lower bounds represent the histogram of lower bounds, and upper bounds
4379 represent the histogram of upper bounds.
4380 </para></entry>
4381 </row>
4382 </tbody>
4383 </tgroup>
4384 </table>
4385
4386 <para>
4387 The maximum number of entries in the array fields can be controlled on a
4388 column-by-column basis using the <link linkend="sql-altertable"><command>ALTER
4389 TABLE SET STATISTICS</command></link>
4390 command, or globally by setting the
4391 <xref linkend="guc-default-statistics-target"/> run-time parameter.
4392 </para>
4393
4394 </sect1>
4395
4396 <sect1 id="view-pg-stats-ext">
4397 <title><structname>pg_stats_ext</structname></title>
4398
4399 <indexterm zone="view-pg-stats-ext">
4400 <primary>pg_stats_ext</primary>
4401 </indexterm>
4402
4403 <para>
4404 The view <structname>pg_stats_ext</structname> provides access to
4405 information about each extended statistics object in the database,
4406 combining information stored in the <link
4407 linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>
4408 and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
4409 catalogs. This view allows access only to rows of
4410 <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link> and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
4411 that correspond to tables the user owns, and therefore
4412 it is safe to allow public read access to this view.
4413 </para>
4414
4415 <para>
4416 <structname>pg_stats_ext</structname> is also designed to present the
4417 information in a more readable format than the underlying catalogs
4418 &mdash; at the cost that its schema must be extended whenever new types
4419 of extended statistics are added to <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.
4420 </para>
4421
4422 <table>
4423 <title><structname>pg_stats_ext</structname> Columns</title>
4424 <tgroup cols="1">
4425 <thead>
4426 <row>
4427 <entry role="catalog_table_entry"><para role="column_definition">
4428 Column Type
4429 </para>
4430 <para>
4431 Description
4432 </para></entry>
4433 </row>
4434 </thead>
4435
4436 <tbody>
4437 <row>
4438 <entry role="catalog_table_entry"><para role="column_definition">
4439 <structfield>schemaname</structfield> <type>name</type>
4440 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
4441 </para>
4442 <para>
4443 Name of schema containing table
4444 </para></entry>
4445 </row>
4446
4447 <row>
4448 <entry role="catalog_table_entry"><para role="column_definition">
4449 <structfield>tablename</structfield> <type>name</type>
4450 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
4451 </para>
4452 <para>
4453 Name of table
4454 </para></entry>
4455 </row>
4456
4457 <row>
4458 <entry role="catalog_table_entry"><para role="column_definition">
4459 <structfield>statistics_schemaname</structfield> <type>name</type>
4460 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
4461 </para>
4462 <para>
4463 Name of schema containing extended statistics object
4464 </para></entry>
4465 </row>
4466
4467 <row>
4468 <entry role="catalog_table_entry"><para role="column_definition">
4469 <structfield>statistics_name</structfield> <type>name</type>
4470 (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>stxname</structfield>)
4471 </para>
4472 <para>
4473 Name of extended statistics object
4474 </para></entry>
4475 </row>
4476
4477 <row>
4478 <entry role="catalog_table_entry"><para role="column_definition">
4479 <structfield>statistics_owner</structfield> <type>name</type>
4480 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
4481 </para>
4482 <para>
4483 Owner of the extended statistics object
4484 </para></entry>
4485 </row>
4486
4487 <row>
4488 <entry role="catalog_table_entry"><para role="column_definition">
4489 <structfield>attnames</structfield> <type>name[]</type>
4490 (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
4491 </para>
4492 <para>
4493 Names of the columns included in the extended statistics object
4494 </para></entry>
4495 </row>
4496
4497 <row>
4498 <entry role="catalog_table_entry"><para role="column_definition">
4499 <structfield>exprs</structfield> <type>text[]</type>
4500 </para>
4501 <para>
4502 Expressions included in the extended statistics object
4503 </para></entry>
4504 </row>
4505
4506 <row>
4507 <entry role="catalog_table_entry"><para role="column_definition">
4508 <structfield>kinds</structfield> <type>char[]</type>
4509 </para>
4510 <para>
4511 Types of extended statistics object enabled for this record
4512 </para></entry>
4513 </row>
4514
4515 <row>
4516 <entry role="catalog_table_entry"><para role="column_definition">
4517 <structfield>inherited</structfield> <type>bool</type>
4518 (references <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>.<structfield>stxdinherit</structfield>)
4519 </para>
4520 <para>
4521 If true, the stats include values from child tables, not just the
4522 values in the specified relation
4523 </para></entry>
4524 </row>
4525
4526 <row>
4527 <entry role="catalog_table_entry"><para role="column_definition">
4528 <structfield>n_distinct</structfield> <type>pg_ndistinct</type>
4529 </para>
4530 <para>
4531 N-distinct counts for combinations of column values. If greater
4532 than zero, the estimated number of distinct values in the combination.
4533 If less than zero, the negative of the number of distinct values divided
4534 by the number of rows.
4535 (The negated form is used when <command>ANALYZE</command> believes that
4536 the number of distinct values is likely to increase as the table grows;
4537 the positive form is used when the column seems to have a fixed number
4538 of possible values.) For example, -1 indicates a unique combination of
4539 columns in which the number of distinct combinations is the same as the
4540 number of rows.
4541 </para></entry>
4542 </row>
4543
4544 <row>
4545 <entry role="catalog_table_entry"><para role="column_definition">
4546 <structfield>dependencies</structfield> <type>pg_dependencies</type>
4547 </para>
4548 <para>
4549 Functional dependency statistics
4550 </para></entry>
4551 </row>
4552
4553 <row>
4554 <entry role="catalog_table_entry"><para role="column_definition">
4555 <structfield>most_common_vals</structfield> <type>text[]</type>
4556 </para>
4557 <para>
4558 A list of the most common combinations of values in the columns.
4559 (Null if no combinations seem to be more common than any others.)
4560 </para></entry>
4561 </row>
4562
4563 <row>
4564 <entry role="catalog_table_entry"><para role="column_definition">
4565 <structfield>most_common_val_nulls</structfield> <type>bool[]</type>
4566 </para>
4567 <para>
4568 A list of NULL flags for the most common combinations of values.
4569 (Null when <structfield>most_common_vals</structfield> is.)
4570 </para></entry>
4571 </row>
4572
4573 <row>
4574 <entry role="catalog_table_entry"><para role="column_definition">
4575 <structfield>most_common_freqs</structfield> <type>float8[]</type>
4576 </para>
4577 <para>
4578 A list of the frequencies of the most common combinations,
4579 i.e., number of occurrences of each divided by total number of rows.
4580 (Null when <structfield>most_common_vals</structfield> is.)
4581 </para></entry>
4582 </row>
4583
4584 <row>
4585 <entry role="catalog_table_entry"><para role="column_definition">
4586 <structfield>most_common_base_freqs</structfield> <type>float8[]</type>
4587 </para>
4588 <para>
4589 A list of the base frequencies of the most common combinations,
4590 i.e., product of per-value frequencies.
4591 (Null when <structfield>most_common_vals</structfield> is.)
4592 </para></entry>
4593 </row>
4594 </tbody>
4595 </tgroup>
4596 </table>
4597
4598 <para>
4599 The maximum number of entries in the array fields can be controlled on a
4600 column-by-column basis using the <link linkend="sql-altertable"><command>ALTER
4601 TABLE SET STATISTICS</command></link> command, or globally by setting the
4602 <xref linkend="guc-default-statistics-target"/> run-time parameter.
4603 </para>
4604
4605 </sect1>
4606
4607 <sect1 id="view-pg-stats-ext-exprs">
4608 <title><structname>pg_stats_ext_exprs</structname></title>
4609
4610 <indexterm zone="view-pg-stats-ext-exprs">
4611 <primary>pg_stats_ext_exprs</primary>
4612 </indexterm>
4613
4614 <para>
4615 The view <structname>pg_stats_ext_exprs</structname> provides access to
4616 information about all expressions included in extended statistics objects,
4617 combining information stored in the <link
4618 linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>
4619 and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
4620 catalogs. This view allows access only to rows of
4621 <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link> and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
4622 that correspond to tables the user owns, and therefore
4623 it is safe to allow public read access to this view.
4624 </para>
4625
4626 <para>
4627 <structname>pg_stats_ext_exprs</structname> is also designed to present
4628 the information in a more readable format than the underlying catalogs
4629 &mdash; at the cost that its schema must be extended whenever the structure
4630 of statistics in <structname>pg_statistic_ext</structname> changes.
4631 </para>
4632
4633 <table>
4634 <title><structname>pg_stats_ext_exprs</structname> Columns</title>
4635 <tgroup cols="1">
4636 <thead>
4637 <row>
4638 <entry role="catalog_table_entry"><para role="column_definition">
4639 Column Type
4640 </para>
4641 <para>
4642 Description
4643 </para></entry>
4644 </row>
4645 </thead>
4646
4647 <tbody>
4648 <row>
4649 <entry role="catalog_table_entry"><para role="column_definition">
4650 <structfield>schemaname</structfield> <type>name</type>
4651 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
4652 </para>
4653 <para>
4654 Name of schema containing table
4655 </para></entry>
4656 </row>
4657
4658 <row>
4659 <entry role="catalog_table_entry"><para role="column_definition">
4660 <structfield>tablename</structfield> <type>name</type>
4661 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
4662 </para>
4663 <para>
4664 Name of table the statistics object is defined on
4665 </para></entry>
4666 </row>
4667
4668 <row>
4669 <entry role="catalog_table_entry"><para role="column_definition">
4670 <structfield>statistics_schemaname</structfield> <type>name</type>
4671 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
4672 </para>
4673 <para>
4674 Name of schema containing extended statistics object
4675 </para></entry>
4676 </row>
4677
4678 <row>
4679 <entry role="catalog_table_entry"><para role="column_definition">
4680 <structfield>statistics_name</structfield> <type>name</type>
4681 (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>stxname</structfield>)
4682 </para>
4683 <para>
4684 Name of extended statistics object
4685 </para></entry>
4686 </row>
4687
4688 <row>
4689 <entry role="catalog_table_entry"><para role="column_definition">
4690 <structfield>statistics_owner</structfield> <type>name</type>
4691 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
4692 </para>
4693 <para>
4694 Owner of the extended statistics object
4695 </para></entry>
4696 </row>
4697
4698 <row>
4699 <entry role="catalog_table_entry"><para role="column_definition">
4700 <structfield>expr</structfield> <type>text</type>
4701 </para>
4702 <para>
4703 Expression included in the extended statistics object
4704 </para></entry>
4705 </row>
4706
4707 <row>
4708 <entry role="catalog_table_entry"><para role="column_definition">
4709 <structfield>inherited</structfield> <type>bool</type>
4710 (references <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>.<structfield>stxdinherit</structfield>)
4711 </para>
4712 <para>
4713 If true, the stats include values from child tables, not just the
4714 values in the specified relation
4715 </para></entry>
4716 </row>
4717
4718 <row>
4719 <entry role="catalog_table_entry"><para role="column_definition">
4720 <structfield>null_frac</structfield> <type>float4</type>
4721 </para>
4722 <para>
4723 Fraction of expression entries that are null
4724 </para></entry>
4725 </row>
4726
4727 <row>
4728 <entry role="catalog_table_entry"><para role="column_definition">
4729 <structfield>avg_width</structfield> <type>int4</type>
4730 </para>
4731 <para>
4732 Average width in bytes of expression's entries
4733 </para></entry>
4734 </row>
4735
4736 <row>
4737 <entry role="catalog_table_entry"><para role="column_definition">
4738 <structfield>n_distinct</structfield> <type>float4</type>
4739 </para>
4740 <para>
4741 If greater than zero, the estimated number of distinct values in the
4742 expression. If less than zero, the negative of the number of distinct
4743 values divided by the number of rows. (The negated form is used when
4744 <command>ANALYZE</command> believes that the number of distinct values is
4745 likely to increase as the table grows; the positive form is used when
4746 the expression seems to have a fixed number of possible values.) For
4747 example, -1 indicates a unique expression in which the number of distinct
4748 values is the same as the number of rows.
4749 </para></entry>
4750 </row>
4751
4752 <row>
4753 <entry role="catalog_table_entry"><para role="column_definition">
4754 <structfield>most_common_vals</structfield> <type>anyarray</type>
4755 </para>
4756 <para>
4757 A list of the most common values in the expression. (Null if
4758 no values seem to be more common than any others.)
4759 </para></entry>
4760 </row>
4761
4762 <row>
4763 <entry role="catalog_table_entry"><para role="column_definition">
4764 <structfield>most_common_freqs</structfield> <type>float4[]</type>
4765 </para>
4766 <para>
4767 A list of the frequencies of the most common values,
4768 i.e., number of occurrences of each divided by total number of rows.
4769 (Null when <structfield>most_common_vals</structfield> is.)
4770 </para></entry>
4771 </row>
4772
4773 <row>
4774 <entry role="catalog_table_entry"><para role="column_definition">
4775 <structfield>histogram_bounds</structfield> <type>anyarray</type>
4776 </para>
4777 <para>
4778 A list of values that divide the expression's values into groups of
4779 approximately equal population. The values in
4780 <structfield>most_common_vals</structfield>, if present, are omitted from this
4781 histogram calculation. (This expression is null if the expression data type
4782 does not have a <literal>&lt;</literal> operator or if the
4783 <structfield>most_common_vals</structfield> list accounts for the entire
4784 population.)
4785 </para></entry>
4786 </row>
4787
4788 <row>
4789 <entry role="catalog_table_entry"><para role="column_definition">
4790 <structfield>correlation</structfield> <type>float4</type>
4791 </para>
4792 <para>
4793 Statistical correlation between physical row ordering and
4794 logical ordering of the expression values. This ranges from -1 to +1.
4795 When the value is near -1 or +1, an index scan on the expression will
4796 be estimated to be cheaper than when it is near zero, due to reduction
4797 of random access to the disk. (This expression is null if the expression's
4798 data type does not have a <literal>&lt;</literal> operator.)
4799 </para></entry>
4800 </row>
4801
4802 <row>
4803 <entry role="catalog_table_entry"><para role="column_definition">
4804 <structfield>most_common_elems</structfield> <type>anyarray</type>
4805 </para>
4806 <para>
4807 A list of non-null element values most often appearing within values of
4808 the expression. (Null for scalar types.)
4809 </para></entry>
4810 </row>
4811
4812 <row>
4813 <entry role="catalog_table_entry"><para role="column_definition">
4814 <structfield>most_common_elem_freqs</structfield> <type>float4[]</type>
4815 </para>
4816 <para>
4817 A list of the frequencies of the most common element values, i.e., the
4818 fraction of rows containing at least one instance of the given value.
4819 Two or three additional values follow the per-element frequencies;
4820 these are the minimum and maximum of the preceding per-element
4821 frequencies, and optionally the frequency of null elements.
4822 (Null when <structfield>most_common_elems</structfield> is.)
4823 </para></entry>
4824 </row>
4825
4826 <row>
4827 <entry role="catalog_table_entry"><para role="column_definition">
4828 <structfield>elem_count_histogram</structfield> <type>float4[]</type>
4829 </para>
4830 <para>
4831 A histogram of the counts of distinct non-null element values within the
4832 values of the expression, followed by the average number of distinct
4833 non-null elements. (Null for scalar types.)
4834 </para></entry>
4835 </row>
4836 </tbody>
4837 </tgroup>
4838 </table>
4839
4840 <para>
4841 The maximum number of entries in the array fields can be controlled on a
4842 column-by-column basis using the <link linkend="sql-altertable"><command>ALTER
4843 TABLE SET STATISTICS</command></link> command, or globally by setting the
4844 <xref linkend="guc-default-statistics-target"/> run-time parameter.
4845 </para>
4846
4847 </sect1>
4848
4849 <sect1 id="view-pg-tables">
4850 <title><structname>pg_tables</structname></title>
4851
4852 <indexterm zone="view-pg-tables">
4853 <primary>pg_tables</primary>
4854 </indexterm>
4855
4856 <para>
4857 The view <structname>pg_tables</structname> provides access to
4858 useful information about each table in the database.
4859 </para>
4860
4861 <table>
4862 <title><structname>pg_tables</structname> Columns</title>
4863 <tgroup cols="1">
4864 <thead>
4865 <row>
4866 <entry role="catalog_table_entry"><para role="column_definition">
4867 Column Type
4868 </para>
4869 <para>
4870 Description
4871 </para></entry>
4872 </row>
4873 </thead>
4874
4875 <tbody>
4876 <row>
4877 <entry role="catalog_table_entry"><para role="column_definition">
4878 <structfield>schemaname</structfield> <type>name</type>
4879 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
4880 </para>
4881 <para>
4882 Name of schema containing table
4883 </para></entry>
4884 </row>
4885
4886 <row>
4887 <entry role="catalog_table_entry"><para role="column_definition">
4888 <structfield>tablename</structfield> <type>name</type>
4889 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
4890 </para>
4891 <para>
4892 Name of table
4893 </para></entry>
4894 </row>
4895
4896 <row>
4897 <entry role="catalog_table_entry"><para role="column_definition">
4898 <structfield>tableowner</structfield> <type>name</type>
4899 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
4900 </para>
4901 <para>
4902 Name of table's owner
4903 </para></entry>
4904 </row>
4905
4906 <row>
4907 <entry role="catalog_table_entry"><para role="column_definition">
4908 <structfield>tablespace</structfield> <type>name</type>
4909 (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
4910 </para>
4911 <para>
4912 Name of tablespace containing table (null if default for database)
4913 </para></entry>
4914 </row>
4915
4916 <row>
4917 <entry role="catalog_table_entry"><para role="column_definition">
4918 <structfield>hasindexes</structfield> <type>bool</type>
4919 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhasindex</structfield>)
4920 </para>
4921 <para>
4922 True if table has (or recently had) any indexes
4923 </para></entry>
4924 </row>
4925
4926 <row>
4927 <entry role="catalog_table_entry"><para role="column_definition">
4928 <structfield>hasrules</structfield> <type>bool</type>
4929 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhasrules</structfield>)
4930 </para>
4931 <para>
4932 True if table has (or once had) rules
4933 </para></entry>
4934 </row>
4935
4936 <row>
4937 <entry role="catalog_table_entry"><para role="column_definition">
4938 <structfield>hastriggers</structfield> <type>bool</type>
4939 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhastriggers</structfield>)
4940 </para>
4941 <para>
4942 True if table has (or once had) triggers
4943 </para></entry>
4944 </row>
4945
4946 <row>
4947 <entry role="catalog_table_entry"><para role="column_definition">
4948 <structfield>rowsecurity</structfield> <type>bool</type>
4949 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relrowsecurity</structfield>)
4950 </para>
4951 <para>
4952 True if row security is enabled on the table
4953 </para></entry>
4954 </row>
4955 </tbody>
4956 </tgroup>
4957 </table>
4958
4959 </sect1>
4960
4961 <sect1 id="view-pg-timezone-abbrevs">
4962 <title><structname>pg_timezone_abbrevs</structname></title>
4963
4964 <indexterm zone="view-pg-timezone-abbrevs">
4965 <primary>pg_timezone_abbrevs</primary>
4966 </indexterm>
4967
4968 <para>
4969 The view <structname>pg_timezone_abbrevs</structname> provides a list
4970 of time zone abbreviations that are currently recognized by the datetime
4971 input routines. The contents of this view change when the
4972 <xref linkend="guc-timezone"/> or
4973 <xref linkend="guc-timezone-abbreviations"/> run-time parameters are
4974 modified.
4975 </para>
4976
4977 <table>
4978 <title><structname>pg_timezone_abbrevs</structname> Columns</title>
4979 <tgroup cols="1">
4980 <thead>
4981 <row>
4982 <entry role="catalog_table_entry"><para role="column_definition">
4983 Column Type
4984 </para>
4985 <para>
4986 Description
4987 </para></entry>
4988 </row>
4989 </thead>
4990
4991 <tbody>
4992 <row>
4993 <entry role="catalog_table_entry"><para role="column_definition">
4994 <structfield>abbrev</structfield> <type>text</type>
4995 </para>
4996 <para>
4997 Time zone abbreviation
4998 </para></entry>
4999 </row>
5000
5001 <row>
5002 <entry role="catalog_table_entry"><para role="column_definition">
5003 <structfield>utc_offset</structfield> <type>interval</type>
5004 </para>
5005 <para>
5006 Offset from UTC (positive means east of Greenwich)
5007 </para></entry>
5008 </row>
5009
5010 <row>
5011 <entry role="catalog_table_entry"><para role="column_definition">
5012 <structfield>is_dst</structfield> <type>bool</type>
5013 </para>
5014 <para>
5015 True if this is a daylight-savings abbreviation
5016 </para></entry>
5017 </row>
5018 </tbody>
5019 </tgroup>
5020 </table>
5021
5022 <para>
5023 While most timezone abbreviations represent fixed offsets from UTC,
5024 there are some that have historically varied in value
5025 (see <xref linkend="datetime-config-files"/> for more information).
5026 In such cases this view presents their current meaning.
5027 </para>
5028
5029 </sect1>
5030
5031 <sect1 id="view-pg-timezone-names">
5032 <title><structname>pg_timezone_names</structname></title>
5033
5034 <indexterm zone="view-pg-timezone-names">
5035 <primary>pg_timezone_names</primary>
5036 </indexterm>
5037
5038 <para>
5039 The view <structname>pg_timezone_names</structname> provides a list
5040 of time zone names that are recognized by <command>SET TIMEZONE</command>,
5041 along with their associated abbreviations, UTC offsets,
5042 and daylight-savings status. (Technically,
5043 <productname>PostgreSQL</productname> does not use UTC because leap
5044 seconds are not handled.)
5045 Unlike the abbreviations shown in <link
5046 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
5047 date rules. Therefore, the associated information changes across local DST
5048 boundaries. The displayed information is computed based on the current
5049 value of <function>CURRENT_TIMESTAMP</function>.
5050 </para>
5051
5052 <table>
5053 <title><structname>pg_timezone_names</structname> Columns</title>
5054 <tgroup cols="1">
5055 <thead>
5056 <row>
5057 <entry role="catalog_table_entry"><para role="column_definition">
5058 Column Type
5059 </para>
5060 <para>
5061 Description
5062 </para></entry>
5063 </row>
5064 </thead>
5065
5066 <tbody>
5067 <row>
5068 <entry role="catalog_table_entry"><para role="column_definition">
5069 <structfield>name</structfield> <type>text</type>
5070 </para>
5071 <para>
5072 Time zone name
5073 </para></entry>
5074 </row>
5075
5076 <row>
5077 <entry role="catalog_table_entry"><para role="column_definition">
5078 <structfield>abbrev</structfield> <type>text</type>
5079 </para>
5080 <para>
5081 Time zone abbreviation
5082 </para></entry>
5083 </row>
5084
5085 <row>
5086 <entry role="catalog_table_entry"><para role="column_definition">
5087 <structfield>utc_offset</structfield> <type>interval</type>
5088 </para>
5089 <para>
5090 Offset from UTC (positive means east of Greenwich)
5091 </para></entry>
5092 </row>
5093
5094 <row>
5095 <entry role="catalog_table_entry"><para role="column_definition">
5096 <structfield>is_dst</structfield> <type>bool</type>
5097 </para>
5098 <para>
5099 True if currently observing daylight savings
5100 </para></entry>
5101 </row>
5102 </tbody>
5103 </tgroup>
5104 </table>
5105
5106 </sect1>
5107
5108 <sect1 id="view-pg-user">
5109 <title><structname>pg_user</structname></title>
5110
5111 <indexterm zone="view-pg-user">
5112 <primary>pg_user</primary>
5113 </indexterm>
5114
5115 <para>
5116 The view <structname>pg_user</structname> provides access to
5117 information about database users. This is simply a publicly
5118 readable view of
5119 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
5120 that blanks out the password field.
5121 </para>
5122
5123 <table>
5124 <title><structname>pg_user</structname> Columns</title>
5125 <tgroup cols="1">
5126 <thead>
5127 <row>
5128 <entry role="catalog_table_entry"><para role="column_definition">
5129 Column Type
5130 </para>
5131 <para>
5132 Description
5133 </para></entry>
5134 </row>
5135 </thead>
5136
5137 <tbody>
5138 <row>
5139 <entry role="catalog_table_entry"><para role="column_definition">
5140 <structfield>usename</structfield> <type>name</type>
5141 </para>
5142 <para>
5143 User name
5144 </para></entry>
5145 </row>
5146
5147 <row>
5148 <entry role="catalog_table_entry"><para role="column_definition">
5149 <structfield>usesysid</structfield> <type>oid</type>
5150 </para>
5151 <para>
5152 ID of this user
5153 </para></entry>
5154 </row>
5155
5156 <row>
5157 <entry role="catalog_table_entry"><para role="column_definition">
5158 <structfield>usecreatedb</structfield> <type>bool</type>
5159 </para>
5160 <para>
5161 User can create databases
5162 </para></entry>
5163 </row>
5164
5165 <row>
5166 <entry role="catalog_table_entry"><para role="column_definition">
5167 <structfield>usesuper</structfield> <type>bool</type>
5168 </para>
5169 <para>
5170 User is a superuser
5171 </para></entry>
5172 </row>
5173
5174 <row>
5175 <entry role="catalog_table_entry"><para role="column_definition">
5176 <structfield>userepl</structfield> <type>bool</type>
5177 </para>
5178 <para>
5179 User can initiate streaming replication and put the system in and
5180 out of backup mode.
5181 </para></entry>
5182 </row>
5183
5184 <row>
5185 <entry role="catalog_table_entry"><para role="column_definition">
5186 <structfield>usebypassrls</structfield> <type>bool</type>
5187 </para>
5188 <para>
5189 User bypasses every row-level security policy, see
5190 <xref linkend="ddl-rowsecurity"/> for more information.
5191 </para></entry>
5192 </row>
5193
5194 <row>
5195 <entry role="catalog_table_entry"><para role="column_definition">
5196 <structfield>passwd</structfield> <type>text</type>
5197 </para>
5198 <para>
5199 Not the password (always reads as <literal>********</literal>)
5200 </para></entry>
5201 </row>
5202
5203 <row>
5204 <entry role="catalog_table_entry"><para role="column_definition">
5205 <structfield>valuntil</structfield> <type>timestamptz</type>
5206 </para>
5207 <para>
5208 Password expiry time (only used for password authentication)
5209 </para></entry>
5210 </row>
5211
5212 <row>
5213 <entry role="catalog_table_entry"><para role="column_definition">
5214 <structfield>useconfig</structfield> <type>text[]</type>
5215 </para>
5216 <para>
5217 Session defaults for run-time configuration variables
5218 </para></entry>
5219 </row>
5220 </tbody>
5221 </tgroup>
5222 </table>
5223
5224 </sect1>
5225
5226 <sect1 id="view-pg-user-mappings">
5227 <title><structname>pg_user_mappings</structname></title>
5228
5229 <indexterm zone="view-pg-user-mappings">
5230 <primary>pg_user_mappings</primary>
5231 </indexterm>
5232
5233 <para>
5234 The view <structname>pg_user_mappings</structname> provides access
5235 to information about user mappings. This is essentially a publicly
5236 readable view of
5237 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
5238 that leaves out the options field if the user has no rights to use
5239 it.
5240 </para>
5241
5242 <table>
5243 <title><structname>pg_user_mappings</structname> Columns</title>
5244 <tgroup cols="1">
5245 <thead>
5246 <row>
5247 <entry role="catalog_table_entry"><para role="column_definition">
5248 Column Type
5249 </para>
5250 <para>
5251 Description
5252 </para></entry>
5253 </row>
5254 </thead>
5255
5256 <tbody>
5257 <row>
5258 <entry role="catalog_table_entry"><para role="column_definition">
5259 <structfield>umid</structfield> <type>oid</type>
5260 (references <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.<structfield>oid</structfield>)
5261 </para>
5262 <para>
5263 OID of the user mapping
5264 </para></entry>
5265 </row>
5266
5267 <row>
5268 <entry role="catalog_table_entry"><para role="column_definition">
5269 <structfield>srvid</structfield> <type>oid</type>
5270 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
5271 </para>
5272 <para>
5273 The OID of the foreign server that contains this mapping
5274 </para></entry>
5275 </row>
5276
5277 <row>
5278 <entry role="catalog_table_entry"><para role="column_definition">
5279 <structfield>srvname</structfield> <type>name</type>
5280 (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>srvname</structfield>)
5281 </para>
5282 <para>
5283 Name of the foreign server
5284 </para></entry>
5285 </row>
5286
5287 <row>
5288 <entry role="catalog_table_entry"><para role="column_definition">
5289 <structfield>umuser</structfield> <type>oid</type>
5290 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5291 </para>
5292 <para>
5293 OID of the local role being mapped, or zero if the user mapping is public
5294 </para></entry>
5295 </row>
5296
5297 <row>
5298 <entry role="catalog_table_entry"><para role="column_definition">
5299 <structfield>usename</structfield> <type>name</type>
5300 </para>
5301 <para>
5302 Name of the local user to be mapped
5303 </para></entry>
5304 </row>
5305
5306 <row>
5307 <entry role="catalog_table_entry"><para role="column_definition">
5308 <structfield>umoptions</structfield> <type>text[]</type>
5309 </para>
5310 <para>
5311 User mapping specific options, as <quote>keyword=value</quote> strings
5312 </para></entry>
5313 </row>
5314 </tbody>
5315 </tgroup>
5316 </table>
5317
5318 <para>
5319 To protect password information stored as a user mapping option,
5320 the <structfield>umoptions</structfield> column will read as null
5321 unless one of the following applies:
5322 <itemizedlist>
5323 <listitem>
5324 <para>
5325 current user is the user being mapped, and owns the server or
5326 holds <literal>USAGE</literal> privilege on it
5327 </para>
5328 </listitem>
5329 <listitem>
5330 <para>
5331 current user is the server owner and mapping is for <literal>PUBLIC</literal>
5332 </para>
5333 </listitem>
5334 <listitem>
5335 <para>
5336 current user is a superuser
5337 </para>
5338 </listitem>
5339 </itemizedlist>
5340 </para>
5341
5342 </sect1>
5343
5344
5345 <sect1 id="view-pg-views">
5346 <title><structname>pg_views</structname></title>
5347
5348 <indexterm zone="view-pg-views">
5349 <primary>pg_views</primary>
5350 </indexterm>
5351
5352 <para>
5353 The view <structname>pg_views</structname> provides access to
5354 useful information about each view in the database.
5355 </para>
5356
5357 <table>
5358 <title><structname>pg_views</structname> Columns</title>
5359 <tgroup cols="1">
5360 <thead>
5361 <row>
5362 <entry role="catalog_table_entry"><para role="column_definition">
5363 Column Type
5364 </para>
5365 <para>
5366 Description
5367 </para></entry>
5368 </row>
5369 </thead>
5370
5371 <tbody>
5372 <row>
5373 <entry role="catalog_table_entry"><para role="column_definition">
5374 <structfield>schemaname</structfield> <type>name</type>
5375 (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
5376 </para>
5377 <para>
5378 Name of schema containing view
5379 </para></entry>
5380 </row>
5381
5382 <row>
5383 <entry role="catalog_table_entry"><para role="column_definition">
5384 <structfield>viewname</structfield> <type>name</type>
5385 (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
5386 </para>
5387 <para>
5388 Name of view
5389 </para></entry>
5390 </row>
5391
5392 <row>
5393 <entry role="catalog_table_entry"><para role="column_definition">
5394 <structfield>viewowner</structfield> <type>name</type>
5395 (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
5396 </para>
5397 <para>
5398 Name of view's owner
5399 </para></entry>
5400 </row>
5401
5402 <row>
5403 <entry role="catalog_table_entry"><para role="column_definition">
5404 <structfield>definition</structfield> <type>text</type>
5405 </para>
5406 <para>
5407 View definition (a reconstructed <xref linkend="sql-select"/> query)
5408 </para></entry>
5409 </row>
5410 </tbody>
5411 </tgroup>
5412 </table>
5413 </sect1>
5414
5415
5416 <sect1 id="view-pg-wait-events">
5417 <title><structname>pg_wait_events</structname></title>
5418
5419 <indexterm zone="view-pg-wait-events">
5420 <primary>pg_wait_events</primary>
5421 </indexterm>
5422
5423 <para>
5424 The view <structname>pg_wait_events</structname> provides description about the
5425 wait events.
5426 </para>
5427
5428 <table>
5429 <title><structname>pg_wait_events</structname> Columns</title>
5430 <tgroup cols="1">
5431 <thead>
5432 <row>
5433 <entry role="catalog_table_entry"><para role="column_definition">
5434 Column Type
5435 </para>
5436 <para>
5437 Description
5438 </para></entry>
5439 </row>
5440 </thead>
5441
5442 <tbody>
5443 <row>
5444 <entry role="catalog_table_entry"><para role="column_definition">
5445 <structfield>type</structfield> <type>text</type>
5446 </para>
5447 <para>
5448 Wait event type
5449 </para></entry>
5450 </row>
5451
5452 <row>
5453 <entry role="catalog_table_entry"><para role="column_definition">
5454 <structfield>name</structfield> <type>text</type>
5455 </para>
5456 <para>
5457 Wait event name
5458 </para></entry>
5459 </row>
5460
5461 <row>
5462 <entry role="catalog_table_entry"><para role="column_definition">
5463 <structfield>description</structfield> <type>text</type>
5464 </para>
5465 <para>
5466 Wait event description
5467 </para></entry>
5468 </row>
5469 </tbody>
5470 </tgroup>
5471 </table>
5472 </sect1>
5473
5474 </chapter>