Update autovacuum to use reloptions instead of a system catalog, for
[PostgreSQL.git] / doc / src / sgml / catalogs.sgml
blob362dc89115b5eb1545f39a68779cb20f2445772b
1 <!-- $PostgreSQL$ -->
2 <!--
3 Documentation of the system catalogs, directed toward PostgreSQL developers
4 -->
6 <chapter id="catalogs">
7 <title>System Catalogs</title>
9 <para>
10 The system catalogs are the place where a relational database
11 management system stores schema metadata, such as information about
12 tables and columns, and internal bookkeeping information.
13 <productname>PostgreSQL</productname>'s system catalogs are regular
14 tables. You can drop and recreate the tables, add columns, insert
15 and update values, and severely mess up your system that way.
16 Normally, one should not change the system catalogs by hand, there
17 are always SQL commands to do that. (For example, <command>CREATE
18 DATABASE</command> inserts a row into the
19 <structname>pg_database</structname> catalog &mdash; and actually
20 creates the database on disk.) There are some exceptions for
21 particularly esoteric operations, such as adding index access methods.
22 </para>
24 <sect1 id="catalogs-overview">
25 <title>Overview</title>
27 <para>
28 <xref linkend="catalog-table"> lists the system catalogs.
29 More detailed documentation of each catalog follows below.
30 </para>
32 <para>
33 Most system catalogs are copied from the template database during
34 database creation and are thereafter database-specific. A few
35 catalogs are physically shared across all databases in a cluster;
36 these are noted in the descriptions of the individual catalogs.
37 </para>
39 <table id="catalog-table">
40 <title>System Catalogs</title>
42 <tgroup cols="2">
43 <thead>
44 <row>
45 <entry>Catalog Name</entry>
46 <entry>Purpose</entry>
47 </row>
48 </thead>
50 <tbody>
51 <row>
52 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
53 <entry>aggregate functions</entry>
54 </row>
56 <row>
57 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
58 <entry>index access methods</entry>
59 </row>
61 <row>
62 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
63 <entry>access method operators</entry>
64 </row>
66 <row>
67 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
68 <entry>access method support procedures</entry>
69 </row>
71 <row>
72 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
73 <entry>column default values</entry>
74 </row>
76 <row>
77 <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
78 <entry>table columns (<quote>attributes</quote>)</entry>
79 </row>
81 <row>
82 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
83 <entry>authorization identifiers (roles)</entry>
84 </row>
86 <row>
87 <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
88 <entry>authorization identifier membership relationships</entry>
89 </row>
91 <row>
92 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
93 <entry>casts (data type conversions)</entry>
94 </row>
96 <row>
97 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
98 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
99 </row>
101 <row>
102 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
103 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
104 </row>
106 <row>
107 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
108 <entry>encoding conversion information</entry>
109 </row>
111 <row>
112 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
113 <entry>databases within this database cluster</entry>
114 </row>
116 <row>
117 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
118 <entry>dependencies between database objects</entry>
119 </row>
121 <row>
122 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
123 <entry>descriptions or comments on database objects</entry>
124 </row>
126 <row>
127 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
128 <entry>enum label and value definitions</entry>
129 </row>
131 <row>
132 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
133 <entry>foreign-data wrapper definitions</entry>
134 </row>
136 <row>
137 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
138 <entry>foreign server definitions</entry>
139 </row>
141 <row>
142 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
143 <entry>additional index information</entry>
144 </row>
146 <row>
147 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
148 <entry>table inheritance hierarchy</entry>
149 </row>
151 <row>
152 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
153 <entry>languages for writing functions</entry>
154 </row>
156 <row>
157 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
158 <entry>large objects</entry>
159 </row>
161 <row>
162 <entry><link linkend="catalog-pg-listener"><structname>pg_listener</structname></link></entry>
163 <entry>asynchronous notification support</entry>
164 </row>
166 <row>
167 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
168 <entry>schemas</entry>
169 </row>
171 <row>
172 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
173 <entry>access method operator classes</entry>
174 </row>
176 <row>
177 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
178 <entry>operators</entry>
179 </row>
181 <row>
182 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
183 <entry>access method operator families</entry>
184 </row>
186 <row>
187 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
188 <entry>template data for procedural languages</entry>
189 </row>
191 <row>
192 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
193 <entry>functions and procedures</entry>
194 </row>
196 <row>
197 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
198 <entry>query rewrite rules</entry>
199 </row>
201 <row>
202 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
203 <entry>dependencies on shared objects</entry>
204 </row>
206 <row>
207 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
208 <entry>comments on shared objects</entry>
209 </row>
211 <row>
212 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
213 <entry>planner statistics</entry>
214 </row>
216 <row>
217 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
218 <entry>tablespaces within this database cluster</entry>
219 </row>
221 <row>
222 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
223 <entry>triggers</entry>
224 </row>
226 <row>
227 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
228 <entry>text search configurations</entry>
229 </row>
231 <row>
232 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
233 <entry>text search configurations' token mappings</entry>
234 </row>
236 <row>
237 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
238 <entry>text search dictionaries</entry>
239 </row>
241 <row>
242 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
243 <entry>text search parsers</entry>
244 </row>
246 <row>
247 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
248 <entry>text search templates</entry>
249 </row>
251 <row>
252 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
253 <entry>data types</entry>
254 </row>
256 <row>
257 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
258 <entry>mappings of users to foreign servers</entry>
259 </row>
260 </tbody>
261 </tgroup>
262 </table>
263 </sect1>
266 <sect1 id="catalog-pg-aggregate">
267 <title><structname>pg_aggregate</structname></title>
269 <indexterm zone="catalog-pg-aggregate">
270 <primary>pg_aggregate</primary>
271 </indexterm>
273 <para>
274 The catalog <structname>pg_aggregate</structname> stores information about
275 aggregate functions. An aggregate function is a function that
276 operates on a set of values (typically one column from each row
277 that matches a query condition) and returns a single value computed
278 from all these values. Typical aggregate functions are
279 <function>sum</function>, <function>count</function>, and
280 <function>max</function>. Each entry in
281 <structname>pg_aggregate</structname> is an extension of an entry
282 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
283 entry carries the aggregate's name, input and output data types, and
284 other information that is similar to ordinary functions.
285 </para>
287 <table>
288 <title><structname>pg_aggregate</> Columns</title>
290 <tgroup cols="4">
291 <thead>
292 <row>
293 <entry>Name</entry>
294 <entry>Type</entry>
295 <entry>References</entry>
296 <entry>Description</entry>
297 </row>
298 </thead>
299 <tbody>
300 <row>
301 <entry><structfield>aggfnoid</structfield></entry>
302 <entry><type>regproc</type></entry>
303 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
304 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
305 </row>
306 <row>
307 <entry><structfield>aggtransfn</structfield></entry>
308 <entry><type>regproc</type></entry>
309 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
310 <entry>Transition function</entry>
311 </row>
312 <row>
313 <entry><structfield>aggfinalfn</structfield></entry>
314 <entry><type>regproc</type></entry>
315 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
316 <entry>Final function (zero if none)</entry>
317 </row>
318 <row>
319 <entry><structfield>aggsortop</structfield></entry>
320 <entry><type>oid</type></entry>
321 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
322 <entry>Associated sort operator (zero if none)</entry>
323 </row>
324 <row>
325 <entry><structfield>aggtranstype</structfield></entry>
326 <entry><type>oid</type></entry>
327 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
328 <entry>Data type of the aggregate function's internal transition (state) data</entry>
329 </row>
330 <row>
331 <entry><structfield>agginitval</structfield></entry>
332 <entry><type>text</type></entry>
333 <entry></entry>
334 <entry>
335 The initial value of the transition state. This is a text
336 field containing the initial value in its external string
337 representation. If this field is NULL, the transition state
338 value starts out NULL
339 </entry>
340 </row>
341 </tbody>
342 </tgroup>
343 </table>
345 <para>
346 New aggregate functions are registered with the <xref
347 linkend="sql-createaggregate" endterm="sql-createaggregate-title">
348 command. See <xref linkend="xaggr"> for more information about
349 writing aggregate functions and the meaning of the transition
350 functions, etc.
351 </para>
353 </sect1>
356 <sect1 id="catalog-pg-am">
357 <title><structname>pg_am</structname></title>
359 <indexterm zone="catalog-pg-am">
360 <primary>pg_am</primary>
361 </indexterm>
363 <para>
364 The catalog <structname>pg_am</structname> stores information about index
365 access methods. There is one row for each index access method supported by
366 the system. The contents of this catalog are discussed in detail in
367 <xref linkend="indexam">.
368 </para>
370 <table>
371 <title><structname>pg_am</> Columns</title>
373 <tgroup cols="4">
374 <thead>
375 <row>
376 <entry>Name</entry>
377 <entry>Type</entry>
378 <entry>References</entry>
379 <entry>Description</entry>
380 </row>
381 </thead>
382 <tbody>
384 <row>
385 <entry><structfield>amname</structfield></entry>
386 <entry><type>name</type></entry>
387 <entry></entry>
388 <entry>Name of the access method</entry>
389 </row>
391 <row>
392 <entry><structfield>amstrategies</structfield></entry>
393 <entry><type>int2</type></entry>
394 <entry></entry>
395 <entry>Number of operator strategies for this access method,
396 or zero if access method does not have a fixed set of operator
397 strategies</entry>
398 </row>
400 <row>
401 <entry><structfield>amsupport</structfield></entry>
402 <entry><type>int2</type></entry>
403 <entry></entry>
404 <entry>Number of support routines for this access method</entry>
405 </row>
407 <row>
408 <entry><structfield>amcanorder</structfield></entry>
409 <entry><type>bool</type></entry>
410 <entry></entry>
411 <entry>Does the access method support ordered scans?</entry>
412 </row>
414 <row>
415 <entry><structfield>amcanbackward</structfield></entry>
416 <entry><type>bool</type></entry>
417 <entry></entry>
418 <entry>Does the access method support backward scanning?</entry>
419 </row>
421 <row>
422 <entry><structfield>amcanunique</structfield></entry>
423 <entry><type>bool</type></entry>
424 <entry></entry>
425 <entry>Does the access method support unique indexes?</entry>
426 </row>
428 <row>
429 <entry><structfield>amcanmulticol</structfield></entry>
430 <entry><type>bool</type></entry>
431 <entry></entry>
432 <entry>Does the access method support multicolumn indexes?</entry>
433 </row>
435 <row>
436 <entry><structfield>amoptionalkey</structfield></entry>
437 <entry><type>bool</type></entry>
438 <entry></entry>
439 <entry>Does the access method support a scan without any constraint
440 for the first index column?</entry>
441 </row>
443 <row>
444 <entry><structfield>amindexnulls</structfield></entry>
445 <entry><type>bool</type></entry>
446 <entry></entry>
447 <entry>Does the access method support null index entries?</entry>
448 </row>
450 <row>
451 <entry><structfield>amsearchnulls</structfield></entry>
452 <entry><type>bool</type></entry>
453 <entry></entry>
454 <entry>Does the access method support IS NULL searches?</entry>
455 </row>
457 <row>
458 <entry><structfield>amstorage</structfield></entry>
459 <entry><type>bool</type></entry>
460 <entry></entry>
461 <entry>Can index storage data type differ from column data type?</entry>
462 </row>
464 <row>
465 <entry><structfield>amclusterable</structfield></entry>
466 <entry><type>bool</type></entry>
467 <entry></entry>
468 <entry>Can an index of this type be clustered on?</entry>
469 </row>
471 <row>
472 <entry><structfield>amkeytype</structfield></entry>
473 <entry><type>oid</type></entry>
474 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
475 <entry>Type of data stored in index, or zero if not a fixed type</entry>
476 </row>
478 <row>
479 <entry><structfield>aminsert</structfield></entry>
480 <entry><type>regproc</type></entry>
481 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
482 <entry><quote>Insert this tuple</quote> function</entry>
483 </row>
485 <row>
486 <entry><structfield>ambeginscan</structfield></entry>
487 <entry><type>regproc</type></entry>
488 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
489 <entry><quote>Start new scan</quote> function</entry>
490 </row>
492 <row>
493 <entry><structfield>amgettuple</structfield></entry>
494 <entry><type>regproc</type></entry>
495 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
496 <entry><quote>Next valid tuple</quote> function</entry>
497 </row>
499 <row>
500 <entry><structfield>amgetbitmap</structfield></entry>
501 <entry><type>regproc</type></entry>
502 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
503 <entry><quote>Fetch all valid tuples</quote> function</entry>
504 </row>
506 <row>
507 <entry><structfield>amrescan</structfield></entry>
508 <entry><type>regproc</type></entry>
509 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
510 <entry><quote>Restart this scan</quote> function</entry>
511 </row>
513 <row>
514 <entry><structfield>amendscan</structfield></entry>
515 <entry><type>regproc</type></entry>
516 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
517 <entry><quote>End this scan</quote> function</entry>
518 </row>
520 <row>
521 <entry><structfield>ammarkpos</structfield></entry>
522 <entry><type>regproc</type></entry>
523 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
524 <entry><quote>Mark current scan position</quote> function</entry>
525 </row>
527 <row>
528 <entry><structfield>amrestrpos</structfield></entry>
529 <entry><type>regproc</type></entry>
530 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
531 <entry><quote>Restore marked scan position</quote> function</entry>
532 </row>
534 <row>
535 <entry><structfield>ambuild</structfield></entry>
536 <entry><type>regproc</type></entry>
537 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
538 <entry><quote>Build new index</quote> function</entry>
539 </row>
541 <row>
542 <entry><structfield>ambulkdelete</structfield></entry>
543 <entry><type>regproc</type></entry>
544 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
545 <entry>Bulk-delete function</entry>
546 </row>
548 <row>
549 <entry><structfield>amvacuumcleanup</structfield></entry>
550 <entry><type>regproc</type></entry>
551 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
552 <entry>Post-<command>VACUUM</command> cleanup function</entry>
553 </row>
555 <row>
556 <entry><structfield>amcostestimate</structfield></entry>
557 <entry><type>regproc</type></entry>
558 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
559 <entry>Function to estimate cost of an index scan</entry>
560 </row>
562 <row>
563 <entry><structfield>amoptions</structfield></entry>
564 <entry><type>regproc</type></entry>
565 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
566 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
567 </row>
569 </tbody>
570 </tgroup>
571 </table>
573 </sect1>
576 <sect1 id="catalog-pg-amop">
577 <title><structname>pg_amop</structname></title>
579 <indexterm zone="catalog-pg-amop">
580 <primary>pg_amop</primary>
581 </indexterm>
583 <para>
584 The catalog <structname>pg_amop</structname> stores information about
585 operators associated with access method operator families. There is one
586 row for each operator that is a member of an operator family. An operator
587 can appear in more than one family, but cannot appear in more than one
588 position within a family.
589 </para>
591 <table>
592 <title><structname>pg_amop</> Columns</title>
594 <tgroup cols="4">
595 <thead>
596 <row>
597 <entry>Name</entry>
598 <entry>Type</entry>
599 <entry>References</entry>
600 <entry>Description</entry>
601 </row>
602 </thead>
603 <tbody>
605 <row>
606 <entry><structfield>amopfamily</structfield></entry>
607 <entry><type>oid</type></entry>
608 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
609 <entry>The operator family this entry is for</entry>
610 </row>
612 <row>
613 <entry><structfield>amoplefttype</structfield></entry>
614 <entry><type>oid</type></entry>
615 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
616 <entry>Left-hand input data type of operator</entry>
617 </row>
619 <row>
620 <entry><structfield>amoprighttype</structfield></entry>
621 <entry><type>oid</type></entry>
622 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
623 <entry>Right-hand input data type of operator</entry>
624 </row>
626 <row>
627 <entry><structfield>amopstrategy</structfield></entry>
628 <entry><type>int2</type></entry>
629 <entry></entry>
630 <entry>Operator strategy number</entry>
631 </row>
633 <row>
634 <entry><structfield>amopopr</structfield></entry>
635 <entry><type>oid</type></entry>
636 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
637 <entry>OID of the operator</entry>
638 </row>
640 <row>
641 <entry><structfield>amopmethod</structfield></entry>
642 <entry><type>oid</type></entry>
643 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
644 <entry>Index access method operator family is for</entry>
645 </row>
647 </tbody>
648 </tgroup>
649 </table>
651 <para>
652 An entry's <structfield>amopmethod</> must match the
653 <structname>opfmethod</> of its containing operator family (including
654 <structfield>amopmethod</> here is an intentional denormalization of the
655 catalog structure for performance reasons). Also,
656 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
657 the <structfield>oprleft</> and <structfield>oprright</> fields of the
658 referenced <structname>pg_operator</> entry.
659 </para>
661 </sect1>
664 <sect1 id="catalog-pg-amproc">
665 <title><structname>pg_amproc</structname></title>
667 <indexterm zone="catalog-pg-amproc">
668 <primary>pg_amproc</primary>
669 </indexterm>
671 <para>
672 The catalog <structname>pg_amproc</structname> stores information about
673 support procedures associated with access method operator families. There
674 is one row for each support procedure belonging to an operator family.
675 </para>
677 <table>
678 <title><structname>pg_amproc</structname> Columns</title>
680 <tgroup cols="4">
681 <thead>
682 <row>
683 <entry>Name</entry>
684 <entry>Type</entry>
685 <entry>References</entry>
686 <entry>Description</entry>
687 </row>
688 </thead>
689 <tbody>
691 <row>
692 <entry><structfield>amprocfamily</structfield></entry>
693 <entry><type>oid</type></entry>
694 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
695 <entry>The operator family this entry is for</entry>
696 </row>
698 <row>
699 <entry><structfield>amproclefttype</structfield></entry>
700 <entry><type>oid</type></entry>
701 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
702 <entry>Left-hand input data type of associated operator</entry>
703 </row>
705 <row>
706 <entry><structfield>amprocrighttype</structfield></entry>
707 <entry><type>oid</type></entry>
708 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
709 <entry>Right-hand input data type of associated operator</entry>
710 </row>
712 <row>
713 <entry><structfield>amprocnum</structfield></entry>
714 <entry><type>int2</type></entry>
715 <entry></entry>
716 <entry>Support procedure number</entry>
717 </row>
719 <row>
720 <entry><structfield>amproc</structfield></entry>
721 <entry><type>regproc</type></entry>
722 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
723 <entry>OID of the procedure</entry>
724 </row>
726 </tbody>
727 </tgroup>
728 </table>
730 <para>
731 The usual interpretation of the
732 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
733 is that they identify the left and right input types of the operator(s)
734 that a particular support procedure supports. For some access methods
735 these match the input data type(s) of the support procedure itself, for
736 others not. There is a notion of <quote>default</> support procedures for
737 an index, which are those with <structfield>amproclefttype</> and
738 <structfield>amprocrighttype</> both equal to the index opclass's
739 <structfield>opcintype</>.
740 </para>
742 </sect1>
745 <sect1 id="catalog-pg-attrdef">
746 <title><structname>pg_attrdef</structname></title>
748 <indexterm zone="catalog-pg-attrdef">
749 <primary>pg_attrdef</primary>
750 </indexterm>
752 <para>
753 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
754 about columns is stored in <structname>pg_attribute</structname>
755 (see below). Only columns that explicitly specify a default value
756 (when the table is created or the column is added) will have an
757 entry here.
758 </para>
760 <table>
761 <title><structname>pg_attrdef</> Columns</title>
763 <tgroup cols="4">
764 <thead>
765 <row>
766 <entry>Name</entry>
767 <entry>Type</entry>
768 <entry>References</entry>
769 <entry>Description</entry>
770 </row>
771 </thead>
773 <tbody>
774 <row>
775 <entry><structfield>adrelid</structfield></entry>
776 <entry><type>oid</type></entry>
777 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
778 <entry>The table this column belongs to</entry>
779 </row>
781 <row>
782 <entry><structfield>adnum</structfield></entry>
783 <entry><type>int2</type></entry>
784 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
785 <entry>The number of the column</entry>
786 </row>
788 <row>
789 <entry><structfield>adbin</structfield></entry>
790 <entry><type>text</type></entry>
791 <entry></entry>
792 <entry>The internal representation of the column default value</entry>
793 </row>
795 <row>
796 <entry><structfield>adsrc</structfield></entry>
797 <entry><type>text</type></entry>
798 <entry></entry>
799 <entry>A human-readable representation of the default value</entry>
800 </row>
801 </tbody>
802 </tgroup>
803 </table>
805 <para>
806 The <structfield>adsrc</structfield> field is historical, and is best
807 not used, because it does not track outside changes that might affect
808 the representation of the default value. Reverse-compiling the
809 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
810 example) is a better way to display the default value.
811 </para>
813 </sect1>
816 <sect1 id="catalog-pg-attribute">
817 <title><structname>pg_attribute</structname></title>
819 <indexterm zone="catalog-pg-attribute">
820 <primary>pg_attribute</primary>
821 </indexterm>
823 <para>
824 The catalog <structname>pg_attribute</structname> stores information about
825 table columns. There will be exactly one
826 <structname>pg_attribute</structname> row for every column in every
827 table in the database. (There will also be attribute entries for
828 indexes, and indeed all objects that have <structname>pg_class</structname>
829 entries.)
830 </para>
832 <para>
833 The term attribute is equivalent to column and is used for
834 historical reasons.
835 </para>
837 <table>
838 <title><structname>pg_attribute</> Columns</title>
840 <tgroup cols="4">
841 <thead>
842 <row>
843 <entry>Name</entry>
844 <entry>Type</entry>
845 <entry>References</entry>
846 <entry>Description</entry>
847 </row>
848 </thead>
850 <tbody>
851 <row>
852 <entry><structfield>attrelid</structfield></entry>
853 <entry><type>oid</type></entry>
854 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
855 <entry>The table this column belongs to</entry>
856 </row>
858 <row>
859 <entry><structfield>attname</structfield></entry>
860 <entry><type>name</type></entry>
861 <entry></entry>
862 <entry>The column name</entry>
863 </row>
865 <row>
866 <entry><structfield>atttypid</structfield></entry>
867 <entry><type>oid</type></entry>
868 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
869 <entry>The data type of this column</entry>
870 </row>
872 <row>
873 <entry><structfield>attstattarget</structfield></entry>
874 <entry><type>int4</type></entry>
875 <entry></entry>
876 <entry>
877 <structfield>attstattarget</structfield> controls the level of detail
878 of statistics accumulated for this column by
879 <xref linkend="sql-analyze" endterm="sql-analyze-title">.
880 A zero value indicates that no statistics should be collected.
881 A negative value says to use the system default statistics target.
882 The exact meaning of positive values is data type-dependent.
883 For scalar data types, <structfield>attstattarget</structfield>
884 is both the target number of <quote>most common values</quote>
885 to collect, and the target number of histogram bins to create
886 </entry>
887 </row>
889 <row>
890 <entry><structfield>attlen</structfield></entry>
891 <entry><type>int2</type></entry>
892 <entry></entry>
893 <entry>
894 A copy of <literal>pg_type.typlen</literal> of this column's
895 type
896 </entry>
897 </row>
899 <row>
900 <entry><structfield>attnum</structfield></entry>
901 <entry><type>int2</type></entry>
902 <entry></entry>
903 <entry>
904 The number of the column. Ordinary columns are numbered from 1
905 up. System columns, such as <structfield>oid</structfield>,
906 have (arbitrary) negative numbers
907 </entry>
908 </row>
910 <row>
911 <entry><structfield>attndims</structfield></entry>
912 <entry><type>int4</type></entry>
913 <entry></entry>
914 <entry>
915 Number of dimensions, if the column is an array type; otherwise 0.
916 (Presently, the number of dimensions of an array is not enforced,
917 so any nonzero value effectively means <quote>it's an array</>)
918 </entry>
919 </row>
921 <row>
922 <entry><structfield>attcacheoff</structfield></entry>
923 <entry><type>int4</type></entry>
924 <entry></entry>
925 <entry>
926 Always -1 in storage, but when loaded into a row descriptor
927 in memory this might be updated to cache the offset of the attribute
928 within the row
929 </entry>
930 </row>
932 <row>
933 <entry><structfield>atttypmod</structfield></entry>
934 <entry><type>int4</type></entry>
935 <entry></entry>
936 <entry>
937 <structfield>atttypmod</structfield> records type-specific data
938 supplied at table creation time (for example, the maximum
939 length of a <type>varchar</type> column). It is passed to
940 type-specific input functions and length coercion functions.
941 The value will generally be -1 for types that do not need <structfield>atttypmod</>
942 </entry>
943 </row>
945 <row>
946 <entry><structfield>attbyval</structfield></entry>
947 <entry><type>bool</type></entry>
948 <entry></entry>
949 <entry>
950 A copy of <literal>pg_type.typbyval</> of this column's type
951 </entry>
952 </row>
954 <row>
955 <entry><structfield>attstorage</structfield></entry>
956 <entry><type>char</type></entry>
957 <entry></entry>
958 <entry>
959 Normally a copy of <literal>pg_type.typstorage</> of this
960 column's type. For TOAST-able data types, this can be altered
961 after column creation to control storage policy
962 </entry>
963 </row>
965 <row>
966 <entry><structfield>attalign</structfield></entry>
967 <entry><type>char</type></entry>
968 <entry></entry>
969 <entry>
970 A copy of <literal>pg_type.typalign</> of this column's type
971 </entry>
972 </row>
974 <row>
975 <entry><structfield>attnotnull</structfield></entry>
976 <entry><type>bool</type></entry>
977 <entry></entry>
978 <entry>
979 This represents a not-null constraint. It is possible to
980 change this column to enable or disable the constraint
981 </entry>
982 </row>
984 <row>
985 <entry><structfield>atthasdef</structfield></entry>
986 <entry><type>bool</type></entry>
987 <entry></entry>
988 <entry>
989 This column has a default value, in which case there will be a
990 corresponding entry in the <structname>pg_attrdef</structname>
991 catalog that actually defines the value
992 </entry>
993 </row>
995 <row>
996 <entry><structfield>attisdropped</structfield></entry>
997 <entry><type>bool</type></entry>
998 <entry></entry>
999 <entry>
1000 This column has been dropped and is no longer valid. A dropped
1001 column is still physically present in the table, but is
1002 ignored by the parser and so cannot be accessed via SQL
1003 </entry>
1004 </row>
1006 <row>
1007 <entry><structfield>attislocal</structfield></entry>
1008 <entry><type>bool</type></entry>
1009 <entry></entry>
1010 <entry>
1011 This column is defined locally in the relation. Note that a column can
1012 be locally defined and inherited simultaneously
1013 </entry>
1014 </row>
1016 <row>
1017 <entry><structfield>attinhcount</structfield></entry>
1018 <entry><type>int4</type></entry>
1019 <entry></entry>
1020 <entry>
1021 The number of direct ancestors this column has. A column with a
1022 nonzero number of ancestors cannot be dropped nor renamed
1023 </entry>
1024 </row>
1026 <row>
1027 <entry><structfield>attacl</structfield></entry>
1028 <entry><type>aclitem[]</type></entry>
1029 <entry></entry>
1030 <entry>
1031 Column-level access privileges, if any have been granted specifically
1032 on this column
1033 </entry>
1034 </row>
1036 </tbody>
1037 </tgroup>
1038 </table>
1040 <para>
1041 In a dropped column's <structname>pg_attribute</structname> entry,
1042 <structfield>atttypid</structfield> is reset to zero, but
1043 <structfield>attlen</structfield> and the other fields copied from
1044 <structname>pg_type</> are still valid. This arrangement is needed
1045 to cope with the situation where the dropped column's data type was
1046 later dropped, and so there is no <structname>pg_type</> row anymore.
1047 <structfield>attlen</structfield> and the other fields can be used
1048 to interpret the contents of a row of the table.
1049 </para>
1050 </sect1>
1053 <sect1 id="catalog-pg-authid">
1054 <title><structname>pg_authid</structname></title>
1056 <indexterm zone="catalog-pg-authid">
1057 <primary>pg_authid</primary>
1058 </indexterm>
1060 <para>
1061 The catalog <structname>pg_authid</structname> contains information about
1062 database authorization identifiers (roles). A role subsumes the concepts
1063 of <quote>users</> and <quote>groups</>. A user is essentially just a
1064 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1065 without <structfield>rolcanlogin</>) can have other roles as members; see
1066 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1067 </para>
1069 <para>
1070 Since this catalog contains passwords, it must not be publicly readable.
1071 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1072 is a publicly readable view on
1073 <structname>pg_authid</structname> that blanks out the password field.
1074 </para>
1076 <para>
1077 <xref linkend="user-manag"> contains detailed information about user and
1078 privilege management.
1079 </para>
1081 <para>
1082 Because user identities are cluster-wide,
1083 <structname>pg_authid</structname>
1084 is shared across all databases of a cluster: there is only one
1085 copy of <structname>pg_authid</structname> per cluster, not
1086 one per database.
1087 </para>
1089 <table>
1090 <title><structname>pg_authid</> Columns</title>
1092 <tgroup cols="3">
1093 <thead>
1094 <row>
1095 <entry>Name</entry>
1096 <entry>Type</entry>
1097 <entry>Description</entry>
1098 </row>
1099 </thead>
1101 <tbody>
1102 <row>
1103 <entry><structfield>rolname</structfield></entry>
1104 <entry><type>name</type></entry>
1105 <entry>Role name</entry>
1106 </row>
1108 <row>
1109 <entry><structfield>rolsuper</structfield></entry>
1110 <entry><type>bool</type></entry>
1111 <entry>Role has superuser privileges</entry>
1112 </row>
1114 <row>
1115 <entry><structfield>rolinherit</structfield></entry>
1116 <entry><type>bool</type></entry>
1117 <entry>Role automatically inherits privileges of roles it is a
1118 member of</entry>
1119 </row>
1121 <row>
1122 <entry><structfield>rolcreaterole</structfield></entry>
1123 <entry><type>bool</type></entry>
1124 <entry>Role can create more roles</entry>
1125 </row>
1127 <row>
1128 <entry><structfield>rolcreatedb</structfield></entry>
1129 <entry><type>bool</type></entry>
1130 <entry>Role can create databases</entry>
1131 </row>
1133 <row>
1134 <entry><structfield>rolcatupdate</structfield></entry>
1135 <entry><type>bool</type></entry>
1136 <entry>
1137 Role can update system catalogs directly. (Even a superuser cannot do
1138 this unless this column is true)
1139 </entry>
1140 </row>
1142 <row>
1143 <entry><structfield>rolcanlogin</structfield></entry>
1144 <entry><type>bool</type></entry>
1145 <entry>
1146 Role can log in. That is, this role can be given as the initial
1147 session authorization identifier
1148 </entry>
1149 </row>
1151 <row>
1152 <entry><structfield>rolconnlimit</structfield></entry>
1153 <entry><type>int4</type></entry>
1154 <entry>
1155 For roles that can log in, this sets maximum number of concurrent
1156 connections this role can make. -1 means no limit
1157 </entry>
1158 </row>
1160 <row>
1161 <entry><structfield>rolpassword</structfield></entry>
1162 <entry><type>text</type></entry>
1163 <entry>Password (possibly encrypted); NULL if none</entry>
1164 </row>
1166 <row>
1167 <entry><structfield>rolvaliduntil</structfield></entry>
1168 <entry><type>timestamptz</type></entry>
1169 <entry>Password expiry time (only used for password authentication);
1170 NULL if no expiration</entry>
1171 </row>
1173 <row>
1174 <entry><structfield>rolconfig</structfield></entry>
1175 <entry><type>text[]</type></entry>
1176 <entry>Session defaults for run-time configuration variables</entry>
1177 </row>
1178 </tbody>
1179 </tgroup>
1180 </table>
1182 </sect1>
1185 <sect1 id="catalog-pg-auth-members">
1186 <title><structname>pg_auth_members</structname></title>
1188 <indexterm zone="catalog-pg-auth-members">
1189 <primary>pg_auth_members</primary>
1190 </indexterm>
1192 <para>
1193 The catalog <structname>pg_auth_members</structname> shows the membership
1194 relations between roles. Any non-circular set of relationships is allowed.
1195 </para>
1197 <para>
1198 Because user identities are cluster-wide,
1199 <structname>pg_auth_members</structname>
1200 is shared across all databases of a cluster: there is only one
1201 copy of <structname>pg_auth_members</structname> per cluster, not
1202 one per database.
1203 </para>
1205 <table>
1206 <title><structname>pg_auth_members</> Columns</title>
1208 <tgroup cols="4">
1209 <thead>
1210 <row>
1211 <entry>Name</entry>
1212 <entry>Type</entry>
1213 <entry>References</entry>
1214 <entry>Description</entry>
1215 </row>
1216 </thead>
1218 <tbody>
1219 <row>
1220 <entry><structfield>roleid</structfield></entry>
1221 <entry><type>oid</type></entry>
1222 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1223 <entry>ID of a role that has a member</entry>
1224 </row>
1226 <row>
1227 <entry><structfield>member</structfield></entry>
1228 <entry><type>oid</type></entry>
1229 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1230 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1231 </row>
1233 <row>
1234 <entry><structfield>grantor</structfield></entry>
1235 <entry><type>oid</type></entry>
1236 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1237 <entry>ID of the role that granted this membership</entry>
1238 </row>
1240 <row>
1241 <entry><structfield>admin_option</structfield></entry>
1242 <entry><type>bool</type></entry>
1243 <entry></entry>
1244 <entry>True if <structfield>member</> can grant membership in
1245 <structfield>roleid</> to others</entry>
1246 </row>
1247 </tbody>
1248 </tgroup>
1249 </table>
1251 </sect1>
1254 <sect1 id="catalog-pg-cast">
1255 <title><structname>pg_cast</structname></title>
1257 <indexterm zone="catalog-pg-cast">
1258 <primary>pg_cast</primary>
1259 </indexterm>
1261 <para>
1262 The catalog <structname>pg_cast</structname> stores data type conversion
1263 paths, both built-in paths and those defined with
1264 <xref linkend="sql-createcast" endterm="sql-createcast-title">.
1265 </para>
1267 <para>
1268 It should be noted that <structname>pg_cast</structname> does not represent
1269 every type conversion that the system knows how to perform; only those that
1270 cannot be deduced from some generic rule. For example, casting between a
1271 domain and its base type is not explicitly represented in
1272 <structname>pg_cast</structname>. Another important exception is that
1273 <quote>automatic I/O conversion casts</>, those performed using a data
1274 type's own I/O functions to convert to or from <type>text</> or other
1275 string types, are not explicitly represented in
1276 <structname>pg_cast</structname>.
1277 </para>
1279 <table>
1280 <title><structname>pg_cast</> Columns</title>
1282 <tgroup cols="4">
1283 <thead>
1284 <row>
1285 <entry>Name</entry>
1286 <entry>Type</entry>
1287 <entry>References</entry>
1288 <entry>Description</entry>
1289 </row>
1290 </thead>
1292 <tbody>
1293 <row>
1294 <entry><structfield>castsource</structfield></entry>
1295 <entry><type>oid</type></entry>
1296 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1297 <entry>OID of the source data type</entry>
1298 </row>
1300 <row>
1301 <entry><structfield>casttarget</structfield></entry>
1302 <entry><type>oid</type></entry>
1303 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1304 <entry>OID of the target data type</entry>
1305 </row>
1307 <row>
1308 <entry><structfield>castfunc</structfield></entry>
1309 <entry><type>oid</type></entry>
1310 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1311 <entry>
1312 The OID of the function to use to perform this cast. Zero is
1313 stored if the cast method doesn't require a function.
1314 </entry>
1315 </row>
1317 <row>
1318 <entry><structfield>castcontext</structfield></entry>
1319 <entry><type>char</type></entry>
1320 <entry></entry>
1321 <entry>
1322 Indicates what contexts the cast can be invoked in.
1323 <literal>e</> means only as an explicit cast (using
1324 <literal>CAST</> or <literal>::</> syntax).
1325 <literal>a</> means implicitly in assignment
1326 to a target column, as well as explicitly.
1327 <literal>i</> means implicitly in expressions, as well as the
1328 other cases
1329 </entry>
1330 </row>
1331 <row>
1332 <entry><structfield>castmethod</structfield></entry>
1333 <entry><type>char</type></entry>
1334 <entry></entry>
1335 <entry>
1336 Indicates how the cast is performed.
1337 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1338 <literal>i</> means that the input/output functions are used.
1339 <literal>b</> means that the types are binary-coercible, thus no conversion is required
1340 </entry>
1341 </row>
1342 </tbody>
1343 </tgroup>
1344 </table>
1346 <para>
1347 The cast functions listed in <structname>pg_cast</structname> must
1348 always take the cast source type as their first argument type, and
1349 return the cast destination type as their result type. A cast
1350 function can have up to three arguments. The second argument,
1351 if present, must be type <type>integer</>; it receives the type
1352 modifier associated with the destination type, or <literal>-1</>
1353 if there is none. The third argument,
1354 if present, must be type <type>boolean</>; it receives <literal>true</>
1355 if the cast is an explicit cast, <literal>false</> otherwise.
1356 </para>
1358 <para>
1359 It is legitimate to create a <structname>pg_cast</structname> entry
1360 in which the source and target types are the same, if the associated
1361 function takes more than one argument. Such entries represent
1362 <quote>length coercion functions</> that coerce values of the type
1363 to be legal for a particular type modifier value.
1364 </para>
1366 <para>
1367 When a <structname>pg_cast</structname> entry has different source and
1368 target types and a function that takes more than one argument, it
1369 represents converting from one type to another and applying a length
1370 coercion in a single step. When no such entry is available, coercion
1371 to a type that uses a type modifier involves two steps, one to
1372 convert between data types and a second to apply the modifier.
1373 </para>
1374 </sect1>
1376 <sect1 id="catalog-pg-class">
1377 <title><structname>pg_class</structname></title>
1379 <indexterm zone="catalog-pg-class">
1380 <primary>pg_class</primary>
1381 </indexterm>
1383 <para>
1384 The catalog <structname>pg_class</structname> catalogs tables and most
1385 everything else that has columns or is otherwise similar to a
1386 table. This includes indexes (but see also
1387 <structname>pg_index</structname>), sequences, views, composite types,
1388 and TOAST tables; see <structfield>relkind</>.
1389 Below, when we mean all of these
1390 kinds of objects we speak of <quote>relations</quote>. Not all
1391 columns are meaningful for all relation types.
1392 </para>
1394 <table>
1395 <title><structname>pg_class</> Columns</title>
1397 <tgroup cols="4">
1398 <thead>
1399 <row>
1400 <entry>Name</entry>
1401 <entry>Type</entry>
1402 <entry>References</entry>
1403 <entry>Description</entry>
1404 </row>
1405 </thead>
1407 <tbody>
1408 <row>
1409 <entry><structfield>relname</structfield></entry>
1410 <entry><type>name</type></entry>
1411 <entry></entry>
1412 <entry>Name of the table, index, view, etc.</entry>
1413 </row>
1415 <row>
1416 <entry><structfield>relnamespace</structfield></entry>
1417 <entry><type>oid</type></entry>
1418 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1419 <entry>
1420 The OID of the namespace that contains this relation
1421 </entry>
1422 </row>
1424 <row>
1425 <entry><structfield>reltype</structfield></entry>
1426 <entry><type>oid</type></entry>
1427 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1428 <entry>
1429 The OID of the data type that corresponds to this table's row type,
1430 if any (zero for indexes, which have no <structname>pg_type</> entry)
1431 </entry>
1432 </row>
1434 <row>
1435 <entry><structfield>relowner</structfield></entry>
1436 <entry><type>oid</type></entry>
1437 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1438 <entry>Owner of the relation</entry>
1439 </row>
1441 <row>
1442 <entry><structfield>relam</structfield></entry>
1443 <entry><type>oid</type></entry>
1444 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1445 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1446 </row>
1448 <row>
1449 <entry><structfield>relfilenode</structfield></entry>
1450 <entry><type>oid</type></entry>
1451 <entry></entry>
1452 <entry>Name of the on-disk file of this relation; 0 if none</entry>
1453 </row>
1455 <row>
1456 <entry><structfield>reltablespace</structfield></entry>
1457 <entry><type>oid</type></entry>
1458 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1459 <entry>
1460 The tablespace in which this relation is stored. If zero,
1461 the database's default tablespace is implied. (Not meaningful
1462 if the relation has no on-disk file.)
1463 </entry>
1464 </row>
1466 <row>
1467 <entry><structfield>relpages</structfield></entry>
1468 <entry><type>int4</type></entry>
1469 <entry></entry>
1470 <entry>
1471 Size of the on-disk representation of this table in pages (of size
1472 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1473 planner. It is updated by <command>VACUUM</command>,
1474 <command>ANALYZE</command>, and a few DDL commands such as
1475 <command>CREATE INDEX</command>
1476 </entry>
1477 </row>
1479 <row>
1480 <entry><structfield>reltuples</structfield></entry>
1481 <entry><type>float4</type></entry>
1482 <entry></entry>
1483 <entry>
1484 Number of rows in the table. This is only an estimate used by the
1485 planner. It is updated by <command>VACUUM</command>,
1486 <command>ANALYZE</command>, and a few DDL commands such as
1487 <command>CREATE INDEX</command>
1488 </entry>
1489 </row>
1491 <row>
1492 <entry><structfield>reltoastrelid</structfield></entry>
1493 <entry><type>oid</type></entry>
1494 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1495 <entry>
1496 OID of the TOAST table associated with this table, 0 if none. The
1497 TOAST table stores large attributes <quote>out of line</quote> in a
1498 secondary table
1499 </entry>
1500 </row>
1502 <row>
1503 <entry><structfield>reltoastidxid</structfield></entry>
1504 <entry><type>oid</type></entry>
1505 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1506 <entry>
1507 For a TOAST table, the OID of its index. 0 if not a TOAST table
1508 </entry>
1509 </row>
1511 <row>
1512 <entry><structfield>relhasindex</structfield></entry>
1513 <entry><type>bool</type></entry>
1514 <entry></entry>
1515 <entry>
1516 True if this is a table and it has (or recently had) any
1517 indexes. This is set by <command>CREATE INDEX</command>, but
1518 not cleared immediately by <command>DROP INDEX</command>.
1519 <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the
1520 table has no indexes
1521 </entry>
1522 </row>
1524 <row>
1525 <entry><structfield>relisshared</structfield></entry>
1526 <entry><type>bool</type></entry>
1527 <entry></entry>
1528 <entry>
1529 True if this table is shared across all databases in the cluster. Only
1530 certain system catalogs (such as <structname>pg_database</structname>)
1531 are shared
1532 </entry>
1533 </row>
1535 <row>
1536 <entry><structfield>relkind</structfield></entry>
1537 <entry><type>char</type></entry>
1538 <entry></entry>
1539 <entry>
1540 <literal>r</> = ordinary table, <literal>i</> = index,
1541 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1542 composite type, <literal>t</> = TOAST
1543 table
1544 </entry>
1545 </row>
1547 <row>
1548 <entry><structfield>relnatts</structfield></entry>
1549 <entry><type>int2</type></entry>
1550 <entry></entry>
1551 <entry>
1552 Number of user columns in the relation (system columns not
1553 counted). There must be this many corresponding entries in
1554 <structname>pg_attribute</structname>. See also
1555 <literal>pg_attribute.attnum</literal>
1556 </entry>
1557 </row>
1559 <row>
1560 <entry><structfield>relchecks</structfield></entry>
1561 <entry><type>int2</type></entry>
1562 <entry></entry>
1563 <entry>
1564 Number of <literal>CHECK</> constraints on the table; see
1565 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1566 </entry>
1567 </row>
1569 <row>
1570 <entry><structfield>relhasoids</structfield></entry>
1571 <entry><type>bool</type></entry>
1572 <entry></entry>
1573 <entry>
1574 True if we generate an OID for each row of the relation
1575 </entry>
1576 </row>
1578 <row>
1579 <entry><structfield>relhaspkey</structfield></entry>
1580 <entry><type>bool</type></entry>
1581 <entry></entry>
1582 <entry>
1583 True if the table has (or once had) a primary key
1584 </entry>
1585 </row>
1587 <row>
1588 <entry><structfield>relhasrules</structfield></entry>
1589 <entry><type>bool</type></entry>
1590 <entry></entry>
1591 <entry>
1592 True if table has (or once had) rules; see
1593 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1594 </entry>
1595 </row>
1597 <row>
1598 <entry><structfield>relhastriggers</structfield></entry>
1599 <entry><type>bool</type></entry>
1600 <entry></entry>
1601 <entry>
1602 True if table has (or once had) triggers; see
1603 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1604 </entry>
1605 </row>
1607 <row>
1608 <entry><structfield>relhassubclass</structfield></entry>
1609 <entry><type>bool</type></entry>
1610 <entry></entry>
1611 <entry>True if table has (or once had) any inheritance children</entry>
1612 </row>
1614 <row>
1615 <entry><structfield>relfrozenxid</structfield></entry>
1616 <entry><type>xid</type></entry>
1617 <entry></entry>
1618 <entry>
1619 All transaction IDs before this one have been replaced with a permanent
1620 (<quote>frozen</>) transaction ID in this table. This is used to track
1621 whether the table needs to be vacuumed in order to prevent transaction
1622 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1623 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table
1624 </entry>
1625 </row>
1627 <row>
1628 <entry><structfield>relacl</structfield></entry>
1629 <entry><type>aclitem[]</type></entry>
1630 <entry></entry>
1631 <entry>
1632 Access privileges; see
1633 <xref linkend="sql-grant" endterm="sql-grant-title"> and
1634 <xref linkend="sql-revoke" endterm="sql-revoke-title">
1635 for details
1636 </entry>
1637 </row>
1639 <row>
1640 <entry><structfield>reloptions</structfield></entry>
1641 <entry><type>text[]</type></entry>
1642 <entry></entry>
1643 <entry>
1644 Access-method-specific options, as <quote>keyword=value</> strings
1645 </entry>
1646 </row>
1647 </tbody>
1648 </tgroup>
1649 </table>
1650 </sect1>
1652 <sect1 id="catalog-pg-constraint">
1653 <title><structname>pg_constraint</structname></title>
1655 <indexterm zone="catalog-pg-constraint">
1656 <primary>pg_constraint</primary>
1657 </indexterm>
1659 <para>
1660 The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
1661 key constraints on tables. (Column constraints are not treated
1662 specially. Every column constraint is equivalent to some table
1663 constraint.) Not-null constraints are represented in the
1664 <structname>pg_attribute</> catalog.
1665 </para>
1667 <para>
1668 Check constraints on domains are stored here, too.
1669 </para>
1671 <table>
1672 <title><structname>pg_constraint</> Columns</title>
1674 <tgroup cols="4">
1675 <thead>
1676 <row>
1677 <entry>Name</entry>
1678 <entry>Type</entry>
1679 <entry>References</entry>
1680 <entry>Description</entry>
1681 </row>
1682 </thead>
1684 <tbody>
1685 <row>
1686 <entry><structfield>conname</structfield></entry>
1687 <entry><type>name</type></entry>
1688 <entry></entry>
1689 <entry>Constraint name (not necessarily unique!)</entry>
1690 </row>
1692 <row>
1693 <entry><structfield>connamespace</structfield></entry>
1694 <entry><type>oid</type></entry>
1695 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1696 <entry>
1697 The OID of the namespace that contains this constraint
1698 </entry>
1699 </row>
1701 <row>
1702 <entry><structfield>contype</structfield></entry>
1703 <entry><type>char</type></entry>
1704 <entry></entry>
1705 <entry>
1706 <literal>c</> = check constraint,
1707 <literal>f</> = foreign key constraint,
1708 <literal>p</> = primary key constraint,
1709 <literal>u</> = unique constraint
1710 </entry>
1711 </row>
1713 <row>
1714 <entry><structfield>condeferrable</structfield></entry>
1715 <entry><type>bool</type></entry>
1716 <entry></entry>
1717 <entry>Is the constraint deferrable?</entry>
1718 </row>
1720 <row>
1721 <entry><structfield>condeferred</structfield></entry>
1722 <entry><type>bool</type></entry>
1723 <entry></entry>
1724 <entry>Is the constraint deferred by default?</entry>
1725 </row>
1727 <row>
1728 <entry><structfield>conrelid</structfield></entry>
1729 <entry><type>oid</type></entry>
1730 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1731 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1732 </row>
1734 <row>
1735 <entry><structfield>contypid</structfield></entry>
1736 <entry><type>oid</type></entry>
1737 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1738 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1739 </row>
1741 <row>
1742 <entry><structfield>confrelid</structfield></entry>
1743 <entry><type>oid</type></entry>
1744 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1745 <entry>If a foreign key, the referenced table; else 0</entry>
1746 </row>
1748 <row>
1749 <entry><structfield>confupdtype</structfield></entry>
1750 <entry><type>char</type></entry>
1751 <entry></entry>
1752 <entry>Foreign key update action code:
1753 <literal>a</> = no action,
1754 <literal>r</> = restrict,
1755 <literal>c</> = cascade,
1756 <literal>n</> = set null,
1757 <literal>d</> = set default
1758 </entry>
1759 </row>
1761 <row>
1762 <entry><structfield>confdeltype</structfield></entry>
1763 <entry><type>char</type></entry>
1764 <entry></entry>
1765 <entry>Foreign key deletion action code:
1766 <literal>a</> = no action,
1767 <literal>r</> = restrict,
1768 <literal>c</> = cascade,
1769 <literal>n</> = set null,
1770 <literal>d</> = set default
1771 </entry>
1772 </row>
1774 <row>
1775 <entry><structfield>confmatchtype</structfield></entry>
1776 <entry><type>char</type></entry>
1777 <entry></entry>
1778 <entry>Foreign key match type:
1779 <literal>f</> = full,
1780 <literal>p</> = partial,
1781 <literal>u</> = simple (unspecified)
1782 </entry>
1783 </row>
1785 <row>
1786 <entry><structfield>conislocal</structfield></entry>
1787 <entry><type>bool</type></entry>
1788 <entry></entry>
1789 <entry>
1790 This constraint is defined locally in the relation. Note that a
1791 constraint can be locally defined and inherited simultaneously
1792 </entry>
1793 </row>
1795 <row>
1796 <entry><structfield>coninhcount</structfield></entry>
1797 <entry><type>int4</type></entry>
1798 <entry></entry>
1799 <entry>
1800 The number of direct ancestors this constraint has. A constraint with
1801 a nonzero number of ancestors cannot be dropped nor renamed
1802 </entry>
1803 </row>
1805 <row>
1806 <entry><structfield>conkey</structfield></entry>
1807 <entry><type>int2[]</type></entry>
1808 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1809 <entry>If a table constraint (including a foreign key), list of the constrained columns</entry>
1810 </row>
1812 <row>
1813 <entry><structfield>confkey</structfield></entry>
1814 <entry><type>int2[]</type></entry>
1815 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1816 <entry>If a foreign key, list of the referenced columns</entry>
1817 </row>
1819 <row>
1820 <entry><structfield>conpfeqop</structfield></entry>
1821 <entry><type>oid[]</type></entry>
1822 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1823 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
1824 </row>
1826 <row>
1827 <entry><structfield>conppeqop</structfield></entry>
1828 <entry><type>oid[]</type></entry>
1829 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1830 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
1831 </row>
1833 <row>
1834 <entry><structfield>conffeqop</structfield></entry>
1835 <entry><type>oid[]</type></entry>
1836 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1837 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
1838 </row>
1840 <row>
1841 <entry><structfield>conbin</structfield></entry>
1842 <entry><type>text</type></entry>
1843 <entry></entry>
1844 <entry>If a check constraint, an internal representation of the expression</entry>
1845 </row>
1847 <row>
1848 <entry><structfield>consrc</structfield></entry>
1849 <entry><type>text</type></entry>
1850 <entry></entry>
1851 <entry>If a check constraint, a human-readable representation of the expression</entry>
1852 </row>
1853 </tbody>
1854 </tgroup>
1855 </table>
1857 <note>
1858 <para>
1859 <structfield>consrc</structfield> is not updated when referenced objects
1860 change; for example, it won't track renaming of columns. Rather than
1861 relying on this field, it's best to use <function>pg_get_constraintdef()</>
1862 to extract the definition of a check constraint.
1863 </para>
1864 </note>
1866 <note>
1867 <para>
1868 <literal>pg_class.relchecks</literal> needs to agree with the
1869 number of check-constraint entries found in this table for each
1870 relation.
1871 </para>
1872 </note>
1874 </sect1>
1876 <sect1 id="catalog-pg-conversion">
1877 <title><structname>pg_conversion</structname></title>
1879 <indexterm zone="catalog-pg-conversion">
1880 <primary>pg_conversion</primary>
1881 </indexterm>
1883 <para>
1884 The catalog <structname>pg_conversion</structname> describes the
1885 available encoding conversion procedures. See
1886 <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
1887 for more information.
1888 </para>
1890 <table>
1891 <title><structname>pg_conversion</> Columns</title>
1893 <tgroup cols="4">
1894 <thead>
1895 <row>
1896 <entry>Name</entry>
1897 <entry>Type</entry>
1898 <entry>References</entry>
1899 <entry>Description</entry>
1900 </row>
1901 </thead>
1903 <tbody>
1904 <row>
1905 <entry><structfield>conname</structfield></entry>
1906 <entry><type>name</type></entry>
1907 <entry></entry>
1908 <entry>Conversion name (unique within a namespace)</entry>
1909 </row>
1911 <row>
1912 <entry><structfield>connamespace</structfield></entry>
1913 <entry><type>oid</type></entry>
1914 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1915 <entry>
1916 The OID of the namespace that contains this conversion
1917 </entry>
1918 </row>
1920 <row>
1921 <entry><structfield>conowner</structfield></entry>
1922 <entry><type>oid</type></entry>
1923 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1924 <entry>Owner of the conversion</entry>
1925 </row>
1927 <row>
1928 <entry><structfield>conforencoding</structfield></entry>
1929 <entry><type>int4</type></entry>
1930 <entry></entry>
1931 <entry>Source encoding ID</entry>
1932 </row>
1934 <row>
1935 <entry><structfield>contoencoding</structfield></entry>
1936 <entry><type>int4</type></entry>
1937 <entry></entry>
1938 <entry>Destination encoding ID</entry>
1939 </row>
1941 <row>
1942 <entry><structfield>conproc</structfield></entry>
1943 <entry><type>regproc</type></entry>
1944 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1945 <entry>Conversion procedure</entry>
1946 </row>
1948 <row>
1949 <entry><structfield>condefault</structfield></entry>
1950 <entry><type>bool</type></entry>
1951 <entry></entry>
1952 <entry>True if this is the default conversion</entry>
1953 </row>
1955 </tbody>
1956 </tgroup>
1957 </table>
1959 </sect1>
1961 <sect1 id="catalog-pg-database">
1962 <title><structname>pg_database</structname></title>
1964 <indexterm zone="catalog-pg-database">
1965 <primary>pg_database</primary>
1966 </indexterm>
1968 <para>
1969 The catalog <structname>pg_database</structname> stores information about
1970 the available databases. Databases are created with the <xref
1971 linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
1972 Consult <xref linkend="managing-databases"> for details about the meaning
1973 of some of the parameters.
1974 </para>
1976 <para>
1977 Unlike most system catalogs, <structname>pg_database</structname>
1978 is shared across all databases of a cluster: there is only one
1979 copy of <structname>pg_database</structname> per cluster, not
1980 one per database.
1981 </para>
1983 <table>
1984 <title><structname>pg_database</> Columns</title>
1986 <tgroup cols="4">
1987 <thead>
1988 <row>
1989 <entry>Name</entry>
1990 <entry>Type</entry>
1991 <entry>References</entry>
1992 <entry>Description</entry>
1993 </row>
1994 </thead>
1996 <tbody>
1997 <row>
1998 <entry><structfield>datname</structfield></entry>
1999 <entry><type>name</type></entry>
2000 <entry></entry>
2001 <entry>Database name</entry>
2002 </row>
2004 <row>
2005 <entry><structfield>datdba</structfield></entry>
2006 <entry><type>oid</type></entry>
2007 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2008 <entry>Owner of the database, usually the user who created it</entry>
2009 </row>
2011 <row>
2012 <entry><structfield>encoding</structfield></entry>
2013 <entry><type>int4</type></entry>
2014 <entry></entry>
2015 <entry>Character encoding for this database
2016 (<function>pg_encoding_to_char()</function> can translate
2017 this number to the encoding name)</entry>
2018 </row>
2020 <row>
2021 <entry><structfield>datcollate</structfield></entry>
2022 <entry><type>name</type></entry>
2023 <entry></entry>
2024 <entry>LC_COLLATE for this database</entry>
2025 </row>
2027 <row>
2028 <entry><structfield>datctype</structfield></entry>
2029 <entry><type>name</type></entry>
2030 <entry></entry>
2031 <entry>LC_CTYPE for this database</entry>
2032 </row>
2034 <row>
2035 <entry><structfield>datistemplate</structfield></entry>
2036 <entry><type>bool</type></entry>
2037 <entry></entry>
2038 <entry>
2039 If true then this database can be used in the
2040 <literal>TEMPLATE</literal> clause of <command>CREATE
2041 DATABASE</command> to create a new database as a clone of
2042 this one
2043 </entry>
2044 </row>
2046 <row>
2047 <entry><structfield>datallowconn</structfield></entry>
2048 <entry><type>bool</type></entry>
2049 <entry></entry>
2050 <entry>
2051 If false then no one can connect to this database. This is
2052 used to protect the <literal>template0</> database from being altered
2053 </entry>
2054 </row>
2056 <row>
2057 <entry><structfield>datconnlimit</structfield></entry>
2058 <entry><type>int4</type></entry>
2059 <entry></entry>
2060 <entry>
2061 Sets maximum number of concurrent connections that can be made
2062 to this database. -1 means no limit
2063 </entry>
2064 </row>
2066 <row>
2067 <entry><structfield>datlastsysoid</structfield></entry>
2068 <entry><type>oid</type></entry>
2069 <entry></entry>
2070 <entry>
2071 Last system OID in the database; useful
2072 particularly to <application>pg_dump</application>
2073 </entry>
2074 </row>
2076 <row>
2077 <entry><structfield>datfrozenxid</structfield></entry>
2078 <entry><type>xid</type></entry>
2079 <entry></entry>
2080 <entry>
2081 All transaction IDs before this one have been replaced with a permanent
2082 (<quote>frozen</>) transaction ID in this database. This is used to
2083 track whether the database needs to be vacuumed in order to prevent
2084 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2085 It is the minimum of the per-table
2086 <structname>pg_class</>.<structfield>relfrozenxid</> values
2087 </entry>
2088 </row>
2090 <row>
2091 <entry><structfield>dattablespace</structfield></entry>
2092 <entry><type>oid</type></entry>
2093 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2094 <entry>
2095 The default tablespace for the database.
2096 Within this database, all tables for which
2097 <structname>pg_class</>.<structfield>reltablespace</> is zero
2098 will be stored in this tablespace; in particular, all the non-shared
2099 system catalogs will be there
2100 </entry>
2101 </row>
2103 <row>
2104 <entry><structfield>datconfig</structfield></entry>
2105 <entry><type>text[]</type></entry>
2106 <entry></entry>
2107 <entry>Session defaults for run-time configuration variables</entry>
2108 </row>
2110 <row>
2111 <entry><structfield>datacl</structfield></entry>
2112 <entry><type>aclitem[]</type></entry>
2113 <entry></entry>
2114 <entry>
2115 Access privileges; see
2116 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2117 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2118 for details
2119 </entry>
2120 </row>
2121 </tbody>
2122 </tgroup>
2123 </table>
2124 </sect1>
2127 <sect1 id="catalog-pg-depend">
2128 <title><structname>pg_depend</structname></title>
2130 <indexterm zone="catalog-pg-depend">
2131 <primary>pg_depend</primary>
2132 </indexterm>
2134 <para>
2135 The catalog <structname>pg_depend</structname> records the dependency
2136 relationships between database objects. This information allows
2137 <command>DROP</> commands to find which other objects must be dropped
2138 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2139 RESTRICT</> case.
2140 </para>
2142 <para>
2143 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2144 which performs a similar function for dependencies involving objects
2145 that are shared across a database cluster.
2146 </para>
2148 <table>
2149 <title><structname>pg_depend</> Columns</title>
2151 <tgroup cols="4">
2152 <thead>
2153 <row>
2154 <entry>Name</entry>
2155 <entry>Type</entry>
2156 <entry>References</entry>
2157 <entry>Description</entry>
2158 </row>
2159 </thead>
2161 <tbody>
2162 <row>
2163 <entry><structfield>classid</structfield></entry>
2164 <entry><type>oid</type></entry>
2165 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2166 <entry>The OID of the system catalog the dependent object is in</entry>
2167 </row>
2169 <row>
2170 <entry><structfield>objid</structfield></entry>
2171 <entry><type>oid</type></entry>
2172 <entry>any OID column</entry>
2173 <entry>The OID of the specific dependent object</entry>
2174 </row>
2176 <row>
2177 <entry><structfield>objsubid</structfield></entry>
2178 <entry><type>int4</type></entry>
2179 <entry></entry>
2180 <entry>
2181 For a table column, this is the column number (the
2182 <structfield>objid</> and <structfield>classid</> refer to the
2183 table itself). For all other object types, this column is
2184 zero
2185 </entry>
2186 </row>
2188 <row>
2189 <entry><structfield>refclassid</structfield></entry>
2190 <entry><type>oid</type></entry>
2191 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2192 <entry>The OID of the system catalog the referenced object is in</entry>
2193 </row>
2195 <row>
2196 <entry><structfield>refobjid</structfield></entry>
2197 <entry><type>oid</type></entry>
2198 <entry>any OID column</entry>
2199 <entry>The OID of the specific referenced object</entry>
2200 </row>
2202 <row>
2203 <entry><structfield>refobjsubid</structfield></entry>
2204 <entry><type>int4</type></entry>
2205 <entry></entry>
2206 <entry>
2207 For a table column, this is the column number (the
2208 <structfield>refobjid</> and <structfield>refclassid</> refer
2209 to the table itself). For all other object types, this column
2210 is zero
2211 </entry>
2212 </row>
2214 <row>
2215 <entry><structfield>deptype</structfield></entry>
2216 <entry><type>char</type></entry>
2217 <entry></entry>
2218 <entry>
2219 A code defining the specific semantics of this dependency relationship; see text
2220 </entry>
2221 </row>
2223 </tbody>
2224 </tgroup>
2225 </table>
2227 <para>
2228 In all cases, a <structname>pg_depend</structname> entry indicates that the
2229 referenced object cannot be dropped without also dropping the dependent
2230 object. However, there are several subflavors identified by
2231 <structfield>deptype</>:
2233 <variablelist>
2234 <varlistentry>
2235 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2236 <listitem>
2237 <para>
2238 A normal relationship between separately-created objects. The
2239 dependent object can be dropped without affecting the
2240 referenced object. The referenced object can only be dropped
2241 by specifying <literal>CASCADE</>, in which case the dependent
2242 object is dropped, too. Example: a table column has a normal
2243 dependency on its data type.
2244 </para>
2245 </listitem>
2246 </varlistentry>
2248 <varlistentry>
2249 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2250 <listitem>
2251 <para>
2252 The dependent object can be dropped separately from the
2253 referenced object, and should be automatically dropped
2254 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2255 mode) if the referenced object is dropped. Example: a named
2256 constraint on a table is made autodependent on the table, so
2257 that it will go away if the table is dropped.
2258 </para>
2259 </listitem>
2260 </varlistentry>
2262 <varlistentry>
2263 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2264 <listitem>
2265 <para>
2266 The dependent object was created as part of creation of the
2267 referenced object, and is really just a part of its internal
2268 implementation. A <command>DROP</> of the dependent object
2269 will be disallowed outright (we'll tell the user to issue a
2270 <command>DROP</> against the referenced object, instead). A
2271 <command>DROP</> of the referenced object will be propagated
2272 through to drop the dependent object whether
2273 <command>CASCADE</> is specified or not. Example: a trigger
2274 that's created to enforce a foreign-key constraint is made
2275 internally dependent on the constraint's
2276 <structname>pg_constraint</> entry.
2277 </para>
2278 </listitem>
2279 </varlistentry>
2281 <varlistentry>
2282 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2283 <listitem>
2284 <para>
2285 There is no dependent object; this type of entry is a signal
2286 that the system itself depends on the referenced object, and so
2287 that object must never be deleted. Entries of this type are
2288 created only by <command>initdb</command>. The columns for the
2289 dependent object contain zeroes.
2290 </para>
2291 </listitem>
2292 </varlistentry>
2293 </variablelist>
2295 Other dependency flavors might be needed in future.
2296 </para>
2298 </sect1>
2301 <sect1 id="catalog-pg-description">
2302 <title><structname>pg_description</structname></title>
2304 <indexterm zone="catalog-pg-description">
2305 <primary>pg_description</primary>
2306 </indexterm>
2308 <para>
2309 The catalog <structname>pg_description</> stores optional descriptions
2310 (comments) for each database object. Descriptions can be manipulated
2311 with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2312 <application>psql</application>'s <literal>\d</literal> commands.
2313 Descriptions of many built-in system objects are provided in the initial
2314 contents of <structname>pg_description</structname>.
2315 </para>
2317 <para>
2318 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2319 which performs a similar function for descriptions involving objects that
2320 are shared across a database cluster.
2321 </para>
2323 <table>
2324 <title><structname>pg_description</> Columns</title>
2326 <tgroup cols="4">
2327 <thead>
2328 <row>
2329 <entry>Name</entry>
2330 <entry>Type</entry>
2331 <entry>References</entry>
2332 <entry>Description</entry>
2333 </row>
2334 </thead>
2336 <tbody>
2337 <row>
2338 <entry><structfield>objoid</structfield></entry>
2339 <entry><type>oid</type></entry>
2340 <entry>any OID column</entry>
2341 <entry>The OID of the object this description pertains to</entry>
2342 </row>
2344 <row>
2345 <entry><structfield>classoid</structfield></entry>
2346 <entry><type>oid</type></entry>
2347 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2348 <entry>The OID of the system catalog this object appears in</entry>
2349 </row>
2351 <row>
2352 <entry><structfield>objsubid</structfield></entry>
2353 <entry><type>int4</type></entry>
2354 <entry></entry>
2355 <entry>
2356 For a comment on a table column, this is the column number (the
2357 <structfield>objoid</> and <structfield>classoid</> refer to
2358 the table itself). For all other object types, this column is
2359 zero
2360 </entry>
2361 </row>
2363 <row>
2364 <entry><structfield>description</structfield></entry>
2365 <entry><type>text</type></entry>
2366 <entry></entry>
2367 <entry>Arbitrary text that serves as the description of this object</entry>
2368 </row>
2369 </tbody>
2370 </tgroup>
2371 </table>
2373 </sect1>
2376 <sect1 id="catalog-pg-enum">
2377 <title><structname>pg_enum</structname></title>
2379 <indexterm zone="catalog-pg-enum">
2380 <primary>pg_enum</primary>
2381 </indexterm>
2383 <para>
2384 The <structname>pg_enum</structname> catalog contains entries
2385 matching enum types to their associated values and labels. The
2386 internal representation of a given enum value is actually the OID
2387 of its associated row in <structname>pg_enum</structname>. The
2388 OIDs for a particular enum type are guaranteed to be ordered in
2389 the way the type should sort, but there is no guarantee about the
2390 ordering of OIDs of unrelated enum types.
2391 </para>
2393 <table>
2394 <title><structname>pg_enum</> Columns</title>
2396 <tgroup cols="4">
2397 <thead>
2398 <row>
2399 <entry>Name</entry>
2400 <entry>Type</entry>
2401 <entry>References</entry>
2402 <entry>Description</entry>
2403 </row>
2404 </thead>
2406 <tbody>
2407 <row>
2408 <entry><structfield>enumtypid</structfield></entry>
2409 <entry><type>oid</type></entry>
2410 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2411 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2412 </row>
2414 <row>
2415 <entry><structfield>enumlabel</structfield></entry>
2416 <entry><type>name</type></entry>
2417 <entry></entry>
2418 <entry>The textual label for this enum value</entry>
2419 </row>
2420 </tbody>
2421 </tgroup>
2422 </table>
2423 </sect1>
2426 <sect1 id="catalog-pg-foreign-data-wrapper">
2427 <title><structname>pg_foreign_data_wrapper</structname></title>
2429 <indexterm zone="catalog-pg-foreign-data-wrapper">
2430 <primary>pg_foreign_data_wrapper</primary>
2431 </indexterm>
2433 <para>
2434 The catalog <structname>pg_foreign_data_wrapper</structname> stores
2435 foreign-data wrapper definitions. A foreign-data wrapper is the
2436 mechanism by which external data, residing on foreign servers, is
2437 accessed.
2438 </para>
2440 <table>
2441 <title><structname>pg_foreign_data_wrapper</> Columns</title>
2443 <tgroup cols="4">
2444 <thead>
2445 <row>
2446 <entry>Name</entry>
2447 <entry>Type</entry>
2448 <entry>References</entry>
2449 <entry>Description</entry>
2450 </row>
2451 </thead>
2453 <tbody>
2454 <row>
2455 <entry><structfield>fdwname</structfield></entry>
2456 <entry><type>name</type></entry>
2457 <entry></entry>
2458 <entry>Name of the foreign-data wrapper</entry>
2459 </row>
2461 <row>
2462 <entry><structfield>fdwowner</structfield></entry>
2463 <entry><type>oid</type></entry>
2464 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2465 <entry>Owner of the foreign-data wrapper</entry>
2466 </row>
2468 <row>
2469 <entry><structfield>fdwlibrary</structfield></entry>
2470 <entry><type>text</type></entry>
2471 <entry></entry>
2472 <entry>File name of the library implementing this foreign-data wrapper</entry>
2473 </row>
2475 <row>
2476 <entry><structfield>fdwacl</structfield></entry>
2477 <entry><type>aclitem[]</type></entry>
2478 <entry></entry>
2479 <entry>
2480 Access privileges; see
2481 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2482 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2483 for details
2484 </entry>
2485 </row>
2487 <row>
2488 <entry><structfield>fdwoptions</structfield></entry>
2489 <entry><type>text[]</type></entry>
2490 <entry></entry>
2491 <entry>
2492 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
2493 </entry>
2494 </row>
2495 </tbody>
2496 </tgroup>
2497 </table>
2498 </sect1>
2501 <sect1 id="catalog-pg-foreign-server">
2502 <title><structname>pg_foreign_server</structname></title>
2504 <indexterm zone="catalog-pg-foreign-server">
2505 <primary>pg_foreign_server</primary>
2506 </indexterm>
2508 <para>
2509 The catalog <structname>pg_foreign_server</structname> stores
2510 foreign server definitions. A foreign server describes the
2511 connection to a remote server, managing external data. Foreign
2512 servers are accessed via foreign-data wrappers.
2513 </para>
2515 <table>
2516 <title><structname>pg_foreign_server</> Columns</title>
2518 <tgroup cols="4">
2519 <thead>
2520 <row>
2521 <entry>Name</entry>
2522 <entry>Type</entry>
2523 <entry>References</entry>
2524 <entry>Description</entry>
2525 </row>
2526 </thead>
2528 <tbody>
2529 <row>
2530 <entry><structfield>srvname</structfield></entry>
2531 <entry><type>name</type></entry>
2532 <entry></entry>
2533 <entry>Name of the foreign server</entry>
2534 </row>
2536 <row>
2537 <entry><structfield>srvowner</structfield></entry>
2538 <entry><type>oid</type></entry>
2539 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2540 <entry>Owner of the foreign server</entry>
2541 </row>
2543 <row>
2544 <entry><structfield>srvfdw</structfield></entry>
2545 <entry><type>oid</type></entry>
2546 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
2547 <entry>The OID of the foreign-data wrapper of this foreign server</entry>
2548 </row>
2550 <row>
2551 <entry><structfield>srvtype</structfield></entry>
2552 <entry><type>text</type></entry>
2553 <entry></entry>
2554 <entry>Type of the server (optional)</entry>
2555 </row>
2557 <row>
2558 <entry><structfield>srvversion</structfield></entry>
2559 <entry><type>text</type></entry>
2560 <entry></entry>
2561 <entry>Version of the server (optional)</entry>
2562 </row>
2564 <row>
2565 <entry><structfield>srvacl</structfield></entry>
2566 <entry><type>aclitem[]</type></entry>
2567 <entry></entry>
2568 <entry>
2569 Access privileges; see
2570 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2571 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2572 for details
2573 </entry>
2574 </row>
2576 <row>
2577 <entry><structfield>srvoptions</structfield></entry>
2578 <entry><type>text[]</type></entry>
2579 <entry></entry>
2580 <entry>
2581 Foreign server specific options, as <quote>keyword=value</> strings.
2582 </entry>
2583 </row>
2584 </tbody>
2585 </tgroup>
2586 </table>
2587 </sect1>
2590 <sect1 id="catalog-pg-index">
2591 <title><structname>pg_index</structname></title>
2593 <indexterm zone="catalog-pg-index">
2594 <primary>pg_index</primary>
2595 </indexterm>
2597 <para>
2598 The catalog <structname>pg_index</structname> contains part of the information
2599 about indexes. The rest is mostly in
2600 <structname>pg_class</structname>.
2601 </para>
2603 <table>
2604 <title><structname>pg_index</> Columns</title>
2606 <tgroup cols="4">
2607 <thead>
2608 <row>
2609 <entry>Name</entry>
2610 <entry>Type</entry>
2611 <entry>References</entry>
2612 <entry>Description</entry>
2613 </row>
2614 </thead>
2616 <tbody>
2617 <row>
2618 <entry><structfield>indexrelid</structfield></entry>
2619 <entry><type>oid</type></entry>
2620 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2621 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2622 </row>
2624 <row>
2625 <entry><structfield>indrelid</structfield></entry>
2626 <entry><type>oid</type></entry>
2627 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2628 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2629 </row>
2631 <row>
2632 <entry><structfield>indnatts</structfield></entry>
2633 <entry><type>int2</type></entry>
2634 <entry></entry>
2635 <entry>The number of columns in the index (duplicates
2636 <literal>pg_class.relnatts</literal>)</entry>
2637 </row>
2639 <row>
2640 <entry><structfield>indisunique</structfield></entry>
2641 <entry><type>bool</type></entry>
2642 <entry></entry>
2643 <entry>If true, this is a unique index</entry>
2644 </row>
2646 <row>
2647 <entry><structfield>indisprimary</structfield></entry>
2648 <entry><type>bool</type></entry>
2649 <entry></entry>
2650 <entry>If true, this index represents the primary key of the table
2651 (<structfield>indisunique</> should always be true when this is true)</entry>
2652 </row>
2654 <row>
2655 <entry><structfield>indisclustered</structfield></entry>
2656 <entry><type>bool</type></entry>
2657 <entry></entry>
2658 <entry>If true, the table was last clustered on this index</entry>
2659 </row>
2661 <row>
2662 <entry><structfield>indisvalid</structfield></entry>
2663 <entry><type>bool</type></entry>
2664 <entry></entry>
2665 <entry>
2666 If true, the index is currently valid for queries. False means the
2667 index is possibly incomplete: it must still be modified by
2668 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2669 be used for queries. If it is unique, the uniqueness property is not
2670 true either
2671 </entry>
2672 </row>
2674 <row>
2675 <entry><structfield>indcheckxmin</structfield></entry>
2676 <entry><type>bool</type></entry>
2677 <entry></entry>
2678 <entry>
2679 If true, queries must not use the index until the <structfield>xmin</>
2680 of this <structname>pg_index</> row is below their TransactionXmin
2681 event horizon, because the table may contain broken HOT chains with
2682 incompatible rows that they can see
2683 </entry>
2684 </row>
2686 <row>
2687 <entry><structfield>indisready</structfield></entry>
2688 <entry><type>bool</type></entry>
2689 <entry></entry>
2690 <entry>
2691 If true, the index is currently ready for inserts. False means the
2692 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2693 operations
2694 </entry>
2695 </row>
2697 <row>
2698 <entry><structfield>indkey</structfield></entry>
2699 <entry><type>int2vector</type></entry>
2700 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2701 <entry>
2702 This is an array of <structfield>indnatts</structfield> values that
2703 indicate which table columns this index indexes. For example a value
2704 of <literal>1 3</literal> would mean that the first and the third table
2705 columns make up the index key. A zero in this array indicates that the
2706 corresponding index attribute is an expression over the table columns,
2707 rather than a simple column reference
2708 </entry>
2709 </row>
2711 <row>
2712 <entry><structfield>indclass</structfield></entry>
2713 <entry><type>oidvector</type></entry>
2714 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2715 <entry>
2716 For each column in the index key, this contains the OID of
2717 the operator class to use. See
2718 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2719 </entry>
2720 </row>
2722 <row>
2723 <entry><structfield>indoption</structfield></entry>
2724 <entry><type>int2vector</type></entry>
2725 <entry></entry>
2726 <entry>
2727 This is an array of <structfield>indnatts</structfield> values that
2728 store per-column flag bits. The meaning of the bits is defined by
2729 the index's access method
2730 </entry>
2731 </row>
2733 <row>
2734 <entry><structfield>indexprs</structfield></entry>
2735 <entry><type>text</type></entry>
2736 <entry></entry>
2737 <entry>Expression trees (in <function>nodeToString()</function> representation)
2738 for index attributes that are not simple column references. This is a
2739 list with one element for each zero entry in <structfield>indkey</>.
2740 NULL if all index attributes are simple references</entry>
2741 </row>
2743 <row>
2744 <entry><structfield>indpred</structfield></entry>
2745 <entry><type>text</type></entry>
2746 <entry></entry>
2747 <entry>Expression tree (in <function>nodeToString()</function> representation)
2748 for partial index predicate. NULL if not a partial index</entry>
2749 </row>
2750 </tbody>
2751 </tgroup>
2752 </table>
2754 </sect1>
2757 <sect1 id="catalog-pg-inherits">
2758 <title><structname>pg_inherits</structname></title>
2760 <indexterm zone="catalog-pg-inherits">
2761 <primary>pg_inherits</primary>
2762 </indexterm>
2764 <para>
2765 The catalog <structname>pg_inherits</> records information about
2766 table inheritance hierarchies. There is one entry for each direct
2767 child table in the database. (Indirect inheritance can be determined
2768 by following chains of entries.)
2769 </para>
2771 <table>
2772 <title><structname>pg_inherits</> Columns</title>
2774 <tgroup cols="4">
2775 <thead>
2776 <row>
2777 <entry>Name</entry>
2778 <entry>Type</entry>
2779 <entry>References</entry>
2780 <entry>Description</entry>
2781 </row>
2782 </thead>
2784 <tbody>
2785 <row>
2786 <entry><structfield>inhrelid</structfield></entry>
2787 <entry><type>oid</type></entry>
2788 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2789 <entry>
2790 The OID of the child table
2791 </entry>
2792 </row>
2794 <row>
2795 <entry><structfield>inhparent</structfield></entry>
2796 <entry><type>oid</type></entry>
2797 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2798 <entry>
2799 The OID of the parent table
2800 </entry>
2801 </row>
2803 <row>
2804 <entry><structfield>inhseqno</structfield></entry>
2805 <entry><type>int4</type></entry>
2806 <entry></entry>
2807 <entry>
2808 If there is more than one direct parent for a child table (multiple
2809 inheritance), this number tells the order in which the
2810 inherited columns are to be arranged. The count starts at 1
2811 </entry>
2812 </row>
2813 </tbody>
2814 </tgroup>
2815 </table>
2817 </sect1>
2820 <sect1 id="catalog-pg-language">
2821 <title><structname>pg_language</structname></title>
2823 <indexterm zone="catalog-pg-language">
2824 <primary>pg_language</primary>
2825 </indexterm>
2827 <para>
2828 The catalog <structname>pg_language</structname> registers
2829 languages in which you can write functions or stored procedures.
2830 See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
2831 and <xref linkend="xplang"> for more information about language handlers.
2832 </para>
2834 <table>
2835 <title><structname>pg_language</> Columns</title>
2837 <tgroup cols="4">
2838 <thead>
2839 <row>
2840 <entry>Name</entry>
2841 <entry>Type</entry>
2842 <entry>References</entry>
2843 <entry>Description</entry>
2844 </row>
2845 </thead>
2847 <tbody>
2848 <row>
2849 <entry><structfield>lanname</structfield></entry>
2850 <entry><type>name</type></entry>
2851 <entry></entry>
2852 <entry>Name of the language</entry>
2853 </row>
2855 <row>
2856 <entry><structfield>lanowner</structfield></entry>
2857 <entry><type>oid</type></entry>
2858 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2859 <entry>Owner of the language</entry>
2860 </row>
2862 <row>
2863 <entry><structfield>lanispl</structfield></entry>
2864 <entry><type>bool</type></entry>
2865 <entry></entry>
2866 <entry>
2867 This is false for internal languages (such as
2868 <acronym>SQL</acronym>) and true for user-defined languages.
2869 Currently, <application>pg_dump</application> still uses this
2870 to determine which languages need to be dumped, but this might be
2871 replaced by a different mechanism in the future
2872 </entry>
2873 </row>
2875 <row>
2876 <entry><structfield>lanpltrusted</structfield></entry>
2877 <entry><type>bool</type></entry>
2878 <entry></entry>
2879 <entry>
2880 True if this is a trusted language, which means that it is believed
2881 not to grant access to anything outside the normal SQL execution
2882 environment. Only superusers can create functions in untrusted
2883 languages
2884 </entry>
2885 </row>
2887 <row>
2888 <entry><structfield>lanplcallfoid</structfield></entry>
2889 <entry><type>oid</type></entry>
2890 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2891 <entry>
2892 For noninternal languages this references the language
2893 handler, which is a special function that is responsible for
2894 executing all functions that are written in the particular
2895 language
2896 </entry>
2897 </row>
2899 <row>
2900 <entry><structfield>lanvalidator</structfield></entry>
2901 <entry><type>oid</type></entry>
2902 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2903 <entry>
2904 This references a language validator function that is responsible
2905 for checking the syntax and validity of new functions when they
2906 are created. Zero if no validator is provided
2907 </entry>
2908 </row>
2910 <row>
2911 <entry><structfield>lanacl</structfield></entry>
2912 <entry><type>aclitem[]</type></entry>
2913 <entry></entry>
2914 <entry>
2915 Access privileges; see
2916 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2917 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2918 for details
2919 </entry>
2920 </row>
2921 </tbody>
2922 </tgroup>
2923 </table>
2925 </sect1>
2928 <sect1 id="catalog-pg-largeobject">
2929 <title><structname>pg_largeobject</structname></title>
2931 <indexterm zone="catalog-pg-largeobject">
2932 <primary>pg_largeobject</primary>
2933 </indexterm>
2935 <para>
2936 The catalog <structname>pg_largeobject</structname> holds the data making up
2937 <quote>large objects</quote>. A large object is identified by an
2938 OID assigned when it is created. Each large object is broken into
2939 segments or <quote>pages</> small enough to be conveniently stored as rows
2940 in <structname>pg_largeobject</structname>.
2941 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
2942 <literal>BLCKSZ/4</>, or typically 2 kB).
2943 </para>
2945 <table>
2946 <title><structname>pg_largeobject</> Columns</title>
2948 <tgroup cols="3">
2949 <thead>
2950 <row>
2951 <entry>Name</entry>
2952 <entry>Type</entry>
2953 <entry>Description</entry>
2954 </row>
2955 </thead>
2957 <tbody>
2958 <row>
2959 <entry><structfield>loid</structfield></entry>
2960 <entry><type>oid</type></entry>
2961 <entry>Identifier of the large object that includes this page</entry>
2962 </row>
2964 <row>
2965 <entry><structfield>pageno</structfield></entry>
2966 <entry><type>int4</type></entry>
2967 <entry>Page number of this page within its large object
2968 (counting from zero)</entry>
2969 </row>
2971 <row>
2972 <entry><structfield>data</structfield></entry>
2973 <entry><type>bytea</type></entry>
2974 <entry>
2975 Actual data stored in the large object.
2976 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
2977 </entry>
2978 </row>
2979 </tbody>
2980 </tgroup>
2981 </table>
2983 <para>
2984 Each row of <structname>pg_largeobject</structname> holds data
2985 for one page of a large object, beginning at
2986 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
2987 allows sparse storage: pages might be missing, and might be shorter than
2988 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
2989 Missing regions within a large object read as zeroes.
2990 </para>
2992 </sect1>
2995 <sect1 id="catalog-pg-listener">
2996 <title><structname>pg_listener</structname></title>
2998 <indexterm zone="catalog-pg-listener">
2999 <primary>pg_listener</primary>
3000 </indexterm>
3002 <para>
3003 The catalog <structname>pg_listener</structname> supports the
3004 <xref linkend="sql-listen" endterm="sql-listen-title"> and
3005 <xref linkend="sql-notify" endterm="sql-notify-title">
3006 commands. A listener creates an entry in
3007 <structname>pg_listener</structname> for each notification name
3008 it is listening for. A notifier scans <structname>pg_listener</structname>
3009 and updates each matching entry to show that a notification has occurred.
3010 The notifier also sends a signal (using the PID recorded in the table)
3011 to awaken the listener from sleep.
3012 </para>
3014 <table>
3015 <title><structname>pg_listener</> Columns</title>
3017 <tgroup cols="4">
3018 <thead>
3019 <row>
3020 <entry>Name</entry>
3021 <entry>Type</entry>
3022 <entry>References</entry>
3023 <entry>Description</entry>
3024 </row>
3025 </thead>
3027 <tbody>
3028 <row>
3029 <entry><structfield>relname</structfield></entry>
3030 <entry><type>name</type></entry>
3031 <entry>
3032 Notify condition name. (The name need not match any actual
3033 relation in the database; the name <structfield>relname</> is historical.)
3034 </entry>
3035 </row>
3037 <row>
3038 <entry><structfield>listenerpid</structfield></entry>
3039 <entry><type>int4</type></entry>
3040 <entry>PID of the server process that created this entry</entry>
3041 </row>
3043 <row>
3044 <entry><structfield>notification</structfield></entry>
3045 <entry><type>int4</type></entry>
3046 <entry>
3047 Zero if no event is pending for this listener. If an event is
3048 pending, the PID of the server process that sent the notification
3049 </entry>
3050 </row>
3051 </tbody>
3052 </tgroup>
3053 </table>
3055 </sect1>
3058 <sect1 id="catalog-pg-namespace">
3059 <title><structname>pg_namespace</structname></title>
3061 <indexterm zone="catalog-pg-namespace">
3062 <primary>pg_namespace</primary>
3063 </indexterm>
3065 <para>
3066 The catalog <structname>pg_namespace</> stores namespaces.
3067 A namespace is the structure underlying SQL schemas: each namespace
3068 can have a separate collection of relations, types, etc. without name
3069 conflicts.
3070 </para>
3072 <table>
3073 <title><structname>pg_namespace</> Columns</title>
3075 <tgroup cols="4">
3076 <thead>
3077 <row>
3078 <entry>Name</entry>
3079 <entry>Type</entry>
3080 <entry>References</entry>
3081 <entry>Description</entry>
3082 </row>
3083 </thead>
3085 <tbody>
3086 <row>
3087 <entry><structfield>nspname</structfield></entry>
3088 <entry><type>name</type></entry>
3089 <entry></entry>
3090 <entry>Name of the namespace</entry>
3091 </row>
3093 <row>
3094 <entry><structfield>nspowner</structfield></entry>
3095 <entry><type>oid</type></entry>
3096 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3097 <entry>Owner of the namespace</entry>
3098 </row>
3100 <row>
3101 <entry><structfield>nspacl</structfield></entry>
3102 <entry><type>aclitem[]</type></entry>
3103 <entry></entry>
3104 <entry>
3105 Access privileges; see
3106 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3107 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3108 for details
3109 </entry>
3110 </row>
3111 </tbody>
3112 </tgroup>
3113 </table>
3115 </sect1>
3118 <sect1 id="catalog-pg-opclass">
3119 <title><structname>pg_opclass</structname></title>
3121 <indexterm zone="catalog-pg-opclass">
3122 <primary>pg_opclass</primary>
3123 </indexterm>
3125 <para>
3126 The catalog <structname>pg_opclass</structname> defines
3127 index access method operator classes. Each operator class defines
3128 semantics for index columns of a particular data type and a particular
3129 index access method. An operator class essentially specifies that a
3130 particular operator family is applicable to a particular indexable column
3131 data type. The set of operators from the family that are actually usable
3132 with the indexed column are whichever ones accept the column's data type
3133 as their lefthand input.
3134 </para>
3136 <para>
3137 Operator classes are described at length in <xref linkend="xindex">.
3138 </para>
3140 <table>
3141 <title><structname>pg_opclass</> Columns</title>
3143 <tgroup cols="4">
3144 <thead>
3145 <row>
3146 <entry>Name</entry>
3147 <entry>Type</entry>
3148 <entry>References</entry>
3149 <entry>Description</entry>
3150 </row>
3151 </thead>
3152 <tbody>
3154 <row>
3155 <entry><structfield>opcmethod</structfield></entry>
3156 <entry><type>oid</type></entry>
3157 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3158 <entry>Index access method operator class is for</entry>
3159 </row>
3161 <row>
3162 <entry><structfield>opcname</structfield></entry>
3163 <entry><type>name</type></entry>
3164 <entry></entry>
3165 <entry>Name of this operator class</entry>
3166 </row>
3168 <row>
3169 <entry><structfield>opcnamespace</structfield></entry>
3170 <entry><type>oid</type></entry>
3171 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3172 <entry>Namespace of this operator class</entry>
3173 </row>
3175 <row>
3176 <entry><structfield>opcowner</structfield></entry>
3177 <entry><type>oid</type></entry>
3178 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3179 <entry>Owner of the operator class</entry>
3180 </row>
3182 <row>
3183 <entry><structfield>opcfamily</structfield></entry>
3184 <entry><type>oid</type></entry>
3185 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3186 <entry>Operator family containing the operator class</entry>
3187 </row>
3189 <row>
3190 <entry><structfield>opcintype</structfield></entry>
3191 <entry><type>oid</type></entry>
3192 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3193 <entry>Data type that the operator class indexes</entry>
3194 </row>
3196 <row>
3197 <entry><structfield>opcdefault</structfield></entry>
3198 <entry><type>bool</type></entry>
3199 <entry></entry>
3200 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3201 </row>
3203 <row>
3204 <entry><structfield>opckeytype</structfield></entry>
3205 <entry><type>oid</type></entry>
3206 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3207 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3208 </row>
3210 </tbody>
3211 </tgroup>
3212 </table>
3214 <para>
3215 An operator class's <structfield>opcmethod</> must match the
3216 <structname>opfmethod</> of its containing operator family.
3217 Also, there must be no more than one <structname>pg_opclass</structname>
3218 row having <structname>opcdefault</> true for any given combination of
3219 <structname>opcmethod</> and <structname>opcintype</>.
3220 </para>
3222 </sect1>
3225 <sect1 id="catalog-pg-operator">
3226 <title><structname>pg_operator</structname></title>
3228 <indexterm zone="catalog-pg-operator">
3229 <primary>pg_operator</primary>
3230 </indexterm>
3232 <para>
3233 The catalog <structname>pg_operator</> stores information about operators.
3234 See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3235 and <xref linkend="xoper"> for more information.
3236 </para>
3238 <table>
3239 <title><structname>pg_operator</> Columns</title>
3241 <tgroup cols="4">
3242 <thead>
3243 <row>
3244 <entry>Name</entry>
3245 <entry>Type</entry>
3246 <entry>References</entry>
3247 <entry>Description</entry>
3248 </row>
3249 </thead>
3251 <tbody>
3252 <row>
3253 <entry><structfield>oprname</structfield></entry>
3254 <entry><type>name</type></entry>
3255 <entry></entry>
3256 <entry>Name of the operator</entry>
3257 </row>
3259 <row>
3260 <entry><structfield>oprnamespace</structfield></entry>
3261 <entry><type>oid</type></entry>
3262 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3263 <entry>
3264 The OID of the namespace that contains this operator
3265 </entry>
3266 </row>
3268 <row>
3269 <entry><structfield>oprowner</structfield></entry>
3270 <entry><type>oid</type></entry>
3271 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3272 <entry>Owner of the operator</entry>
3273 </row>
3275 <row>
3276 <entry><structfield>oprkind</structfield></entry>
3277 <entry><type>char</type></entry>
3278 <entry></entry>
3279 <entry>
3280 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3281 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3282 </entry>
3283 </row>
3285 <row>
3286 <entry><structfield>oprcanmerge</structfield></entry>
3287 <entry><type>bool</type></entry>
3288 <entry></entry>
3289 <entry>This operator supports merge joins</entry>
3290 </row>
3292 <row>
3293 <entry><structfield>oprcanhash</structfield></entry>
3294 <entry><type>bool</type></entry>
3295 <entry></entry>
3296 <entry>This operator supports hash joins</entry>
3297 </row>
3299 <row>
3300 <entry><structfield>oprleft</structfield></entry>
3301 <entry><type>oid</type></entry>
3302 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3303 <entry>Type of the left operand</entry>
3304 </row>
3306 <row>
3307 <entry><structfield>oprright</structfield></entry>
3308 <entry><type>oid</type></entry>
3309 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3310 <entry>Type of the right operand</entry>
3311 </row>
3313 <row>
3314 <entry><structfield>oprresult</structfield></entry>
3315 <entry><type>oid</type></entry>
3316 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3317 <entry>Type of the result</entry>
3318 </row>
3320 <row>
3321 <entry><structfield>oprcom</structfield></entry>
3322 <entry><type>oid</type></entry>
3323 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3324 <entry>Commutator of this operator, if any</entry>
3325 </row>
3327 <row>
3328 <entry><structfield>oprnegate</structfield></entry>
3329 <entry><type>oid</type></entry>
3330 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3331 <entry>Negator of this operator, if any</entry>
3332 </row>
3334 <row>
3335 <entry><structfield>oprcode</structfield></entry>
3336 <entry><type>regproc</type></entry>
3337 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3338 <entry>Function that implements this operator</entry>
3339 </row>
3341 <row>
3342 <entry><structfield>oprrest</structfield></entry>
3343 <entry><type>regproc</type></entry>
3344 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3345 <entry>Restriction selectivity estimation function for this operator</entry>
3346 </row>
3348 <row>
3349 <entry><structfield>oprjoin</structfield></entry>
3350 <entry><type>regproc</type></entry>
3351 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3352 <entry>Join selectivity estimation function for this operator</entry>
3353 </row>
3354 </tbody>
3355 </tgroup>
3356 </table>
3358 <para>
3359 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3360 is zero for a prefix operator.
3361 </para>
3363 </sect1>
3366 <sect1 id="catalog-pg-opfamily">
3367 <title><structname>pg_opfamily</structname></title>
3369 <indexterm zone="catalog-pg-opfamily">
3370 <primary>pg_opfamily</primary>
3371 </indexterm>
3373 <para>
3374 The catalog <structname>pg_opfamily</structname> defines operator families.
3375 Each operator family is a collection of operators and associated
3376 support routines that implement the semantics specified for a particular
3377 index access method. Furthermore, the operators in a family are all
3378 <quote>compatible</>, in a way that is specified by the access method.
3379 The operator family concept allows cross-data-type operators to be used
3380 with indexes and to be reasoned about using knowledge of access method
3381 semantics.
3382 </para>
3384 <para>
3385 Operator families are described at length in <xref linkend="xindex">.
3386 </para>
3388 <table>
3389 <title><structname>pg_opfamily</> Columns</title>
3391 <tgroup cols="4">
3392 <thead>
3393 <row>
3394 <entry>Name</entry>
3395 <entry>Type</entry>
3396 <entry>References</entry>
3397 <entry>Description</entry>
3398 </row>
3399 </thead>
3400 <tbody>
3402 <row>
3403 <entry><structfield>opfmethod</structfield></entry>
3404 <entry><type>oid</type></entry>
3405 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3406 <entry>Index access method operator family is for</entry>
3407 </row>
3409 <row>
3410 <entry><structfield>opfname</structfield></entry>
3411 <entry><type>name</type></entry>
3412 <entry></entry>
3413 <entry>Name of this operator family</entry>
3414 </row>
3416 <row>
3417 <entry><structfield>opfnamespace</structfield></entry>
3418 <entry><type>oid</type></entry>
3419 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3420 <entry>Namespace of this operator family</entry>
3421 </row>
3423 <row>
3424 <entry><structfield>opfowner</structfield></entry>
3425 <entry><type>oid</type></entry>
3426 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3427 <entry>Owner of the operator family</entry>
3428 </row>
3430 </tbody>
3431 </tgroup>
3432 </table>
3434 <para>
3435 The majority of the information defining an operator family is not in its
3436 <structname>pg_opfamily</structname> row, but in the associated rows in
3437 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3438 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3440 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3441 </para>
3443 </sect1>
3446 <sect1 id="catalog-pg-pltemplate">
3447 <title><structname>pg_pltemplate</structname></title>
3449 <indexterm zone="catalog-pg-pltemplate">
3450 <primary>pg_pltemplate</primary>
3451 </indexterm>
3453 <para>
3454 The catalog <structname>pg_pltemplate</structname> stores
3455 <quote>template</> information for procedural languages.
3456 A template for a language allows the language to be created in a
3457 particular database by a simple <command>CREATE LANGUAGE</> command,
3458 with no need to specify implementation details.
3459 </para>
3461 <para>
3462 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3463 is shared across all databases of a cluster: there is only one
3464 copy of <structname>pg_pltemplate</structname> per cluster, not
3465 one per database. This allows the information to be accessible in
3466 each database as it is needed.
3467 </para>
3469 <table>
3470 <title><structname>pg_pltemplate</> Columns</title>
3472 <tgroup cols="3">
3473 <thead>
3474 <row>
3475 <entry>Name</entry>
3476 <entry>Type</entry>
3477 <entry>Description</entry>
3478 </row>
3479 </thead>
3481 <tbody>
3482 <row>
3483 <entry><structfield>tmplname</structfield></entry>
3484 <entry><type>name</type></entry>
3485 <entry>Name of the language this template is for</entry>
3486 </row>
3488 <row>
3489 <entry><structfield>tmpltrusted</structfield></entry>
3490 <entry><type>boolean</type></entry>
3491 <entry>True if language is considered trusted</entry>
3492 </row>
3494 <row>
3495 <entry><structfield>tmpldbacreate</structfield></entry>
3496 <entry><type>boolean</type></entry>
3497 <entry>True if language may be created by a database owner</entry>
3498 </row>
3500 <row>
3501 <entry><structfield>tmplhandler</structfield></entry>
3502 <entry><type>text</type></entry>
3503 <entry>Name of call handler function</entry>
3504 </row>
3506 <row>
3507 <entry><structfield>tmplvalidator</structfield></entry>
3508 <entry><type>text</type></entry>
3509 <entry>Name of validator function, or NULL if none</entry>
3510 </row>
3512 <row>
3513 <entry><structfield>tmpllibrary</structfield></entry>
3514 <entry><type>text</type></entry>
3515 <entry>Path of shared library that implements language</entry>
3516 </row>
3518 <row>
3519 <entry><structfield>tmplacl</structfield></entry>
3520 <entry><type>aclitem[]</type></entry>
3521 <entry>Access privileges for template (not yet used)</entry>
3522 </row>
3524 </tbody>
3525 </tgroup>
3526 </table>
3528 <para>
3529 There are not currently any commands that manipulate procedural language
3530 templates; to change the built-in information, a superuser must modify
3531 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3532 or <command>UPDATE</command> commands. It is likely that a future
3533 release of <productname>PostgreSQL</productname> will offer
3534 commands to change the entries in a cleaner fashion.
3535 </para>
3537 <para>
3538 When implemented, the <structfield>tmplacl</structfield> field will provide
3539 access control for the template itself (i.e., the right to create a
3540 language using it), not for the languages created from the template.
3541 </para>
3543 </sect1>
3546 <sect1 id="catalog-pg-proc">
3547 <title><structname>pg_proc</structname></title>
3549 <indexterm zone="catalog-pg-proc">
3550 <primary>pg_proc</primary>
3551 </indexterm>
3553 <para>
3554 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3555 See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3556 and <xref linkend="xfunc"> for more information.
3557 </para>
3559 <para>
3560 The table contains data for aggregate functions as well as plain functions.
3561 If <structfield>proisagg</structfield> is true, there should be a matching
3562 row in <structfield>pg_aggregate</structfield>.
3563 </para>
3565 <table>
3566 <title><structname>pg_proc</> Columns</title>
3568 <tgroup cols="4">
3569 <thead>
3570 <row>
3571 <entry>Name</entry>
3572 <entry>Type</entry>
3573 <entry>References</entry>
3574 <entry>Description</entry>
3575 </row>
3576 </thead>
3578 <tbody>
3579 <row>
3580 <entry><structfield>proname</structfield></entry>
3581 <entry><type>name</type></entry>
3582 <entry></entry>
3583 <entry>Name of the function</entry>
3584 </row>
3586 <row>
3587 <entry><structfield>pronamespace</structfield></entry>
3588 <entry><type>oid</type></entry>
3589 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3590 <entry>
3591 The OID of the namespace that contains this function
3592 </entry>
3593 </row>
3595 <row>
3596 <entry><structfield>proowner</structfield></entry>
3597 <entry><type>oid</type></entry>
3598 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3599 <entry>Owner of the function</entry>
3600 </row>
3602 <row>
3603 <entry><structfield>prolang</structfield></entry>
3604 <entry><type>oid</type></entry>
3605 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3606 <entry>Implementation language or call interface of this function</entry>
3607 </row>
3609 <row>
3610 <entry><structfield>procost</structfield></entry>
3611 <entry><type>float4</type></entry>
3612 <entry></entry>
3613 <entry>Estimated execution cost (in units of
3614 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3615 this is cost per row returned</entry>
3616 </row>
3618 <row>
3619 <entry><structfield>prorows</structfield></entry>
3620 <entry><type>float4</type></entry>
3621 <entry></entry>
3622 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3623 </row>
3625 <row>
3626 <entry><structfield>provariadic</structfield></entry>
3627 <entry><type>oid</type></entry>
3628 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3629 <entry>Data type of the variadic array parameter's elements,
3630 or zero if the function does not have a variadic parameter</entry>
3631 </row>
3633 <row>
3634 <entry><structfield>proisagg</structfield></entry>
3635 <entry><type>bool</type></entry>
3636 <entry></entry>
3637 <entry>Function is an aggregate function</entry>
3638 </row>
3640 <row>
3641 <entry><structfield>proiswindow</structfield></entry>
3642 <entry><type>bool</type></entry>
3643 <entry></entry>
3644 <entry>Function is a window function</entry>
3645 </row>
3647 <row>
3648 <entry><structfield>prosecdef</structfield></entry>
3649 <entry><type>bool</type></entry>
3650 <entry></entry>
3651 <entry>Function is a security definer (i.e., a <quote>setuid</>
3652 function)</entry>
3653 </row>
3655 <row>
3656 <entry><structfield>proisstrict</structfield></entry>
3657 <entry><type>bool</type></entry>
3658 <entry></entry>
3659 <entry>
3660 Function returns null if any call argument is null. In that
3661 case the function won't actually be called at all. Functions
3662 that are not <quote>strict</quote> must be prepared to handle
3663 null inputs
3664 </entry>
3665 </row>
3667 <row>
3668 <entry><structfield>proretset</structfield></entry>
3669 <entry><type>bool</type></entry>
3670 <entry></entry>
3671 <entry>Function returns a set (i.e., multiple values of the specified
3672 data type)</entry>
3673 </row>
3675 <row>
3676 <entry><structfield>provolatile</structfield></entry>
3677 <entry><type>char</type></entry>
3678 <entry></entry>
3679 <entry>
3680 <structfield>provolatile</structfield> tells whether the function's
3681 result depends only on its input arguments, or is affected by outside
3682 factors.
3683 It is <literal>i</literal> for <quote>immutable</> functions,
3684 which always deliver the same result for the same inputs.
3685 It is <literal>s</literal> for <quote>stable</> functions,
3686 whose results (for fixed inputs) do not change within a scan.
3687 It is <literal>v</literal> for <quote>volatile</> functions,
3688 whose results might change at any time. (Use <literal>v</literal> also
3689 for functions with side-effects, so that calls to them cannot get
3690 optimized away.)
3691 </entry>
3692 </row>
3694 <row>
3695 <entry><structfield>pronargs</structfield></entry>
3696 <entry><type>int2</type></entry>
3697 <entry></entry>
3698 <entry>Number of input arguments</entry>
3699 </row>
3701 <row>
3702 <entry><structfield>pronargdefaults</structfield></entry>
3703 <entry><type>int2</type></entry>
3704 <entry></entry>
3705 <entry>Number of arguments that have defaults</entry>
3706 </row>
3708 <row>
3709 <entry><structfield>prorettype</structfield></entry>
3710 <entry><type>oid</type></entry>
3711 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3712 <entry>Data type of the return value</entry>
3713 </row>
3715 <row>
3716 <entry><structfield>proargtypes</structfield></entry>
3717 <entry><type>oidvector</type></entry>
3718 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3719 <entry>
3720 An array with the data types of the function arguments. This includes
3721 only input arguments (including <literal>INOUT</literal> and
3722 <literal>VARIADIC</> arguments), and thus represents
3723 the call signature of the function
3724 </entry>
3725 </row>
3727 <row>
3728 <entry><structfield>proallargtypes</structfield></entry>
3729 <entry><type>oid[]</type></entry>
3730 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3731 <entry>
3732 An array with the data types of the function arguments. This includes
3733 all arguments (including <literal>OUT</literal> and
3734 <literal>INOUT</literal> arguments); however, if all the
3735 arguments are <literal>IN</literal> arguments, this field will be null.
3736 Note that subscripting is 1-based, whereas for historical reasons
3737 <structfield>proargtypes</> is subscripted from 0
3738 </entry>
3739 </row>
3741 <row>
3742 <entry><structfield>proargmodes</structfield></entry>
3743 <entry><type>char[]</type></entry>
3744 <entry></entry>
3745 <entry>
3746 An array with the modes of the function arguments, encoded as
3747 <literal>i</literal> for <literal>IN</> arguments,
3748 <literal>o</literal> for <literal>OUT</> arguments,
3749 <literal>b</literal> for <literal>INOUT</> arguments,
3750 <literal>v</literal> for <literal>VARIADIC</> arguments,
3751 <literal>t</literal> for <literal>TABLE</> arguments.
3752 If all the arguments are <literal>IN</literal> arguments,
3753 this field will be null.
3754 Note that subscripts correspond to positions of
3755 <structfield>proallargtypes</> not <structfield>proargtypes</>
3756 </entry>
3757 </row>
3759 <row>
3760 <entry><structfield>proargnames</structfield></entry>
3761 <entry><type>text[]</type></entry>
3762 <entry></entry>
3763 <entry>
3764 An array with the names of the function arguments.
3765 Arguments without a name are set to empty strings in the array.
3766 If none of the arguments have a name, this field will be null.
3767 Note that subscripts correspond to positions of
3768 <structfield>proallargtypes</> not <structfield>proargtypes</>
3769 </entry>
3770 </row>
3772 <row>
3773 <entry><structfield>proargdefaults</structfield></entry>
3774 <entry><type>text</type></entry>
3775 <entry></entry>
3776 <entry>
3777 Expression trees (in <function>nodeToString()</function> representation)
3778 for default values. This is a list with
3779 <structfield>pronargdefaults</> elements, corresponding to the last
3780 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
3781 <replaceable>N</> <structfield>proargtypes</> positions).
3782 If none of the arguments have defaults, this field will be null
3783 </entry>
3784 </row>
3786 <row>
3787 <entry><structfield>prosrc</structfield></entry>
3788 <entry><type>text</type></entry>
3789 <entry></entry>
3790 <entry>
3791 This tells the function handler how to invoke the function. It
3792 might be the actual source code of the function for interpreted
3793 languages, a link symbol, a file name, or just about anything
3794 else, depending on the implementation language/call convention
3795 </entry>
3796 </row>
3798 <row>
3799 <entry><structfield>probin</structfield></entry>
3800 <entry><type>bytea</type></entry>
3801 <entry></entry>
3802 <entry>
3803 Additional information about how to invoke the function.
3804 Again, the interpretation is language-specific
3805 </entry>
3806 </row>
3808 <row>
3809 <entry><structfield>proconfig</structfield></entry>
3810 <entry><type>text[]</type></entry>
3811 <entry></entry>
3812 <entry>Function's local settings for run-time configuration variables</entry>
3813 </row>
3815 <row>
3816 <entry><structfield>proacl</structfield></entry>
3817 <entry><type>aclitem[]</type></entry>
3818 <entry></entry>
3819 <entry>
3820 Access privileges; see
3821 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3822 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3823 for details
3824 </entry>
3825 </row>
3826 </tbody>
3827 </tgroup>
3828 </table>
3830 <para>
3831 For compiled functions, both built-in and dynamically loaded,
3832 <structfield>prosrc</structfield> contains the function's C-language
3833 name (link symbol). For all other currently-known language types,
3834 <structfield>prosrc</structfield> contains the function's source
3835 text. <structfield>probin</structfield> is unused except for
3836 dynamically-loaded C functions, for which it gives the name of the
3837 shared library file containing the function.
3838 </para>
3840 </sect1>
3842 <sect1 id="catalog-pg-rewrite">
3843 <title><structname>pg_rewrite</structname></title>
3845 <indexterm zone="catalog-pg-rewrite">
3846 <primary>pg_rewrite</primary>
3847 </indexterm>
3849 <para>
3850 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
3851 </para>
3853 <table>
3854 <title><structname>pg_rewrite</> Columns</title>
3856 <tgroup cols="4">
3857 <thead>
3858 <row>
3859 <entry>Name</entry>
3860 <entry>Type</entry>
3861 <entry>References</entry>
3862 <entry>Description</entry>
3863 </row>
3864 </thead>
3866 <tbody>
3867 <row>
3868 <entry><structfield>rulename</structfield></entry>
3869 <entry><type>name</type></entry>
3870 <entry></entry>
3871 <entry>Rule name</entry>
3872 </row>
3874 <row>
3875 <entry><structfield>ev_class</structfield></entry>
3876 <entry><type>oid</type></entry>
3877 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3878 <entry>The table this rule is for</entry>
3879 </row>
3881 <row>
3882 <entry><structfield>ev_attr</structfield></entry>
3883 <entry><type>int2</type></entry>
3884 <entry></entry>
3885 <entry>The column this rule is for (currently, always zero to
3886 indicate the whole table)</entry>
3887 </row>
3889 <row>
3890 <entry><structfield>ev_type</structfield></entry>
3891 <entry><type>char</type></entry>
3892 <entry></entry>
3893 <entry>
3894 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
3895 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
3896 <command>DELETE</>
3897 </entry>
3898 </row>
3900 <row>
3901 <entry><structfield>ev_enabled</structfield></entry>
3902 <entry><type>char</type></entry>
3903 <entry></entry>
3904 <entry>
3905 Controls in which <xref linkend="guc-session-replication-role"> modes
3906 the rule fires.
3907 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
3908 <literal>D</> = rule is disabled,
3909 <literal>R</> = rule fires in <quote>replica</> mode,
3910 <literal>A</> = rule fires always.
3911 </entry>
3912 </row>
3914 <row>
3915 <entry><structfield>is_instead</structfield></entry>
3916 <entry><type>bool</type></entry>
3917 <entry></entry>
3918 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
3919 </row>
3921 <row>
3922 <entry><structfield>ev_qual</structfield></entry>
3923 <entry><type>text</type></entry>
3924 <entry></entry>
3925 <entry>
3926 Expression tree (in the form of a
3927 <function>nodeToString()</function> representation) for the
3928 rule's qualifying condition
3929 </entry>
3930 </row>
3932 <row>
3933 <entry><structfield>ev_action</structfield></entry>
3934 <entry><type>text</type></entry>
3935 <entry></entry>
3936 <entry>
3937 Query tree (in the form of a
3938 <function>nodeToString()</function> representation) for the
3939 rule's action
3940 </entry>
3941 </row>
3942 </tbody>
3943 </tgroup>
3944 </table>
3946 <note>
3947 <para>
3948 <literal>pg_class.relhasrules</literal>
3949 must be true if a table has any rules in this catalog.
3950 </para>
3951 </note>
3953 </sect1>
3956 <sect1 id="catalog-pg-shdepend">
3957 <title><structname>pg_shdepend</structname></title>
3959 <indexterm zone="catalog-pg-shdepend">
3960 <primary>pg_shdepend</primary>
3961 </indexterm>
3963 <para>
3964 The catalog <structname>pg_shdepend</structname> records the
3965 dependency relationships between database objects and shared objects,
3966 such as roles. This information allows
3967 <productname>PostgreSQL</productname> to ensure that those objects are
3968 unreferenced before attempting to delete them.
3969 </para>
3971 <para>
3972 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
3973 which performs a similar function for dependencies involving objects
3974 within a single database.
3975 </para>
3977 <para>
3978 Unlike most system catalogs, <structname>pg_shdepend</structname>
3979 is shared across all databases of a cluster: there is only one
3980 copy of <structname>pg_shdepend</structname> per cluster, not
3981 one per database.
3982 </para>
3984 <table>
3985 <title><structname>pg_shdepend</> Columns</title>
3987 <tgroup cols="4">
3988 <thead>
3989 <row>
3990 <entry>Name</entry>
3991 <entry>Type</entry>
3992 <entry>References</entry>
3993 <entry>Description</entry>
3994 </row>
3995 </thead>
3997 <tbody>
3998 <row>
3999 <entry><structfield>dbid</structfield></entry>
4000 <entry><type>oid</type></entry>
4001 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4002 <entry>The OID of the database the dependent object is in,
4003 or zero for a shared object</entry>
4004 </row>
4006 <row>
4007 <entry><structfield>classid</structfield></entry>
4008 <entry><type>oid</type></entry>
4009 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4010 <entry>The OID of the system catalog the dependent object is in</entry>
4011 </row>
4013 <row>
4014 <entry><structfield>objid</structfield></entry>
4015 <entry><type>oid</type></entry>
4016 <entry>any OID column</entry>
4017 <entry>The OID of the specific dependent object</entry>
4018 </row>
4020 <row>
4021 <entry><structfield>objsubid</structfield></entry>
4022 <entry><type>int4</type></entry>
4023 <entry></entry>
4024 <entry>
4025 For a table column, this is the column number (the
4026 <structfield>objid</> and <structfield>classid</> refer to the
4027 table itself). For all other object types, this column is zero
4028 </entry>
4029 </row>
4031 <row>
4032 <entry><structfield>refclassid</structfield></entry>
4033 <entry><type>oid</type></entry>
4034 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4035 <entry>The OID of the system catalog the referenced object is in
4036 (must be a shared catalog)</entry>
4037 </row>
4039 <row>
4040 <entry><structfield>refobjid</structfield></entry>
4041 <entry><type>oid</type></entry>
4042 <entry>any OID column</entry>
4043 <entry>The OID of the specific referenced object</entry>
4044 </row>
4046 <row>
4047 <entry><structfield>deptype</structfield></entry>
4048 <entry><type>char</type></entry>
4049 <entry></entry>
4050 <entry>
4051 A code defining the specific semantics of this dependency relationship; see text
4052 </entry>
4053 </row>
4055 </tbody>
4056 </tgroup>
4057 </table>
4059 <para>
4060 In all cases, a <structname>pg_shdepend</structname> entry indicates that
4061 the referenced object cannot be dropped without also dropping the dependent
4062 object. However, there are several subflavors identified by
4063 <structfield>deptype</>:
4065 <variablelist>
4066 <varlistentry>
4067 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4068 <listitem>
4069 <para>
4070 The referenced object (which must be a role) is the owner of the
4071 dependent object.
4072 </para>
4073 </listitem>
4074 </varlistentry>
4076 <varlistentry>
4077 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4078 <listitem>
4079 <para>
4080 The referenced object (which must be a role) is mentioned in the
4081 ACL (access control list, i.e., privileges list) of the
4082 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4083 not made for the owner of the object, since the owner will have
4084 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4085 </para>
4086 </listitem>
4087 </varlistentry>
4089 <varlistentry>
4090 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4091 <listitem>
4092 <para>
4093 There is no dependent object; this type of entry is a signal
4094 that the system itself depends on the referenced object, and so
4095 that object must never be deleted. Entries of this type are
4096 created only by <command>initdb</command>. The columns for the
4097 dependent object contain zeroes.
4098 </para>
4099 </listitem>
4100 </varlistentry>
4101 </variablelist>
4103 Other dependency flavors might be needed in future. Note in particular
4104 that the current definition only supports roles as referenced objects.
4105 </para>
4107 </sect1>
4109 <sect1 id="catalog-pg-shdescription">
4110 <title><structname>pg_shdescription</structname></title>
4112 <indexterm zone="catalog-pg-shdescription">
4113 <primary>pg_shdescription</primary>
4114 </indexterm>
4116 <para>
4117 The catalog <structname>pg_shdescription</structname> stores optional
4118 descriptions (comments) for shared database objects. Descriptions can be
4119 manipulated with the <xref linkend="sql-comment"
4120 endterm="sql-comment-title"> command and viewed with
4121 <application>psql</application>'s <literal>\d</literal> commands.
4122 </para>
4124 <para>
4125 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4126 which performs a similar function for descriptions involving objects
4127 within a single database.
4128 </para>
4130 <para>
4131 Unlike most system catalogs, <structname>pg_shdescription</structname>
4132 is shared across all databases of a cluster: there is only one
4133 copy of <structname>pg_shdescription</structname> per cluster, not
4134 one per database.
4135 </para>
4137 <table>
4138 <title><structname>pg_shdescription</> Columns</title>
4140 <tgroup cols="4">
4141 <thead>
4142 <row>
4143 <entry>Name</entry>
4144 <entry>Type</entry>
4145 <entry>References</entry>
4146 <entry>Description</entry>
4147 </row>
4148 </thead>
4150 <tbody>
4151 <row>
4152 <entry><structfield>objoid</structfield></entry>
4153 <entry><type>oid</type></entry>
4154 <entry>any OID column</entry>
4155 <entry>The OID of the object this description pertains to</entry>
4156 </row>
4158 <row>
4159 <entry><structfield>classoid</structfield></entry>
4160 <entry><type>oid</type></entry>
4161 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4162 <entry>The OID of the system catalog this object appears in</entry>
4163 </row>
4165 <row>
4166 <entry><structfield>description</structfield></entry>
4167 <entry><type>text</type></entry>
4168 <entry></entry>
4169 <entry>Arbitrary text that serves as the description of this object</entry>
4170 </row>
4171 </tbody>
4172 </tgroup>
4173 </table>
4175 </sect1>
4178 <sect1 id="catalog-pg-statistic">
4179 <title><structname>pg_statistic</structname></title>
4181 <indexterm zone="catalog-pg-statistic">
4182 <primary>pg_statistic</primary>
4183 </indexterm>
4185 <para>
4186 The catalog <structname>pg_statistic</structname> stores
4187 statistical data about the contents of the database. Entries are
4188 created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4189 and subsequently used by the query planner. There is one entry for
4190 each table column that has been analyzed. Note that all the
4191 statistical data is inherently approximate, even assuming that it
4192 is up-to-date.
4193 </para>
4195 <para>
4196 <structname>pg_statistic</structname> also stores statistical data about
4197 the values of index expressions. These are described as if they were
4198 actual data columns; in particular, <structfield>starelid</structfield>
4199 references the index. No entry is made for an ordinary non-expression
4200 index column, however, since it would be redundant with the entry
4201 for the underlying table column.
4202 </para>
4204 <para>
4205 Since different kinds of statistics might be appropriate for different
4206 kinds of data, <structname>pg_statistic</structname> is designed not
4207 to assume very much about what sort of statistics it stores. Only
4208 extremely general statistics (such as nullness) are given dedicated
4209 columns in <structname>pg_statistic</structname>. Everything else
4210 is stored in <quote>slots</quote>, which are groups of associated columns
4211 whose content is identified by a code number in one of the slot's columns.
4212 For more information see
4213 <filename>src/include/catalog/pg_statistic.h</filename>.
4214 </para>
4216 <para>
4217 <structname>pg_statistic</structname> should not be readable by the
4218 public, since even statistical information about a table's contents
4219 might be considered sensitive. (Example: minimum and maximum values
4220 of a salary column might be quite interesting.)
4221 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4222 is a publicly readable view on
4223 <structname>pg_statistic</structname> that only exposes information
4224 about those tables that are readable by the current user.
4225 </para>
4227 <table>
4228 <title><structname>pg_statistic</> Columns</title>
4230 <tgroup cols="4">
4231 <thead>
4232 <row>
4233 <entry>Name</entry>
4234 <entry>Type</entry>
4235 <entry>References</entry>
4236 <entry>Description</entry>
4237 </row>
4238 </thead>
4240 <tbody>
4241 <row>
4242 <entry><structfield>starelid</structfield></entry>
4243 <entry><type>oid</type></entry>
4244 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4245 <entry>The table or index that the described column belongs to</entry>
4246 </row>
4248 <row>
4249 <entry><structfield>staattnum</structfield></entry>
4250 <entry><type>int2</type></entry>
4251 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4252 <entry>The number of the described column</entry>
4253 </row>
4255 <row>
4256 <entry><structfield>stanullfrac</structfield></entry>
4257 <entry><type>float4</type></entry>
4258 <entry></entry>
4259 <entry>The fraction of the column's entries that are null</entry>
4260 </row>
4262 <row>
4263 <entry><structfield>stawidth</structfield></entry>
4264 <entry><type>int4</type></entry>
4265 <entry></entry>
4266 <entry>The average stored width, in bytes, of nonnull entries</entry>
4267 </row>
4269 <row>
4270 <entry><structfield>stadistinct</structfield></entry>
4271 <entry><type>float4</type></entry>
4272 <entry></entry>
4273 <entry>The number of distinct nonnull data values in the column.
4274 A value greater than zero is the actual number of distinct values.
4275 A value less than zero is the negative of a fraction of the number
4276 of rows in the table (for example, a column in which values appear about
4277 twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4278 A zero value means the number of distinct values is unknown
4279 </entry>
4280 </row>
4282 <row>
4283 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4284 <entry><type>int2</type></entry>
4285 <entry></entry>
4286 <entry>
4287 A code number indicating the kind of statistics stored in the
4288 <replaceable>N</>th <quote>slot</quote> of the
4289 <structname>pg_statistic</structname> row
4290 </entry>
4291 </row>
4293 <row>
4294 <entry><structfield>staop<replaceable>N</></structfield></entry>
4295 <entry><type>oid</type></entry>
4296 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4297 <entry>
4298 An operator used to derive the statistics stored in the
4299 <replaceable>N</>th <quote>slot</quote>. For example, a
4300 histogram slot would show the <literal>&lt;</literal> operator
4301 that defines the sort order of the data
4302 </entry>
4303 </row>
4305 <row>
4306 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4307 <entry><type>float4[]</type></entry>
4308 <entry></entry>
4309 <entry>
4310 Numerical statistics of the appropriate kind for the
4311 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4312 kind does not involve numerical values
4313 </entry>
4314 </row>
4316 <row>
4317 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4318 <entry><type>anyarray</type></entry>
4319 <entry></entry>
4320 <entry>
4321 Column data values of the appropriate kind for the
4322 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4323 kind does not store any data values. Each array's element
4324 values are actually of the specific column's data type, so there
4325 is no way to define these columns' type more specifically than
4326 <type>anyarray</>
4327 </entry>
4328 </row>
4329 </tbody>
4330 </tgroup>
4331 </table>
4333 </sect1>
4336 <sect1 id="catalog-pg-tablespace">
4337 <title><structname>pg_tablespace</structname></title>
4339 <indexterm zone="catalog-pg-tablespace">
4340 <primary>pg_tablespace</primary>
4341 </indexterm>
4343 <para>
4344 The catalog <structname>pg_tablespace</structname> stores information
4345 about the available tablespaces. Tables can be placed in particular
4346 tablespaces to aid administration of disk layout.
4347 </para>
4349 <para>
4350 Unlike most system catalogs, <structname>pg_tablespace</structname>
4351 is shared across all databases of a cluster: there is only one
4352 copy of <structname>pg_tablespace</structname> per cluster, not
4353 one per database.
4354 </para>
4356 <table>
4357 <title><structname>pg_tablespace</> Columns</title>
4359 <tgroup cols="4">
4360 <thead>
4361 <row>
4362 <entry>Name</entry>
4363 <entry>Type</entry>
4364 <entry>References</entry>
4365 <entry>Description</entry>
4366 </row>
4367 </thead>
4369 <tbody>
4370 <row>
4371 <entry><structfield>spcname</structfield></entry>
4372 <entry><type>name</type></entry>
4373 <entry></entry>
4374 <entry>Tablespace name</entry>
4375 </row>
4377 <row>
4378 <entry><structfield>spcowner</structfield></entry>
4379 <entry><type>oid</type></entry>
4380 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4381 <entry>Owner of the tablespace, usually the user who created it</entry>
4382 </row>
4384 <row>
4385 <entry><structfield>spclocation</structfield></entry>
4386 <entry><type>text</type></entry>
4387 <entry></entry>
4388 <entry>Location (directory path) of the tablespace</entry>
4389 </row>
4391 <row>
4392 <entry><structfield>spcacl</structfield></entry>
4393 <entry><type>aclitem[]</type></entry>
4394 <entry></entry>
4395 <entry>
4396 Access privileges; see
4397 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4398 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4399 for details
4400 </entry>
4401 </row>
4402 </tbody>
4403 </tgroup>
4404 </table>
4405 </sect1>
4408 <sect1 id="catalog-pg-trigger">
4409 <title><structname>pg_trigger</structname></title>
4411 <indexterm zone="catalog-pg-trigger">
4412 <primary>pg_trigger</primary>
4413 </indexterm>
4415 <para>
4416 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4417 See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4418 for more information.
4419 </para>
4421 <table>
4422 <title><structname>pg_trigger</> Columns</title>
4424 <tgroup cols="4">
4425 <thead>
4426 <row>
4427 <entry>Name</entry>
4428 <entry>Type</entry>
4429 <entry>References</entry>
4430 <entry>Description</entry>
4431 </row>
4432 </thead>
4434 <tbody>
4435 <row>
4436 <entry><structfield>tgrelid</structfield></entry>
4437 <entry><type>oid</type></entry>
4438 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4439 <entry>The table this trigger is on</entry>
4440 </row>
4442 <row>
4443 <entry><structfield>tgname</structfield></entry>
4444 <entry><type>name</type></entry>
4445 <entry></entry>
4446 <entry>Trigger name (must be unique among triggers of same table)</entry>
4447 </row>
4449 <row>
4450 <entry><structfield>tgfoid</structfield></entry>
4451 <entry><type>oid</type></entry>
4452 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4453 <entry>The function to be called</entry>
4454 </row>
4456 <row>
4457 <entry><structfield>tgtype</structfield></entry>
4458 <entry><type>int2</type></entry>
4459 <entry></entry>
4460 <entry>Bit mask identifying trigger conditions</entry>
4461 </row>
4463 <row>
4464 <entry><structfield>tgenabled</structfield></entry>
4465 <entry><type>char</type></entry>
4466 <entry></entry>
4467 <entry>
4468 Controls in which <xref linkend="guc-session-replication-role"> modes
4469 the trigger fires.
4470 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4471 <literal>D</> = trigger is disabled,
4472 <literal>R</> = trigger fires in <quote>replica</> mode,
4473 <literal>A</> = trigger fires always.
4474 </entry>
4475 </row>
4477 <row>
4478 <entry><structfield>tgisconstraint</structfield></entry>
4479 <entry><type>bool</type></entry>
4480 <entry></entry>
4481 <entry>True if trigger is a <quote>constraint trigger</></entry>
4482 </row>
4484 <row>
4485 <entry><structfield>tgconstrname</structfield></entry>
4486 <entry><type>name</type></entry>
4487 <entry></entry>
4488 <entry>Constraint name, if a constraint trigger</entry>
4489 </row>
4491 <row>
4492 <entry><structfield>tgconstrrelid</structfield></entry>
4493 <entry><type>oid</type></entry>
4494 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4495 <entry>The table referenced by a referential integrity constraint</entry>
4496 </row>
4498 <row>
4499 <entry><structfield>tgconstraint</structfield></entry>
4500 <entry><type>oid</type></entry>
4501 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4502 <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4503 </row>
4505 <row>
4506 <entry><structfield>tgdeferrable</structfield></entry>
4507 <entry><type>bool</type></entry>
4508 <entry></entry>
4509 <entry>True if constraint trigger is deferrable</entry>
4510 </row>
4512 <row>
4513 <entry><structfield>tginitdeferred</structfield></entry>
4514 <entry><type>bool</type></entry>
4515 <entry></entry>
4516 <entry>True if constraint trigger is initially deferred</entry>
4517 </row>
4519 <row>
4520 <entry><structfield>tgnargs</structfield></entry>
4521 <entry><type>int2</type></entry>
4522 <entry></entry>
4523 <entry>Number of argument strings passed to trigger function</entry>
4524 </row>
4526 <row>
4527 <entry><structfield>tgattr</structfield></entry>
4528 <entry><type>int2vector</type></entry>
4529 <entry></entry>
4530 <entry>Currently unused</entry>
4531 </row>
4533 <row>
4534 <entry><structfield>tgargs</structfield></entry>
4535 <entry><type>bytea</type></entry>
4536 <entry></entry>
4537 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4538 </row>
4539 </tbody>
4540 </tgroup>
4541 </table>
4543 <note>
4544 <para>
4545 When <structfield>tgconstraint</> is nonzero,
4546 <structfield>tgisconstraint</> must be true, and
4547 <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4548 <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4549 with the referenced <structname>pg_constraint</> entry. The reason we
4550 keep these fields is that we support <quote>stand-alone</> constraint
4551 triggers with no corresponding <structname>pg_constraint</> entry.
4552 </para>
4553 </note>
4555 <note>
4556 <para>
4557 <literal>pg_class.relhastriggers</literal>
4558 must be true if a table has any triggers in this catalog.
4559 </para>
4560 </note>
4562 </sect1>
4565 <sect1 id="catalog-pg-ts-config">
4566 <title><structname>pg_ts_config</structname></title>
4568 <indexterm zone="catalog-pg-ts-config">
4569 <primary>pg_ts_config</primary>
4570 </indexterm>
4572 <para>
4573 The <structname>pg_ts_config</structname> catalog contains entries
4574 representing text search configurations. A configuration specifies
4575 a particular text search parser and a list of dictionaries to use
4576 for each of the parser's output token types. The parser is shown
4577 in the <structname>pg_ts_config</structname> entry, but the
4578 token-to-dictionary mapping is defined by subsidiary entries in <link
4579 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4580 </para>
4582 <para>
4583 <productname>PostgreSQL</productname>'s text search features are
4584 described at length in <xref linkend="textsearch">.
4585 </para>
4587 <table>
4588 <title><structname>pg_ts_config</> Columns</title>
4590 <tgroup cols="4">
4591 <thead>
4592 <row>
4593 <entry>Name</entry>
4594 <entry>Type</entry>
4595 <entry>References</entry>
4596 <entry>Description</entry>
4597 </row>
4598 </thead>
4600 <tbody>
4601 <row>
4602 <entry><structfield>cfgname</structfield></entry>
4603 <entry><type>name</type></entry>
4604 <entry></entry>
4605 <entry>Text search configuration name</entry>
4606 </row>
4608 <row>
4609 <entry><structfield>cfgnamespace</structfield></entry>
4610 <entry><type>oid</type></entry>
4611 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4612 <entry>
4613 The OID of the namespace that contains this configuration
4614 </entry>
4615 </row>
4617 <row>
4618 <entry><structfield>cfgowner</structfield></entry>
4619 <entry><type>oid</type></entry>
4620 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4621 <entry>Owner of the configuration</entry>
4622 </row>
4624 <row>
4625 <entry><structfield>cfgparser</structfield></entry>
4626 <entry><type>oid</type></entry>
4627 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4628 <entry>The OID of the text search parser for this configuration</entry>
4629 </row>
4630 </tbody>
4631 </tgroup>
4632 </table>
4633 </sect1>
4636 <sect1 id="catalog-pg-ts-config-map">
4637 <title><structname>pg_ts_config_map</structname></title>
4639 <indexterm zone="catalog-pg-ts-config-map">
4640 <primary>pg_ts_config_map</primary>
4641 </indexterm>
4643 <para>
4644 The <structname>pg_ts_config_map</structname> catalog contains entries
4645 showing which text search dictionaries should be consulted, and in
4646 what order, for each output token type of each text search configuration's
4647 parser.
4648 </para>
4650 <para>
4651 <productname>PostgreSQL</productname>'s text search features are
4652 described at length in <xref linkend="textsearch">.
4653 </para>
4655 <table>
4656 <title><structname>pg_ts_config_map</> Columns</title>
4658 <tgroup cols="4">
4659 <thead>
4660 <row>
4661 <entry>Name</entry>
4662 <entry>Type</entry>
4663 <entry>References</entry>
4664 <entry>Description</entry>
4665 </row>
4666 </thead>
4668 <tbody>
4669 <row>
4670 <entry><structfield>mapcfg</structfield></entry>
4671 <entry><type>oid</type></entry>
4672 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4673 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4674 </row>
4676 <row>
4677 <entry><structfield>maptokentype</structfield></entry>
4678 <entry><type>integer</type></entry>
4679 <entry></entry>
4680 <entry>A token type emitted by the configuration's parser</entry>
4681 </row>
4683 <row>
4684 <entry><structfield>mapseqno</structfield></entry>
4685 <entry><type>integer</type></entry>
4686 <entry></entry>
4687 <entry>Order in which to consult this entry (lower
4688 <structfield>mapseqno</>s first)</entry>
4689 </row>
4691 <row>
4692 <entry><structfield>mapdict</structfield></entry>
4693 <entry><type>oid</type></entry>
4694 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4695 <entry>The OID of the text search dictionary to consult</entry>
4696 </row>
4697 </tbody>
4698 </tgroup>
4699 </table>
4700 </sect1>
4703 <sect1 id="catalog-pg-ts-dict">
4704 <title><structname>pg_ts_dict</structname></title>
4706 <indexterm zone="catalog-pg-ts-dict">
4707 <primary>pg_ts_dict</primary>
4708 </indexterm>
4710 <para>
4711 The <structname>pg_ts_dict</structname> catalog contains entries
4712 defining text search dictionaries. A dictionary depends on a text
4713 search template, which specifies all the implementation functions
4714 needed; the dictionary itself provides values for the user-settable
4715 parameters supported by the template. This division of labor allows
4716 dictionaries to be created by unprivileged users. The parameters
4717 are specified by a text string <structfield>dictinitoption</>,
4718 whose format and meaning vary depending on the template.
4719 </para>
4721 <para>
4722 <productname>PostgreSQL</productname>'s text search features are
4723 described at length in <xref linkend="textsearch">.
4724 </para>
4726 <table>
4727 <title><structname>pg_ts_dict</> Columns</title>
4729 <tgroup cols="4">
4730 <thead>
4731 <row>
4732 <entry>Name</entry>
4733 <entry>Type</entry>
4734 <entry>References</entry>
4735 <entry>Description</entry>
4736 </row>
4737 </thead>
4739 <tbody>
4740 <row>
4741 <entry><structfield>dictname</structfield></entry>
4742 <entry><type>name</type></entry>
4743 <entry></entry>
4744 <entry>Text search dictionary name</entry>
4745 </row>
4747 <row>
4748 <entry><structfield>dictnamespace</structfield></entry>
4749 <entry><type>oid</type></entry>
4750 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4751 <entry>
4752 The OID of the namespace that contains this dictionary
4753 </entry>
4754 </row>
4756 <row>
4757 <entry><structfield>dictowner</structfield></entry>
4758 <entry><type>oid</type></entry>
4759 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4760 <entry>Owner of the dictionary</entry>
4761 </row>
4763 <row>
4764 <entry><structfield>dicttemplate</structfield></entry>
4765 <entry><type>oid</type></entry>
4766 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4767 <entry>The OID of the text search template for this dictionary</entry>
4768 </row>
4770 <row>
4771 <entry><structfield>dictinitoption</structfield></entry>
4772 <entry><type>text</type></entry>
4773 <entry></entry>
4774 <entry>Initialization option string for the template</entry>
4775 </row>
4776 </tbody>
4777 </tgroup>
4778 </table>
4779 </sect1>
4782 <sect1 id="catalog-pg-ts-parser">
4783 <title><structname>pg_ts_parser</structname></title>
4785 <indexterm zone="catalog-pg-ts-parser">
4786 <primary>pg_ts_parser</primary>
4787 </indexterm>
4789 <para>
4790 The <structname>pg_ts_parser</structname> catalog contains entries
4791 defining text search parsers. A parser is responsible for splitting
4792 input text into lexemes and assigning a token type to each lexeme.
4793 Since a parser must be implemented by C-language-level functions,
4794 creation of new parsers is restricted to database superusers.
4795 </para>
4797 <para>
4798 <productname>PostgreSQL</productname>'s text search features are
4799 described at length in <xref linkend="textsearch">.
4800 </para>
4802 <table>
4803 <title><structname>pg_ts_parser</> Columns</title>
4805 <tgroup cols="4">
4806 <thead>
4807 <row>
4808 <entry>Name</entry>
4809 <entry>Type</entry>
4810 <entry>References</entry>
4811 <entry>Description</entry>
4812 </row>
4813 </thead>
4815 <tbody>
4816 <row>
4817 <entry><structfield>prsname</structfield></entry>
4818 <entry><type>name</type></entry>
4819 <entry></entry>
4820 <entry>Text search parser name</entry>
4821 </row>
4823 <row>
4824 <entry><structfield>prsnamespace</structfield></entry>
4825 <entry><type>oid</type></entry>
4826 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4827 <entry>
4828 The OID of the namespace that contains this parser
4829 </entry>
4830 </row>
4832 <row>
4833 <entry><structfield>prsstart</structfield></entry>
4834 <entry><type>regproc</type></entry>
4835 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4836 <entry>OID of the parser's startup function</entry>
4837 </row>
4839 <row>
4840 <entry><structfield>prstoken</structfield></entry>
4841 <entry><type>regproc</type></entry>
4842 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4843 <entry>OID of the parser's next-token function</entry>
4844 </row>
4846 <row>
4847 <entry><structfield>prsend</structfield></entry>
4848 <entry><type>regproc</type></entry>
4849 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4850 <entry>OID of the parser's shutdown function</entry>
4851 </row>
4853 <row>
4854 <entry><structfield>prsheadline</structfield></entry>
4855 <entry><type>regproc</type></entry>
4856 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4857 <entry>OID of the parser's headline function</entry>
4858 </row>
4860 <row>
4861 <entry><structfield>prslextype</structfield></entry>
4862 <entry><type>regproc</type></entry>
4863 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4864 <entry>OID of the parser's lextype function</entry>
4865 </row>
4866 </tbody>
4867 </tgroup>
4868 </table>
4869 </sect1>
4872 <sect1 id="catalog-pg-ts-template">
4873 <title><structname>pg_ts_template</structname></title>
4875 <indexterm zone="catalog-pg-ts-template">
4876 <primary>pg_ts_template</primary>
4877 </indexterm>
4879 <para>
4880 The <structname>pg_ts_template</structname> catalog contains entries
4881 defining text search templates. A template is the implementation
4882 skeleton for a class of text search dictionaries.
4883 Since a template must be implemented by C-language-level functions,
4884 creation of new templates is restricted to database superusers.
4885 </para>
4887 <para>
4888 <productname>PostgreSQL</productname>'s text search features are
4889 described at length in <xref linkend="textsearch">.
4890 </para>
4892 <table>
4893 <title><structname>pg_ts_template</> Columns</title>
4895 <tgroup cols="4">
4896 <thead>
4897 <row>
4898 <entry>Name</entry>
4899 <entry>Type</entry>
4900 <entry>References</entry>
4901 <entry>Description</entry>
4902 </row>
4903 </thead>
4905 <tbody>
4906 <row>
4907 <entry><structfield>tmplname</structfield></entry>
4908 <entry><type>name</type></entry>
4909 <entry></entry>
4910 <entry>Text search template name</entry>
4911 </row>
4913 <row>
4914 <entry><structfield>tmplnamespace</structfield></entry>
4915 <entry><type>oid</type></entry>
4916 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4917 <entry>
4918 The OID of the namespace that contains this template
4919 </entry>
4920 </row>
4922 <row>
4923 <entry><structfield>tmplinit</structfield></entry>
4924 <entry><type>regproc</type></entry>
4925 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4926 <entry>OID of the template's initialization function</entry>
4927 </row>
4929 <row>
4930 <entry><structfield>tmpllexize</structfield></entry>
4931 <entry><type>regproc</type></entry>
4932 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4933 <entry>OID of the template's lexize function</entry>
4934 </row>
4935 </tbody>
4936 </tgroup>
4937 </table>
4938 </sect1>
4941 <sect1 id="catalog-pg-type">
4942 <title><structname>pg_type</structname></title>
4944 <indexterm zone="catalog-pg-type">
4945 <primary>pg_type</primary>
4946 </indexterm>
4948 <para>
4949 The catalog <structname>pg_type</structname> stores information about data
4950 types. Base types and enum types (scalar types) are created with
4951 <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
4952 domains with
4953 <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
4954 A composite type is automatically created for each table in the database, to
4955 represent the row structure of the table. It is also possible to create
4956 composite types with <command>CREATE TYPE AS</command>.
4957 </para>
4959 <table>
4960 <title><structname>pg_type</> Columns</title>
4962 <tgroup cols="4">
4963 <thead>
4964 <row>
4965 <entry>Name</entry>
4966 <entry>Type</entry>
4967 <entry>References</entry>
4968 <entry>Description</entry>
4969 </row>
4970 </thead>
4972 <tbody>
4973 <row>
4974 <entry><structfield>typname</structfield></entry>
4975 <entry><type>name</type></entry>
4976 <entry></entry>
4977 <entry>Data type name</entry>
4978 </row>
4980 <row>
4981 <entry><structfield>typnamespace</structfield></entry>
4982 <entry><type>oid</type></entry>
4983 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4984 <entry>
4985 The OID of the namespace that contains this type
4986 </entry>
4987 </row>
4989 <row>
4990 <entry><structfield>typowner</structfield></entry>
4991 <entry><type>oid</type></entry>
4992 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4993 <entry>Owner of the type</entry>
4994 </row>
4996 <row>
4997 <entry><structfield>typlen</structfield></entry>
4998 <entry><type>int2</type></entry>
4999 <entry></entry>
5000 <entry>
5001 For a fixed-size type, <structfield>typlen</structfield> is the number
5002 of bytes in the internal representation of the type. But for a
5003 variable-length type, <structfield>typlen</structfield> is negative.
5004 -1 indicates a <quote>varlena</> type (one that has a length word),
5005 -2 indicates a null-terminated C string.
5006 </entry>
5007 </row>
5009 <row>
5010 <entry><structfield>typbyval</structfield></entry>
5011 <entry><type>bool</type></entry>
5012 <entry></entry>
5013 <entry>
5014 <structfield>typbyval</structfield> determines whether internal
5015 routines pass a value of this type by value or by reference.
5016 <structfield>typbyval</structfield> had better be false if
5017 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
5018 where Datum is 8 bytes).
5019 Variable-length types are always passed by reference. Note that
5020 <structfield>typbyval</structfield> can be false even if the
5021 length would allow pass-by-value
5022 </entry>
5023 </row>
5025 <row>
5026 <entry><structfield>typtype</structfield></entry>
5027 <entry><type>char</type></entry>
5028 <entry></entry>
5029 <entry>
5030 <structfield>typtype</structfield> is
5031 <literal>b</literal> for a base type,
5032 <literal>c</literal> for a composite type (e.g., a table's row type),
5033 <literal>d</literal> for a domain,
5034 <literal>e</literal> for an enum type,
5035 or <literal>p</literal> for a pseudo-type.
5036 See also <structfield>typrelid</structfield> and
5037 <structfield>typbasetype</structfield>
5038 </entry>
5039 </row>
5041 <row>
5042 <entry><structfield>typcategory</structfield></entry>
5043 <entry><type>char</type></entry>
5044 <entry></entry>
5045 <entry>
5046 <structfield>typcategory</structfield> is an arbitrary classification
5047 of data types that is used by the parser to determine which implicit
5048 casts should be <quote>preferred</>.
5049 See <xref linkend="catalog-typcategory-table">
5050 </entry>
5051 </row>
5053 <row>
5054 <entry><structfield>typispreferred</structfield></entry>
5055 <entry><type>bool</type></entry>
5056 <entry></entry>
5057 <entry>
5058 True if the type is a preferred cast target within its
5059 <structfield>typcategory</structfield>
5060 </entry>
5061 </row>
5063 <row>
5064 <entry><structfield>typisdefined</structfield></entry>
5065 <entry><type>bool</type></entry>
5066 <entry></entry>
5067 <entry>
5068 True if the type is defined, false if this is a placeholder
5069 entry for a not-yet-defined type. When
5070 <structfield>typisdefined</structfield> is false, nothing
5071 except the type name, namespace, and OID can be relied on
5072 </entry>
5073 </row>
5075 <row>
5076 <entry><structfield>typdelim</structfield></entry>
5077 <entry><type>char</type></entry>
5078 <entry></entry>
5079 <entry>
5080 Character that separates two values of this type when parsing
5081 array input. Note that the delimiter is associated with the array
5082 element data type, not the array data type
5083 </entry>
5084 </row>
5086 <row>
5087 <entry><structfield>typrelid</structfield></entry>
5088 <entry><type>oid</type></entry>
5089 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5090 <entry>
5091 If this is a composite type (see
5092 <structfield>typtype</structfield>), then this column points to
5093 the <structname>pg_class</structname> entry that defines the
5094 corresponding table. (For a free-standing composite type, the
5095 <structname>pg_class</structname> entry doesn't really represent
5096 a table, but it is needed anyway for the type's
5097 <structname>pg_attribute</structname> entries to link to.)
5098 Zero for non-composite types
5099 </entry>
5100 </row>
5102 <row>
5103 <entry><structfield>typelem</structfield></entry>
5104 <entry><type>oid</type></entry>
5105 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5106 <entry>
5107 If <structfield>typelem</structfield> is not 0 then it
5108 identifies another row in <structname>pg_type</structname>.
5109 The current type can then be subscripted like an array yielding
5110 values of type <structfield>typelem</structfield>. A
5111 <quote>true</quote> array type is variable length
5112 (<structfield>typlen</structfield> = -1),
5113 but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
5114 also have nonzero <structfield>typelem</structfield>, for example
5115 <type>name</type> and <type>point</type>.
5116 If a fixed-length type has a <structfield>typelem</structfield> then
5117 its internal representation must be some number of values of the
5118 <structfield>typelem</structfield> data type with no other data.
5119 Variable-length array types have a header defined by the array
5120 subroutines
5121 </entry>
5122 </row>
5124 <row>
5125 <entry><structfield>typarray</structfield></entry>
5126 <entry><type>oid</type></entry>
5127 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5128 <entry>
5129 If <structfield>typarray</structfield> is not 0 then it
5130 identifies another row in <structname>pg_type</structname>, which
5131 is the <quote>true</quote> array type having this type as element
5132 </entry>
5133 </row>
5135 <row>
5136 <entry><structfield>typinput</structfield></entry>
5137 <entry><type>regproc</type></entry>
5138 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5139 <entry>Input conversion function (text format)</entry>
5140 </row>
5142 <row>
5143 <entry><structfield>typoutput</structfield></entry>
5144 <entry><type>regproc</type></entry>
5145 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5146 <entry>Output conversion function (text format)</entry>
5147 </row>
5149 <row>
5150 <entry><structfield>typreceive</structfield></entry>
5151 <entry><type>regproc</type></entry>
5152 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5153 <entry>Input conversion function (binary format), or 0 if none</entry>
5154 </row>
5156 <row>
5157 <entry><structfield>typsend</structfield></entry>
5158 <entry><type>regproc</type></entry>
5159 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5160 <entry>Output conversion function (binary format), or 0 if none</entry>
5161 </row>
5163 <row>
5164 <entry><structfield>typmodin</structfield></entry>
5165 <entry><type>regproc</type></entry>
5166 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5167 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5168 </row>
5170 <row>
5171 <entry><structfield>typmodout</structfield></entry>
5172 <entry><type>regproc</type></entry>
5173 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5174 <entry>Type modifier output function, or 0 to use the standard format</entry>
5175 </row>
5177 <row>
5178 <entry><structfield>typanalyze</structfield></entry>
5179 <entry><type>regproc</type></entry>
5180 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5181 <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5182 </row>
5184 <row>
5185 <entry><structfield>typalign</structfield></entry>
5186 <entry><type>char</type></entry>
5187 <entry></entry>
5188 <entry><para>
5190 <structfield>typalign</structfield> is the alignment required
5191 when storing a value of this type. It applies to storage on
5192 disk as well as most representations of the value inside
5193 <productname>PostgreSQL</>.
5194 When multiple values are stored consecutively, such
5195 as in the representation of a complete row on disk, padding is
5196 inserted before a datum of this type so that it begins on the
5197 specified boundary. The alignment reference is the beginning
5198 of the first datum in the sequence.
5199 </para><para>
5200 Possible values are:
5201 <itemizedlist>
5202 <listitem>
5203 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5204 </listitem>
5205 <listitem>
5206 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5207 </listitem>
5208 <listitem>
5209 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5210 </listitem>
5211 <listitem>
5212 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5213 </listitem>
5214 </itemizedlist>
5215 </para><note>
5216 <para>
5217 For types used in system tables, it is critical that the size
5218 and alignment defined in <structname>pg_type</structname>
5219 agree with the way that the compiler will lay out the column in
5220 a structure representing a table row.
5221 </para>
5222 </note></entry>
5223 </row>
5225 <row>
5226 <entry><structfield>typstorage</structfield></entry>
5227 <entry><type>char</type></entry>
5228 <entry></entry>
5229 <entry><para>
5230 <structfield>typstorage</structfield> tells for varlena
5231 types (those with <structfield>typlen</structfield> = -1) if
5232 the type is prepared for toasting and what the default strategy
5233 for attributes of this type should be.
5234 Possible values are
5235 <itemizedlist>
5236 <listitem>
5237 <para><literal>p</>: Value must always be stored plain.</para>
5238 </listitem>
5239 <listitem>
5240 <para>
5241 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5242 relation (if relation has one, see
5243 <literal>pg_class.reltoastrelid</literal>).
5244 </para>
5245 </listitem>
5246 <listitem>
5247 <para><literal>m</>: Value can be stored compressed inline.</para>
5248 </listitem>
5249 <listitem>
5250 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5251 </listitem>
5252 </itemizedlist>
5253 Note that <literal>m</> columns can also be moved out to secondary
5254 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5255 moved first).
5256 </para></entry>
5257 </row>
5259 <row>
5260 <entry><structfield>typnotnull</structfield></entry>
5261 <entry><type>bool</type></entry>
5262 <entry></entry>
5263 <entry><para>
5264 <structfield>typnotnull</structfield> represents a not-null
5265 constraint on a type. Used for domains only
5266 </para></entry>
5267 </row>
5269 <row>
5270 <entry><structfield>typbasetype</structfield></entry>
5271 <entry><type>oid</type></entry>
5272 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5273 <entry><para>
5274 If this is a domain (see <structfield>typtype</structfield>), then
5275 <structfield>typbasetype</structfield> identifies the type that this
5276 one is based on. Zero if this type is not a domain
5277 </para></entry>
5278 </row>
5280 <row>
5281 <entry><structfield>typtypmod</structfield></entry>
5282 <entry><type>int4</type></entry>
5283 <entry></entry>
5284 <entry><para>
5285 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5286 to be applied to their base type (-1 if base type does not use a
5287 <literal>typmod</>). -1 if this type is not a domain
5288 </para></entry>
5289 </row>
5291 <row>
5292 <entry><structfield>typndims</structfield></entry>
5293 <entry><type>int4</type></entry>
5294 <entry></entry>
5295 <entry><para>
5296 <structfield>typndims</structfield> is the number of array dimensions
5297 for a domain that is an array (that is, <structfield>typbasetype</> is
5298 an array type; the domain's <structfield>typelem</> will match the base
5299 type's <structfield>typelem</structfield>).
5300 Zero for types other than domains over array types
5301 </para></entry>
5302 </row>
5304 <row>
5305 <entry><structfield>typdefaultbin</structfield></entry>
5306 <entry><type>text</type></entry>
5307 <entry></entry>
5308 <entry><para>
5309 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5310 representation of a default expression for the type. This is
5311 only used for domains
5312 </para></entry>
5313 </row>
5315 <row>
5316 <entry><structfield>typdefault</structfield></entry>
5317 <entry><type>text</type></entry>
5318 <entry></entry>
5319 <entry><para>
5320 <structfield>typdefault</> is null if the type has no associated
5321 default value. If <structfield>typdefaultbin</> is not null,
5322 <structfield>typdefault</> must contain a human-readable version of the
5323 default expression represented by <structfield>typdefaultbin</>. If
5324 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5325 not, then <structfield>typdefault</> is the external representation of
5326 the type's default value, which might be fed to the type's input
5327 converter to produce a constant
5328 </para></entry>
5329 </row>
5330 </tbody>
5331 </tgroup>
5332 </table>
5334 <para>
5335 <xref linkend="catalog-typcategory-table"> lists the system-defined values
5336 of <structfield>typcategory</>. Any future additions to this list will
5337 also be upper-case ASCII letters. All other ASCII characters are reserved
5338 for user-defined categories.
5339 </para>
5341 <table id="catalog-typcategory-table">
5342 <title><structfield>typcategory</> Codes</title>
5344 <tgroup cols="2">
5345 <thead>
5346 <row>
5347 <entry>Code</entry>
5348 <entry>Category</entry>
5349 </row>
5350 </thead>
5352 <tbody>
5353 <row>
5354 <entry><literal>A</literal></entry>
5355 <entry>Array types</entry>
5356 </row>
5357 <row>
5358 <entry><literal>B</literal></entry>
5359 <entry>Boolean types</entry>
5360 </row>
5361 <row>
5362 <entry><literal>C</literal></entry>
5363 <entry>Composite types</entry>
5364 </row>
5365 <row>
5366 <entry><literal>D</literal></entry>
5367 <entry>Date/time types</entry>
5368 </row>
5369 <row>
5370 <entry><literal>E</literal></entry>
5371 <entry>Enum types</entry>
5372 </row>
5373 <row>
5374 <entry><literal>G</literal></entry>
5375 <entry>Geometric types</entry>
5376 </row>
5377 <row>
5378 <entry><literal>I</literal></entry>
5379 <entry>Network address types</entry>
5380 </row>
5381 <row>
5382 <entry><literal>N</literal></entry>
5383 <entry>Numeric types</entry>
5384 </row>
5385 <row>
5386 <entry><literal>P</literal></entry>
5387 <entry>Pseudo-types</entry>
5388 </row>
5389 <row>
5390 <entry><literal>S</literal></entry>
5391 <entry>String types</entry>
5392 </row>
5393 <row>
5394 <entry><literal>T</literal></entry>
5395 <entry>Timespan types</entry>
5396 </row>
5397 <row>
5398 <entry><literal>U</literal></entry>
5399 <entry>User-defined types</entry>
5400 </row>
5401 <row>
5402 <entry><literal>V</literal></entry>
5403 <entry>Bit-string types</entry>
5404 </row>
5405 <row>
5406 <entry><literal>X</literal></entry>
5407 <entry><type>unknown</> type</entry>
5408 </row>
5409 </tbody>
5410 </tgroup>
5411 </table>
5413 </sect1>
5416 <sect1 id="catalog-pg-user-mapping">
5417 <title><structname>pg_user_mapping</structname></title>
5419 <indexterm zone="catalog-pg-user-mapping">
5420 <primary>pg_user_mapping</primary>
5421 </indexterm>
5423 <para>
5424 The catalog <structname>pg_user_mapping</structname> stores
5425 the mappings from local user to remote. Access to this catalog is
5426 restricted from normal users, use the view
5427 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
5428 instead.
5429 </para>
5431 <table>
5432 <title><structname>pg_user_mapping</> Columns</title>
5434 <tgroup cols="4">
5435 <thead>
5436 <row>
5437 <entry>Name</entry>
5438 <entry>Type</entry>
5439 <entry>References</entry>
5440 <entry>Description</entry>
5441 </row>
5442 </thead>
5444 <tbody>
5445 <row>
5446 <entry><structfield>umuser</structfield></entry>
5447 <entry><type>oid</type></entry>
5448 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5449 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
5450 </row>
5452 <row>
5453 <entry><structfield>umserver</structfield></entry>
5454 <entry><type>oid</type></entry>
5455 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
5456 <entry>
5457 The OID of the foreign server that contains this mapping
5458 </entry>
5459 </row>
5461 <row>
5462 <entry><structfield>umoptions</structfield></entry>
5463 <entry><type>text[]</type></entry>
5464 <entry></entry>
5465 <entry>
5466 User mapping specific options, as <quote>keyword=value</> strings.
5467 </entry>
5468 </row>
5469 </tbody>
5470 </tgroup>
5471 </table>
5472 </sect1>
5475 <sect1 id="views-overview">
5476 <title>System Views</title>
5478 <para>
5479 In addition to the system catalogs, <productname>PostgreSQL</productname>
5480 provides a number of built-in views. Some system views provide convenient
5481 access to some commonly used queries on the system catalogs. Other views
5482 provide access to internal server state.
5483 </para>
5485 <para>
5486 The information schema (<xref linkend="information-schema">) provides
5487 an alternative set of views which overlap the functionality of the system
5488 views. Since the information schema is SQL-standard whereas the views
5489 described here are <productname>PostgreSQL</productname>-specific,
5490 it's usually better to use the information schema if it provides all
5491 the information you need.
5492 </para>
5494 <para>
5495 <xref linkend="view-table"> lists the system views described here.
5496 More detailed documentation of each view follows below.
5497 There are some additional views that provide access to the results of
5498 the statistics collector; they are described in <xref
5499 linkend="monitoring-stats-views-table">.
5500 </para>
5502 <para>
5503 Except where noted, all the views described here are read-only.
5504 </para>
5506 <table id="view-table">
5507 <title>System Views</title>
5509 <tgroup cols="2">
5510 <thead>
5511 <row>
5512 <entry>View Name</entry>
5513 <entry>Purpose</entry>
5514 </row>
5515 </thead>
5517 <tbody>
5518 <row>
5519 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5520 <entry>open cursors</entry>
5521 </row>
5523 <row>
5524 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5525 <entry>groups of database users</entry>
5526 </row>
5528 <row>
5529 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5530 <entry>indexes</entry>
5531 </row>
5533 <row>
5534 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5535 <entry>currently held locks</entry>
5536 </row>
5538 <row>
5539 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5540 <entry>prepared statements</entry>
5541 </row>
5543 <row>
5544 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5545 <entry>prepared transactions</entry>
5546 </row>
5548 <row>
5549 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5550 <entry>database roles</entry>
5551 </row>
5553 <row>
5554 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5555 <entry>rules</entry>
5556 </row>
5558 <row>
5559 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5560 <entry>parameter settings</entry>
5561 </row>
5563 <row>
5564 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5565 <entry>database users</entry>
5566 </row>
5568 <row>
5569 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5570 <entry>planner statistics</entry>
5571 </row>
5573 <row>
5574 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5575 <entry>tables</entry>
5576 </row>
5578 <row>
5579 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5580 <entry>time zone abbreviations</entry>
5581 </row>
5583 <row>
5584 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5585 <entry>time zone names</entry>
5586 </row>
5588 <row>
5589 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5590 <entry>database users</entry>
5591 </row>
5593 <row>
5594 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5595 <entry>views</entry>
5596 </row>
5598 </tbody>
5599 </tgroup>
5600 </table>
5601 </sect1>
5603 <sect1 id="view-pg-cursors">
5604 <title><structname>pg_cursors</structname></title>
5606 <indexterm zone="view-pg-cursors">
5607 <primary>pg_cursors</primary>
5608 </indexterm>
5610 <para>
5611 The <structname>pg_cursors</structname> view lists the cursors that
5612 are currently available. Cursors can be defined in several ways:
5613 <itemizedlist>
5614 <listitem>
5615 <para>
5616 via the <xref linkend="sql-declare" endterm="sql-declare-title">
5617 statement in SQL
5618 </para>
5619 </listitem>
5621 <listitem>
5622 <para>
5623 via the Bind message in the frontend/backend protocol, as
5624 described in <xref linkend="protocol-flow-ext-query">
5625 </para>
5626 </listitem>
5628 <listitem>
5629 <para>
5630 via the Server Programming Interface (SPI), as described in
5631 <xref linkend="spi-interface">
5632 </para>
5633 </listitem>
5634 </itemizedlist>
5636 The <structname>pg_cursors</structname> view displays cursors
5637 created by any of these means. Cursors only exist for the duration
5638 of the transaction that defines them, unless they have been
5639 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5640 cursors are only present in the view until the end of their
5641 creating transaction.
5643 <note>
5644 <para>
5645 Cursors are used internally to implement some of the components
5646 of <productname>PostgreSQL</>, such as procedural languages.
5647 Therefore, the <structname>pg_cursors</> view might include cursors
5648 that have not been explicitly created by the user.
5649 </para>
5650 </note>
5651 </para>
5653 <table>
5654 <title><structname>pg_cursors</> Columns</title>
5656 <tgroup cols="3">
5657 <thead>
5658 <row>
5659 <entry>Name</entry>
5660 <entry>Type</entry>
5661 <entry>Description</entry>
5662 </row>
5663 </thead>
5665 <tbody>
5666 <row>
5667 <entry><structfield>name</structfield></entry>
5668 <entry><type>text</type></entry>
5669 <entry>The name of the cursor</entry>
5670 </row>
5672 <row>
5673 <entry><structfield>statement</structfield></entry>
5674 <entry><type>text</type></entry>
5675 <entry>The verbatim query string submitted to declare this cursor</entry>
5676 </row>
5678 <row>
5679 <entry><structfield>is_holdable</structfield></entry>
5680 <entry><type>boolean</type></entry>
5681 <entry>
5682 <literal>true</literal> if the cursor is holdable (that is, it
5683 can be accessed after the transaction that declared the cursor
5684 has committed); <literal>false</literal> otherwise
5685 </entry>
5686 </row>
5688 <row>
5689 <entry><structfield>is_binary</structfield></entry>
5690 <entry><type>boolean</type></entry>
5691 <entry>
5692 <literal>true</literal> if the cursor was declared
5693 <literal>BINARY</literal>; <literal>false</literal>
5694 otherwise
5695 </entry>
5696 </row>
5698 <row>
5699 <entry><structfield>is_scrollable</structfield></entry>
5700 <entry><type>boolean</type></entry>
5701 <entry>
5702 <literal>true</> if the cursor is scrollable (that is, it
5703 allows rows to be retrieved in a nonsequential manner);
5704 <literal>false</literal> otherwise
5705 </entry>
5706 </row>
5708 <row>
5709 <entry><structfield>creation_time</structfield></entry>
5710 <entry><type>timestamptz</type></entry>
5711 <entry>The time at which the cursor was declared</entry>
5712 </row>
5713 </tbody>
5714 </tgroup>
5715 </table>
5717 <para>
5718 The <structname>pg_cursors</structname> view is read only.
5719 </para>
5721 </sect1>
5723 <sect1 id="view-pg-group">
5724 <title><structname>pg_group</structname></title>
5726 <indexterm zone="view-pg-group">
5727 <primary>pg_group</primary>
5728 </indexterm>
5730 <para>
5731 The view <structname>pg_group</structname> exists for backwards
5732 compatibility: it emulates a catalog that existed in
5733 <productname>PostgreSQL</productname> before version 8.1.
5734 It shows the names and members of all roles that are marked as not
5735 <structfield>rolcanlogin</>, which is an approximation to the set
5736 of roles that are being used as groups.
5737 </para>
5739 <table>
5740 <title><structname>pg_group</> Columns</title>
5742 <tgroup cols="4">
5743 <thead>
5744 <row>
5745 <entry>Name</entry>
5746 <entry>Type</entry>
5747 <entry>References</entry>
5748 <entry>Description</entry>
5749 </row>
5750 </thead>
5752 <tbody>
5753 <row>
5754 <entry><structfield>groname</structfield></entry>
5755 <entry><type>name</type></entry>
5756 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5757 <entry>Name of the group</entry>
5758 </row>
5760 <row>
5761 <entry><structfield>grosysid</structfield></entry>
5762 <entry><type>oid</type></entry>
5763 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5764 <entry>ID of this group</entry>
5765 </row>
5767 <row>
5768 <entry><structfield>grolist</structfield></entry>
5769 <entry><type>oid[]</type></entry>
5770 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5771 <entry>An array containing the IDs of the roles in this group</entry>
5772 </row>
5773 </tbody>
5774 </tgroup>
5775 </table>
5777 </sect1>
5779 <sect1 id="view-pg-indexes">
5780 <title><structname>pg_indexes</structname></title>
5782 <indexterm zone="view-pg-indexes">
5783 <primary>pg_indexes</primary>
5784 </indexterm>
5786 <para>
5787 The view <structname>pg_indexes</structname> provides access to
5788 useful information about each index in the database.
5789 </para>
5791 <table>
5792 <title><structname>pg_indexes</> Columns</title>
5794 <tgroup cols="4">
5795 <thead>
5796 <row>
5797 <entry>Name</entry>
5798 <entry>Type</entry>
5799 <entry>References</entry>
5800 <entry>Description</entry>
5801 </row>
5802 </thead>
5803 <tbody>
5804 <row>
5805 <entry><structfield>schemaname</structfield></entry>
5806 <entry><type>name</type></entry>
5807 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5808 <entry>Name of schema containing table and index</entry>
5809 </row>
5810 <row>
5811 <entry><structfield>tablename</structfield></entry>
5812 <entry><type>name</type></entry>
5813 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5814 <entry>Name of table the index is for</entry>
5815 </row>
5816 <row>
5817 <entry><structfield>indexname</structfield></entry>
5818 <entry><type>name</type></entry>
5819 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5820 <entry>Name of index</entry>
5821 </row>
5822 <row>
5823 <entry><structfield>tablespace</structfield></entry>
5824 <entry><type>name</type></entry>
5825 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
5826 <entry>Name of tablespace containing index (NULL if default for database)</entry>
5827 </row>
5828 <row>
5829 <entry><structfield>indexdef</structfield></entry>
5830 <entry><type>text</type></entry>
5831 <entry></entry>
5832 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
5833 command)</entry>
5834 </row>
5835 </tbody>
5836 </tgroup>
5837 </table>
5839 </sect1>
5841 <sect1 id="view-pg-locks">
5842 <title><structname>pg_locks</structname></title>
5844 <indexterm zone="view-pg-locks">
5845 <primary>pg_locks</primary>
5846 </indexterm>
5848 <para>
5849 The view <structname>pg_locks</structname> provides access to
5850 information about the locks held by open transactions within the
5851 database server. See <xref linkend="mvcc"> for more discussion
5852 of locking.
5853 </para>
5855 <para>
5856 <structname>pg_locks</structname> contains one row per active lockable
5857 object, requested lock mode, and relevant transaction. Thus, the same
5858 lockable object might
5859 appear many times, if multiple transactions are holding or waiting
5860 for locks on it. However, an object that currently has no locks on it
5861 will not appear at all.
5862 </para>
5864 <para>
5865 There are several distinct types of lockable objects:
5866 whole relations (e.g., tables), individual pages of relations,
5867 individual tuples of relations,
5868 transaction IDs (both virtual and permanent IDs),
5869 and general database objects (identified by class OID and object OID,
5870 in the same way as in <structname>pg_description</structname> or
5871 <structname>pg_depend</structname>). Also, the right to extend a
5872 relation is represented as a separate lockable object.
5873 </para>
5875 <table>
5876 <title><structname>pg_locks</> Columns</title>
5878 <tgroup cols="4">
5879 <thead>
5880 <row>
5881 <entry>Name</entry>
5882 <entry>Type</entry>
5883 <entry>References</entry>
5884 <entry>Description</entry>
5885 </row>
5886 </thead>
5887 <tbody>
5888 <row>
5889 <entry><structfield>locktype</structfield></entry>
5890 <entry><type>text</type></entry>
5891 <entry></entry>
5892 <entry>
5893 type of the lockable object:
5894 <literal>relation</>,
5895 <literal>extend</>,
5896 <literal>page</>,
5897 <literal>tuple</>,
5898 <literal>transactionid</>,
5899 <literal>virtualxid</>,
5900 <literal>object</>,
5901 <literal>userlock</>, or
5902 <literal>advisory</>
5903 </entry>
5904 </row>
5905 <row>
5906 <entry><structfield>database</structfield></entry>
5907 <entry><type>oid</type></entry>
5908 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5909 <entry>
5910 OID of the database in which the object exists, or
5911 zero if the object is a shared object, or
5912 NULL if the object is a transaction ID
5913 </entry>
5914 </row>
5915 <row>
5916 <entry><structfield>relation</structfield></entry>
5917 <entry><type>oid</type></entry>
5918 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5919 <entry>
5920 OID of the relation, or NULL if the object is not
5921 a relation or part of a relation
5922 </entry>
5923 </row>
5924 <row>
5925 <entry><structfield>page</structfield></entry>
5926 <entry><type>integer</type></entry>
5927 <entry></entry>
5928 <entry>
5929 Page number within the relation, or NULL if the object
5930 is not a tuple or relation page
5931 </entry>
5932 </row>
5933 <row>
5934 <entry><structfield>tuple</structfield></entry>
5935 <entry><type>smallint</type></entry>
5936 <entry></entry>
5937 <entry>
5938 Tuple number within the page, or NULL if the object is not a tuple
5939 </entry>
5940 </row>
5941 <row>
5942 <entry><structfield>virtualxid</structfield></entry>
5943 <entry><type>text</type></entry>
5944 <entry></entry>
5945 <entry>
5946 Virtual ID of a transaction, or NULL if the object is not a
5947 virtual transaction ID
5948 </entry>
5949 </row>
5950 <row>
5951 <entry><structfield>transactionid</structfield></entry>
5952 <entry><type>xid</type></entry>
5953 <entry></entry>
5954 <entry>
5955 ID of a transaction, or NULL if the object is not a transaction ID
5956 </entry>
5957 </row>
5958 <row>
5959 <entry><structfield>classid</structfield></entry>
5960 <entry><type>oid</type></entry>
5961 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5962 <entry>
5963 OID of the system catalog containing the object, or NULL if the
5964 object is not a general database object
5965 </entry>
5966 </row>
5967 <row>
5968 <entry><structfield>objid</structfield></entry>
5969 <entry><type>oid</type></entry>
5970 <entry>any OID column</entry>
5971 <entry>
5972 OID of the object within its system catalog, or NULL if the
5973 object is not a general database object.
5974 For advisory locks it is used to distinguish the two key
5975 spaces (<literal>1</> for an int8 key, <literal>2</> for two
5976 int4 keys).
5977 </entry>
5978 </row>
5979 <row>
5980 <entry><structfield>objsubid</structfield></entry>
5981 <entry><type>smallint</type></entry>
5982 <entry></entry>
5983 <entry>
5984 For a table column, this is the column number (the
5985 <structfield>classid</> and <structfield>objid</> refer to the
5986 table itself). For all other object types, this column is
5987 zero. NULL if the object is not a general database object
5988 </entry>
5989 </row>
5990 <row>
5991 <entry><structfield>virtualtransaction</structfield></entry>
5992 <entry><type>text</type></entry>
5993 <entry></entry>
5994 <entry>
5995 Virtual ID of the transaction that is holding or awaiting this lock
5996 </entry>
5997 </row>
5998 <row>
5999 <entry><structfield>pid</structfield></entry>
6000 <entry><type>integer</type></entry>
6001 <entry></entry>
6002 <entry>
6003 Process ID of the server process holding or awaiting this
6004 lock. NULL if the lock is held by a prepared transaction
6005 </entry>
6006 </row>
6007 <row>
6008 <entry><structfield>mode</structfield></entry>
6009 <entry><type>text</type></entry>
6010 <entry></entry>
6011 <entry>Name of the lock mode held or desired by this process (see <xref
6012 linkend="locking-tables">)</entry>
6013 </row>
6014 <row>
6015 <entry><structfield>granted</structfield></entry>
6016 <entry><type>boolean</type></entry>
6017 <entry></entry>
6018 <entry>True if lock is held, false if lock is awaited</entry>
6019 </row>
6020 </tbody>
6021 </tgroup>
6022 </table>
6024 <para>
6025 <structfield>granted</structfield> is true in a row representing a lock
6026 held by the indicated transaction. False indicates that this transaction is
6027 currently waiting to acquire this lock, which implies that some other
6028 transaction is holding a conflicting lock mode on the same lockable object.
6029 The waiting transaction will sleep until the other lock is released (or a
6030 deadlock situation is detected). A single transaction can be waiting to
6031 acquire at most one lock at a time.
6032 </para>
6034 <para>
6035 Every transaction holds an exclusive lock on its virtual transaction ID for
6036 its entire duration. If a permanent ID is assigned to the transaction
6037 (which normally happens only if the transaction changes the state of the
6038 database), it also holds an exclusive lock on its permanent transaction ID
6039 until it ends. When one transaction finds it necessary to wait specifically
6040 for another transaction, it does so by attempting to acquire share lock on
6041 the other transaction ID (either virtual or permanent ID depending on the
6042 situation). That will succeed only when the other transaction
6043 terminates and releases its locks.
6044 </para>
6046 <para>
6047 Although tuples are a lockable type of object,
6048 information about row-level locks is stored on disk, not in memory,
6049 and therefore row-level locks normally do not appear in this view.
6050 If a transaction is waiting for a
6051 row-level lock, it will usually appear in the view as waiting for the
6052 permanent transaction ID of the current holder of that row lock.
6053 </para>
6055 <para>
6056 Advisory locks can be acquired on keys consisting of either a single
6057 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
6058 high-order half in the <structfield>classid</> column, its low-order half
6059 in the <structfield>objid</> column, and <structfield>objsubid</> equal
6060 to 1. Integer keys are displayed with the first key in the
6061 <structfield>classid</> column, the second key in the <structfield>objid</>
6062 column, and <structfield>objsubid</> equal to 2. The actual meaning of
6063 the keys is up to the user. Advisory locks are local to each database,
6064 so the <structfield>database</> column is meaningful for an advisory lock.
6065 </para>
6067 <para>
6068 When the <structname>pg_locks</structname> view is accessed, the
6069 internal lock manager data structures are momentarily locked, and
6070 a copy is made for the view to display. This ensures that the
6071 view produces a consistent set of results, while not blocking
6072 normal lock manager operations longer than necessary. Nonetheless
6073 there could be some impact on database performance if this view is
6074 frequently accessed.
6075 </para>
6077 <para>
6078 <structname>pg_locks</structname> provides a global view of all locks
6079 in the database cluster, not only those relevant to the current database.
6080 Although its <structfield>relation</structfield> column can be joined
6081 against <structname>pg_class</>.<structfield>oid</> to identify locked
6082 relations, this will only work correctly for relations in the current
6083 database (those for which the <structfield>database</structfield> column
6084 is either the current database's OID or zero).
6085 </para>
6087 <para>
6088 The <structfield>pid</structfield> column can be joined to the
6089 <structfield>procpid</structfield> column of the
6090 <structname>pg_stat_activity</structname> view to get more
6091 information on the session holding or waiting to hold each lock.
6092 Also, if you are using prepared transactions, the
6093 <structfield>transaction</> column can be joined to the
6094 <structfield>transaction</structfield> column of the
6095 <structname>pg_prepared_xacts</structname> view to get more
6096 information on prepared transactions that hold locks.
6097 (A prepared transaction can never be waiting for a lock,
6098 but it continues to hold the locks it acquired while running.)
6099 </para>
6101 </sect1>
6103 <sect1 id="view-pg-prepared-statements">
6104 <title><structname>pg_prepared_statements</structname></title>
6106 <indexterm zone="view-pg-prepared-statements">
6107 <primary>pg_prepared_statements</primary>
6108 </indexterm>
6110 <para>
6111 The <structname>pg_prepared_statements</structname> view displays
6112 all the prepared statements that are available in the current
6113 session. See <xref linkend="sql-prepare"
6114 endterm="sql-prepare-title"> for more information about prepared
6115 statements.
6116 </para>
6118 <para>
6119 <structname>pg_prepared_statements</structname> contains one row
6120 for each prepared statement. Rows are added to the view when a new
6121 prepared statement is created and removed when a prepared statement
6122 is released (for example, via the <xref linkend="sql-deallocate"
6123 endterm="sql-deallocate-title"> command).
6124 </para>
6126 <table>
6127 <title><structname>pg_prepared_statements</> Columns</title>
6129 <tgroup cols="3">
6130 <thead>
6131 <row>
6132 <entry>Name</entry>
6133 <entry>Type</entry>
6134 <entry>Description</entry>
6135 </row>
6136 </thead>
6137 <tbody>
6138 <row>
6139 <entry><structfield>name</structfield></entry>
6140 <entry><type>text</type></entry>
6141 <entry>
6142 The identifier of the prepared statement
6143 </entry>
6144 </row>
6145 <row>
6146 <entry><structfield>statement</structfield></entry>
6147 <entry><type>text</type></entry>
6148 <entry>
6149 The query string submitted by the client to create this
6150 prepared statement. For prepared statements created via SQL,
6151 this is the <command>PREPARE</command> statement submitted by
6152 the client. For prepared statements created via the
6153 frontend/backend protocol, this is the text of the prepared
6154 statement itself
6155 </entry>
6156 </row>
6157 <row>
6158 <entry><structfield>prepare_time</structfield></entry>
6159 <entry><type>timestamptz</type></entry>
6160 <entry>
6161 The time at which the prepared statement was created
6162 </entry>
6163 </row>
6164 <row>
6165 <entry><structfield>parameter_types</structfield></entry>
6166 <entry><type>regtype[]</type></entry>
6167 <entry>
6168 The expected parameter types for the prepared statement in the
6169 form of an array of <type>regtype</type>. The OID corresponding
6170 to an element of this array can be obtained by casting the
6171 <type>regtype</type> value to <type>oid</type>
6172 </entry>
6173 </row>
6174 <row>
6175 <entry><structfield>from_sql</structfield></entry>
6176 <entry><type>boolean</type></entry>
6177 <entry>
6178 <literal>true</literal> if the prepared statement was created
6179 via the <command>PREPARE</command> SQL statement;
6180 <literal>false</literal> if the statement was prepared via the
6181 frontend/backend protocol
6182 </entry>
6183 </row>
6184 </tbody>
6185 </tgroup>
6186 </table>
6188 <para>
6189 The <structname>pg_prepared_statements</structname> view is read only.
6190 </para>
6191 </sect1>
6193 <sect1 id="view-pg-prepared-xacts">
6194 <title><structname>pg_prepared_xacts</structname></title>
6196 <indexterm zone="view-pg-prepared-xacts">
6197 <primary>pg_prepared_xacts</primary>
6198 </indexterm>
6200 <para>
6201 The view <structname>pg_prepared_xacts</structname> displays
6202 information about transactions that are currently prepared for two-phase
6203 commit (see <xref linkend="sql-prepare-transaction"
6204 endterm="sql-prepare-transaction-title"> for details).
6205 </para>
6207 <para>
6208 <structname>pg_prepared_xacts</structname> contains one row per prepared
6209 transaction. An entry is removed when the transaction is committed or
6210 rolled back.
6211 </para>
6213 <table>
6214 <title><structname>pg_prepared_xacts</> Columns</title>
6216 <tgroup cols="4">
6217 <thead>
6218 <row>
6219 <entry>Name</entry>
6220 <entry>Type</entry>
6221 <entry>References</entry>
6222 <entry>Description</entry>
6223 </row>
6224 </thead>
6225 <tbody>
6226 <row>
6227 <entry><structfield>transaction</structfield></entry>
6228 <entry><type>xid</type></entry>
6229 <entry></entry>
6230 <entry>
6231 Numeric transaction identifier of the prepared transaction
6232 </entry>
6233 </row>
6234 <row>
6235 <entry><structfield>gid</structfield></entry>
6236 <entry><type>text</type></entry>
6237 <entry></entry>
6238 <entry>
6239 Global transaction identifier that was assigned to the transaction
6240 </entry>
6241 </row>
6242 <row>
6243 <entry><structfield>prepared</structfield></entry>
6244 <entry><type>timestamp with time zone</type></entry>
6245 <entry></entry>
6246 <entry>
6247 Time at which the transaction was prepared for commit
6248 </entry>
6249 </row>
6250 <row>
6251 <entry><structfield>owner</structfield></entry>
6252 <entry><type>name</type></entry>
6253 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6254 <entry>
6255 Name of the user that executed the transaction
6256 </entry>
6257 </row>
6258 <row>
6259 <entry><structfield>database</structfield></entry>
6260 <entry><type>name</type></entry>
6261 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
6262 <entry>
6263 Name of the database in which the transaction was executed
6264 </entry>
6265 </row>
6266 </tbody>
6267 </tgroup>
6268 </table>
6270 <para>
6271 When the <structname>pg_prepared_xacts</structname> view is accessed, the
6272 internal transaction manager data structures are momentarily locked, and
6273 a copy is made for the view to display. This ensures that the
6274 view produces a consistent set of results, while not blocking
6275 normal operations longer than necessary. Nonetheless
6276 there could be some impact on database performance if this view is
6277 frequently accessed.
6278 </para>
6280 </sect1>
6282 <sect1 id="view-pg-roles">
6283 <title><structname>pg_roles</structname></title>
6285 <indexterm zone="view-pg-roles">
6286 <primary>pg_roles</primary>
6287 </indexterm>
6289 <para>
6290 The view <structname>pg_roles</structname> provides access to
6291 information about database roles. This is simply a publicly
6292 readable view of
6293 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6294 that blanks out the password field.
6295 </para>
6297 <para>
6298 This view explicitly exposes the OID column of the underlying table,
6299 since that is needed to do joins to other catalogs.
6300 </para>
6302 <table>
6303 <title><structname>pg_roles</> Columns</title>
6305 <tgroup cols="4">
6306 <thead>
6307 <row>
6308 <entry>Name</entry>
6309 <entry>Type</entry>
6310 <entry>References</entry>
6311 <entry>Description</entry>
6312 </row>
6313 </thead>
6315 <tbody>
6316 <row>
6317 <entry><structfield>rolname</structfield></entry>
6318 <entry><type>name</type></entry>
6319 <entry></entry>
6320 <entry>Role name</entry>
6321 </row>
6323 <row>
6324 <entry><structfield>rolsuper</structfield></entry>
6325 <entry><type>bool</type></entry>
6326 <entry></entry>
6327 <entry>Role has superuser privileges</entry>
6328 </row>
6330 <row>
6331 <entry><structfield>rolinherit</structfield></entry>
6332 <entry><type>bool</type></entry>
6333 <entry></entry>
6334 <entry>Role automatically inherits privileges of roles it is a
6335 member of</entry>
6336 </row>
6338 <row>
6339 <entry><structfield>rolcreaterole</structfield></entry>
6340 <entry><type>bool</type></entry>
6341 <entry></entry>
6342 <entry>Role can create more roles</entry>
6343 </row>
6345 <row>
6346 <entry><structfield>rolcreatedb</structfield></entry>
6347 <entry><type>bool</type></entry>
6348 <entry></entry>
6349 <entry>Role can create databases</entry>
6350 </row>
6352 <row>
6353 <entry><structfield>rolcatupdate</structfield></entry>
6354 <entry><type>bool</type></entry>
6355 <entry></entry>
6356 <entry>
6357 Role can update system catalogs directly. (Even a superuser cannot do
6358 this unless this column is true.)
6359 </entry>
6360 </row>
6362 <row>
6363 <entry><structfield>rolcanlogin</structfield></entry>
6364 <entry><type>bool</type></entry>
6365 <entry></entry>
6366 <entry>
6367 Role can log in. That is, this role can be given as the initial
6368 session authorization identifier
6369 </entry>
6370 </row>
6372 <row>
6373 <entry><structfield>rolconnlimit</structfield></entry>
6374 <entry><type>int4</type></entry>
6375 <entry></entry>
6376 <entry>
6377 For roles that can log in, this sets maximum number of concurrent
6378 connections this role can make. -1 means no limit
6379 </entry>
6380 </row>
6382 <row>
6383 <entry><structfield>rolpassword</structfield></entry>
6384 <entry><type>text</type></entry>
6385 <entry></entry>
6386 <entry>Not the password (always reads as <literal>********</>)</entry>
6387 </row>
6389 <row>
6390 <entry><structfield>rolvaliduntil</structfield></entry>
6391 <entry><type>timestamptz</type></entry>
6392 <entry></entry>
6393 <entry>Password expiry time (only used for password authentication);
6394 NULL if no expiration</entry>
6395 </row>
6397 <row>
6398 <entry><structfield>rolconfig</structfield></entry>
6399 <entry><type>text[]</type></entry>
6400 <entry></entry>
6401 <entry>Session defaults for run-time configuration variables</entry>
6402 </row>
6404 <row>
6405 <entry><structfield>oid</structfield></entry>
6406 <entry><type>oid</type></entry>
6407 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6408 <entry>ID of role</entry>
6409 </row>
6410 </tbody>
6411 </tgroup>
6412 </table>
6414 </sect1>
6416 <sect1 id="view-pg-rules">
6417 <title><structname>pg_rules</structname></title>
6419 <indexterm zone="view-pg-rules">
6420 <primary>pg_rules</primary>
6421 </indexterm>
6423 <para>
6424 The view <structname>pg_rules</structname> provides access to
6425 useful information about query rewrite rules.
6426 </para>
6428 <table>
6429 <title><structname>pg_rules</> Columns</title>
6431 <tgroup cols="4">
6432 <thead>
6433 <row>
6434 <entry>Name</entry>
6435 <entry>Type</entry>
6436 <entry>References</entry>
6437 <entry>Description</entry>
6438 </row>
6439 </thead>
6440 <tbody>
6441 <row>
6442 <entry><structfield>schemaname</structfield></entry>
6443 <entry><type>name</type></entry>
6444 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6445 <entry>Name of schema containing table</entry>
6446 </row>
6447 <row>
6448 <entry><structfield>tablename</structfield></entry>
6449 <entry><type>name</type></entry>
6450 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6451 <entry>Name of table the rule is for</entry>
6452 </row>
6453 <row>
6454 <entry><structfield>rulename</structfield></entry>
6455 <entry><type>name</type></entry>
6456 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6457 <entry>Name of rule</entry>
6458 </row>
6459 <row>
6460 <entry><structfield>definition</structfield></entry>
6461 <entry><type>text</type></entry>
6462 <entry></entry>
6463 <entry>Rule definition (a reconstructed creation command)</entry>
6464 </row>
6465 </tbody>
6466 </tgroup>
6467 </table>
6469 <para>
6470 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6471 of views; those can be seen in <structname>pg_views</>.
6472 </para>
6474 </sect1>
6476 <sect1 id="view-pg-settings">
6477 <title><structname>pg_settings</structname></title>
6479 <indexterm zone="view-pg-settings">
6480 <primary>pg_settings</primary>
6481 </indexterm>
6483 <para>
6484 The view <structname>pg_settings</structname> provides access to
6485 run-time parameters of the server. It is essentially an alternative
6486 interface to the <xref linkend="sql-show" endterm="sql-show-title">
6487 and <xref linkend="sql-set" endterm="sql-set-title"> commands.
6488 It also provides access to some facts about each parameter that are
6489 not directly available from <command>SHOW</>, such as minimum and
6490 maximum values.
6491 </para>
6493 <table>
6494 <title><structname>pg_settings</> Columns</title>
6496 <tgroup cols="3">
6497 <thead>
6498 <row>
6499 <entry>Name</entry>
6500 <entry>Type</entry>
6501 <entry>Description</entry>
6502 </row>
6503 </thead>
6504 <tbody>
6505 <row>
6506 <entry><structfield>name</structfield></entry>
6507 <entry><type>text</type></entry>
6508 <entry>Run-time configuration parameter name</entry>
6509 </row>
6510 <row>
6511 <entry><structfield>setting</structfield></entry>
6512 <entry><type>text</type></entry>
6513 <entry>Current value of the parameter</entry>
6514 </row>
6515 <row>
6516 <entry><structfield>unit</structfield></entry>
6517 <entry><type>text</type></entry>
6518 <entry>Implicit unit of the parameter</entry>
6519 </row>
6520 <row>
6521 <entry><structfield>category</structfield></entry>
6522 <entry><type>text</type></entry>
6523 <entry>Logical group of the parameter</entry>
6524 </row>
6525 <row>
6526 <entry><structfield>short_desc</structfield></entry>
6527 <entry><type>text</type></entry>
6528 <entry>A brief description of the parameter</entry>
6529 </row>
6530 <row>
6531 <entry><structfield>extra_desc</structfield></entry>
6532 <entry><type>text</type></entry>
6533 <entry>Additional, more detailed, description of the parameter</entry>
6534 </row>
6535 <row>
6536 <entry><structfield>context</structfield></entry>
6537 <entry><type>text</type></entry>
6538 <entry>Context required to set the parameter's value</entry>
6539 </row>
6540 <row>
6541 <entry><structfield>vartype</structfield></entry>
6542 <entry><type>text</type></entry>
6543 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6544 <literal>integer</>, <literal>real</>, or <literal>string</>)
6545 </entry>
6546 </row>
6547 <row>
6548 <entry><structfield>source</structfield></entry>
6549 <entry><type>text</type></entry>
6550 <entry>Source of the current parameter value</entry>
6551 </row>
6552 <row>
6553 <entry><structfield>min_val</structfield></entry>
6554 <entry><type>text</type></entry>
6555 <entry>Minimum allowed value of the parameter (NULL for non-numeric
6556 values)</entry>
6557 </row>
6558 <row>
6559 <entry><structfield>max_val</structfield></entry>
6560 <entry><type>text</type></entry>
6561 <entry>Maximum allowed value of the parameter (NULL for non-numeric
6562 values)</entry>
6563 </row>
6564 <row>
6565 <entry><structfield>enumvals</structfield></entry>
6566 <entry><type>text[]</type></entry>
6567 <entry>Allowed values of an enum parameter (NULL for non-enum
6568 values)</entry>
6569 </row>
6570 <row>
6571 <entry><structfield>boot_val</structfield></entry>
6572 <entry><type>text</type></entry>
6573 <entry>Parameter value assumed at server startup if the parameter is
6574 not otherwise set</entry>
6575 </row>
6576 <row>
6577 <entry><structfield>reset_val</structfield></entry>
6578 <entry><type>text</type></entry>
6579 <entry>Value that <command>RESET</command> would reset the parameter to
6580 in the current session</entry>
6581 </row>
6582 <row>
6583 <entry><structfield>sourcefile</structfield></entry>
6584 <entry><type>text</type></entry>
6585 <entry>Configuration file the current value was set in (NULL for
6586 values set from sources other than configuration files, or when
6587 examined by a non-superuser).
6588 Helpful when using configuration include directives</entry>
6589 </row>
6590 <row>
6591 <entry><structfield>sourceline</structfield></entry>
6592 <entry><type>integer</type></entry>
6593 <entry>Line number within the configuration file the current value was
6594 set at (NULL for values set from sources other than configuration files,
6595 or when examined by a non-superuser)
6596 </entry>
6597 </row>
6598 </tbody>
6599 </tgroup>
6600 </table>
6602 <para>
6603 The <structname>pg_settings</structname> view cannot be inserted into or
6604 deleted from, but it can be updated. An <command>UPDATE</command> applied
6605 to a row of <structname>pg_settings</structname> is equivalent to executing
6606 the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6607 parameter. The change only affects the value used by the current
6608 session. If an <command>UPDATE</command> is issued within a transaction
6609 that is later aborted, the effects of the <command>UPDATE</command> command
6610 disappear when the transaction is rolled back. Once the surrounding
6611 transaction is committed, the effects will persist until the end of the
6612 session, unless overridden by another <command>UPDATE</command> or
6613 <command>SET</command>.
6614 </para>
6616 </sect1>
6618 <sect1 id="view-pg-shadow">
6619 <title><structname>pg_shadow</structname></title>
6621 <indexterm zone="view-pg-shadow">
6622 <primary>pg_shadow</primary>
6623 </indexterm>
6625 <para>
6626 The view <structname>pg_shadow</structname> exists for backwards
6627 compatibility: it emulates a catalog that existed in
6628 <productname>PostgreSQL</productname> before version 8.1.
6629 It shows properties of all roles that are marked as
6630 <structfield>rolcanlogin</>.
6631 </para>
6633 <para>
6634 The name stems from the fact that this table
6635 should not be readable by the public since it contains passwords.
6636 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6637 is a publicly readable view on
6638 <structname>pg_shadow</structname> that blanks out the password field.
6639 </para>
6641 <table>
6642 <title><structname>pg_shadow</> Columns</title>
6644 <tgroup cols="4">
6645 <thead>
6646 <row>
6647 <entry>Name</entry>
6648 <entry>Type</entry>
6649 <entry>References</entry>
6650 <entry>Description</entry>
6651 </row>
6652 </thead>
6654 <tbody>
6655 <row>
6656 <entry><structfield>usename</structfield></entry>
6657 <entry><type>name</type></entry>
6658 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6659 <entry>User name</entry>
6660 </row>
6662 <row>
6663 <entry><structfield>usesysid</structfield></entry>
6664 <entry><type>oid</type></entry>
6665 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6666 <entry>ID of this user</entry>
6667 </row>
6669 <row>
6670 <entry><structfield>usecreatedb</structfield></entry>
6671 <entry><type>bool</type></entry>
6672 <entry></entry>
6673 <entry>User can create databases</entry>
6674 </row>
6676 <row>
6677 <entry><structfield>usesuper</structfield></entry>
6678 <entry><type>bool</type></entry>
6679 <entry></entry>
6680 <entry>User is a superuser</entry>
6681 </row>
6683 <row>
6684 <entry><structfield>usecatupd</structfield></entry>
6685 <entry><type>bool</type></entry>
6686 <entry></entry>
6687 <entry>
6688 User can update system catalogs. (Even a superuser cannot do
6689 this unless this column is true.)
6690 </entry>
6691 </row>
6693 <row>
6694 <entry><structfield>passwd</structfield></entry>
6695 <entry><type>text</type></entry>
6696 <entry></entry>
6697 <entry>Password (possibly encrypted)</entry>
6698 </row>
6700 <row>
6701 <entry><structfield>valuntil</structfield></entry>
6702 <entry><type>abstime</type></entry>
6703 <entry></entry>
6704 <entry>Password expiry time (only used for password authentication)</entry>
6705 </row>
6707 <row>
6708 <entry><structfield>useconfig</structfield></entry>
6709 <entry><type>text[]</type></entry>
6710 <entry></entry>
6711 <entry>Session defaults for run-time configuration variables</entry>
6712 </row>
6713 </tbody>
6714 </tgroup>
6715 </table>
6717 </sect1>
6719 <sect1 id="view-pg-stats">
6720 <title><structname>pg_stats</structname></title>
6722 <indexterm zone="view-pg-stats">
6723 <primary>pg_stats</primary>
6724 </indexterm>
6726 <para>
6727 The view <structname>pg_stats</structname> provides access to
6728 the information stored in the <link
6729 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6730 catalog. This view allows access only to rows of
6731 <structname>pg_statistic</structname> that correspond to tables the
6732 user has permission to read, and therefore it is safe to allow public
6733 read access to this view.
6734 </para>
6736 <para>
6737 <structname>pg_stats</structname> is also designed to present the
6738 information in a more readable format than the underlying catalog
6739 &mdash; at the cost that its schema must be extended whenever new slot types
6740 are defined for <structname>pg_statistic</structname>.
6741 </para>
6743 <table>
6744 <title><structname>pg_stats</> Columns</title>
6746 <tgroup cols="4">
6747 <thead>
6748 <row>
6749 <entry>Name</entry>
6750 <entry>Type</entry>
6751 <entry>References</entry>
6752 <entry>Description</entry>
6753 </row>
6754 </thead>
6755 <tbody>
6756 <row>
6757 <entry><structfield>schemaname</structfield></entry>
6758 <entry><type>name</type></entry>
6759 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6760 <entry>Name of schema containing table</entry>
6761 </row>
6763 <row>
6764 <entry><structfield>tablename</structfield></entry>
6765 <entry><type>name</type></entry>
6766 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6767 <entry>Name of table</entry>
6768 </row>
6770 <row>
6771 <entry><structfield>attname</structfield></entry>
6772 <entry><type>name</type></entry>
6773 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6774 <entry>Name of the column described by this row</entry>
6775 </row>
6777 <row>
6778 <entry><structfield>null_frac</structfield></entry>
6779 <entry><type>real</type></entry>
6780 <entry></entry>
6781 <entry>Fraction of column entries that are null</entry>
6782 </row>
6784 <row>
6785 <entry><structfield>avg_width</structfield></entry>
6786 <entry><type>integer</type></entry>
6787 <entry></entry>
6788 <entry>Average width in bytes of column's entries</entry>
6789 </row>
6791 <row>
6792 <entry><structfield>n_distinct</structfield></entry>
6793 <entry><type>real</type></entry>
6794 <entry></entry>
6795 <entry>
6796 If greater than zero, the estimated number of distinct values in the
6797 column. If less than zero, the negative of the number of distinct
6798 values divided by the number of rows. (The negated form is used when
6799 <command>ANALYZE</> believes that the number of distinct values is
6800 likely to increase as the table grows; the positive form is used when
6801 the column seems to have a fixed number of possible values.) For
6802 example, -1 indicates a unique column in which the number of distinct
6803 values is the same as the number of rows
6804 </entry>
6805 </row>
6807 <row>
6808 <entry><structfield>most_common_vals</structfield></entry>
6809 <entry><type>anyarray</type></entry>
6810 <entry></entry>
6811 <entry>
6812 A list of the most common values in the column. (NULL if
6813 no values seem to be more common than any others.)
6814 For some datatypes such as <type>tsvector</>, this is a list of
6815 the most common element values rather than values of the type itself.
6816 </entry>
6817 </row>
6819 <row>
6820 <entry><structfield>most_common_freqs</structfield></entry>
6821 <entry><type>real[]</type></entry>
6822 <entry></entry>
6823 <entry>
6824 A list of the frequencies of the most common values or elements,
6825 i.e., number of occurrences of each divided by total number of rows.
6826 (NULL when <structfield>most_common_vals</structfield> is.)
6827 For some datatypes such as <type>tsvector</>, it can also store some
6828 additional information, making it longer than the
6829 <structfield>most_common_vals</> array.
6830 </entry>
6831 </row>
6833 <row>
6834 <entry><structfield>histogram_bounds</structfield></entry>
6835 <entry><type>anyarray</type></entry>
6836 <entry></entry>
6837 <entry>
6838 A list of values that divide the column's values into groups of
6839 approximately equal population. The values in
6840 <structfield>most_common_vals</>, if present, are omitted from this
6841 histogram calculation. (This column is NULL if the column data type
6842 does not have a <literal>&lt;</> operator or if the
6843 <structfield>most_common_vals</> list accounts for the entire
6844 population.)
6845 </entry>
6846 </row>
6848 <row>
6849 <entry><structfield>correlation</structfield></entry>
6850 <entry><type>real</type></entry>
6851 <entry></entry>
6852 <entry>
6853 Statistical correlation between physical row ordering and
6854 logical ordering of the column values. This ranges from -1 to +1.
6855 When the value is near -1 or +1, an index scan on the column will
6856 be estimated to be cheaper than when it is near zero, due to reduction
6857 of random access to the disk. (This column is NULL if the column data
6858 type does not have a <literal>&lt;</> operator.)
6859 </entry>
6860 </row>
6861 </tbody>
6862 </tgroup>
6863 </table>
6865 <para>
6866 The maximum number of entries in the <structfield>most_common_vals</>
6867 and <structfield>histogram_bounds</> arrays can be set on a
6868 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
6869 command, or globally by setting the
6870 <xref linkend="guc-default-statistics-target"> run-time parameter.
6871 </para>
6873 </sect1>
6875 <sect1 id="view-pg-tables">
6876 <title><structname>pg_tables</structname></title>
6878 <indexterm zone="view-pg-tables">
6879 <primary>pg_tables</primary>
6880 </indexterm>
6882 <para>
6883 The view <structname>pg_tables</structname> provides access to
6884 useful information about each table in the database.
6885 </para>
6887 <table>
6888 <title><structname>pg_tables</> Columns</title>
6890 <tgroup cols="4">
6891 <thead>
6892 <row>
6893 <entry>Name</entry>
6894 <entry>Type</entry>
6895 <entry>References</entry>
6896 <entry>Description</entry>
6897 </row>
6898 </thead>
6899 <tbody>
6900 <row>
6901 <entry><structfield>schemaname</structfield></entry>
6902 <entry><type>name</type></entry>
6903 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6904 <entry>Name of schema containing table</entry>
6905 </row>
6906 <row>
6907 <entry><structfield>tablename</structfield></entry>
6908 <entry><type>name</type></entry>
6909 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6910 <entry>Name of table</entry>
6911 </row>
6912 <row>
6913 <entry><structfield>tableowner</structfield></entry>
6914 <entry><type>name</type></entry>
6915 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6916 <entry>Name of table's owner</entry>
6917 </row>
6918 <row>
6919 <entry><structfield>tablespace</structfield></entry>
6920 <entry><type>name</type></entry>
6921 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6922 <entry>Name of tablespace containing table (NULL if default for database)</entry>
6923 </row>
6924 <row>
6925 <entry><structfield>hasindexes</structfield></entry>
6926 <entry><type>boolean</type></entry>
6927 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
6928 <entry>true if table has (or recently had) any indexes</entry>
6929 </row>
6930 <row>
6931 <entry><structfield>hasrules</structfield></entry>
6932 <entry><type>boolean</type></entry>
6933 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
6934 <entry>true if table has (or once had) rules</entry>
6935 </row>
6936 <row>
6937 <entry><structfield>hastriggers</structfield></entry>
6938 <entry><type>boolean</type></entry>
6939 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
6940 <entry>true if table has (or once had) triggers</entry>
6941 </row>
6942 </tbody>
6943 </tgroup>
6944 </table>
6946 </sect1>
6948 <sect1 id="view-pg-timezone-abbrevs">
6949 <title><structname>pg_timezone_abbrevs</structname></title>
6951 <indexterm zone="view-pg-timezone-abbrevs">
6952 <primary>pg_timezone_abbrevs</primary>
6953 </indexterm>
6955 <para>
6956 The view <structname>pg_timezone_abbrevs</structname> provides a list
6957 of time zone abbreviations that are currently recognized by the datetime
6958 input routines. The contents of this view change when the
6959 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
6960 </para>
6962 <table>
6963 <title><structname>pg_timezone_abbrevs</> Columns</title>
6965 <tgroup cols="3">
6966 <thead>
6967 <row>
6968 <entry>Name</entry>
6969 <entry>Type</entry>
6970 <entry>Description</entry>
6971 </row>
6972 </thead>
6973 <tbody>
6974 <row>
6975 <entry><structfield>abbrev</structfield></entry>
6976 <entry><type>text</type></entry>
6977 <entry>Time zone abbreviation</entry>
6978 </row>
6979 <row>
6980 <entry><structfield>utc_offset</structfield></entry>
6981 <entry><type>interval</type></entry>
6982 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6983 </row>
6984 <row>
6985 <entry><structfield>is_dst</structfield></entry>
6986 <entry><type>boolean</type></entry>
6987 <entry>True if this is a daylight-savings abbreviation</entry>
6988 </row>
6989 </tbody>
6990 </tgroup>
6991 </table>
6993 </sect1>
6995 <sect1 id="view-pg-timezone-names">
6996 <title><structname>pg_timezone_names</structname></title>
6998 <indexterm zone="view-pg-timezone-names">
6999 <primary>pg_timezone_names</primary>
7000 </indexterm>
7002 <para>
7003 The view <structname>pg_timezone_names</structname> provides a list
7004 of time zone names that are recognized by <command>SET TIMEZONE</>,
7005 along with their associated abbreviations, UTC offsets,
7006 and daylight-savings status.
7007 Unlike the abbreviations shown in <link
7008 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
7009 date rules. Therefore, the associated information changes across local DST
7010 boundaries. The displayed information is computed based on the current
7011 value of <function>CURRENT_TIMESTAMP</>.
7012 </para>
7014 <table>
7015 <title><structname>pg_timezone_names</> Columns</title>
7017 <tgroup cols="3">
7018 <thead>
7019 <row>
7020 <entry>Name</entry>
7021 <entry>Type</entry>
7022 <entry>Description</entry>
7023 </row>
7024 </thead>
7025 <tbody>
7026 <row>
7027 <entry><structfield>name</structfield></entry>
7028 <entry><type>text</type></entry>
7029 <entry>Time zone name</entry>
7030 </row>
7031 <row>
7032 <entry><structfield>abbrev</structfield></entry>
7033 <entry><type>text</type></entry>
7034 <entry>Time zone abbreviation</entry>
7035 </row>
7036 <row>
7037 <entry><structfield>utc_offset</structfield></entry>
7038 <entry><type>interval</type></entry>
7039 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7040 </row>
7041 <row>
7042 <entry><structfield>is_dst</structfield></entry>
7043 <entry><type>boolean</type></entry>
7044 <entry>True if currently observing daylight savings</entry>
7045 </row>
7046 </tbody>
7047 </tgroup>
7048 </table>
7050 </sect1>
7052 <sect1 id="view-pg-user">
7053 <title><structname>pg_user</structname></title>
7055 <indexterm zone="view-pg-user">
7056 <primary>pg_user</primary>
7057 </indexterm>
7059 <para>
7060 The view <structname>pg_user</structname> provides access to
7061 information about database users. This is simply a publicly
7062 readable view of
7063 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
7064 that blanks out the password field.
7065 </para>
7067 <table>
7068 <title><structname>pg_user</> Columns</title>
7070 <tgroup cols="3">
7071 <thead>
7072 <row>
7073 <entry>Name</entry>
7074 <entry>Type</entry>
7075 <entry>Description</entry>
7076 </row>
7077 </thead>
7078 <tbody>
7079 <row>
7080 <entry><structfield>usename</structfield></entry>
7081 <entry><type>name</type></entry>
7082 <entry>User name</entry>
7083 </row>
7085 <row>
7086 <entry><structfield>usesysid</structfield></entry>
7087 <entry><type>int4</type></entry>
7088 <entry>User ID (arbitrary number used to reference this user)</entry>
7089 </row>
7091 <row>
7092 <entry><structfield>usecreatedb</structfield></entry>
7093 <entry><type>bool</type></entry>
7094 <entry>User can create databases</entry>
7095 </row>
7097 <row>
7098 <entry><structfield>usesuper</structfield></entry>
7099 <entry><type>bool</type></entry>
7100 <entry>User is a superuser</entry>
7101 </row>
7103 <row>
7104 <entry><structfield>usecatupd</structfield></entry>
7105 <entry><type>bool</type></entry>
7106 <entry>
7107 User can update system catalogs. (Even a superuser cannot do
7108 this unless this column is true.)
7109 </entry>
7110 </row>
7112 <row>
7113 <entry><structfield>passwd</structfield></entry>
7114 <entry><type>text</type></entry>
7115 <entry>Not the password (always reads as <literal>********</>)</entry>
7116 </row>
7118 <row>
7119 <entry><structfield>valuntil</structfield></entry>
7120 <entry><type>abstime</type></entry>
7121 <entry>Password expiry time (only used for password authentication)</entry>
7122 </row>
7124 <row>
7125 <entry><structfield>useconfig</structfield></entry>
7126 <entry><type>text[]</type></entry>
7127 <entry>Session defaults for run-time configuration variables</entry>
7128 </row>
7129 </tbody>
7130 </tgroup>
7131 </table>
7133 </sect1>
7135 <sect1 id="view-pg-user-mappings">
7136 <title><structname>pg_user_mappings</structname></title>
7138 <indexterm zone="view-pg-user-mappings">
7139 <primary>pg_user_mappings</primary>
7140 </indexterm>
7142 <para>
7143 The view <structname>pg_user_mappings</structname> provides access
7144 to information about user mappings. This is essentially a publicly
7145 readable view of
7146 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
7147 that leaves out the options field if the user has no rights to use
7149 </para>
7151 <table>
7152 <title><structname>pg_user_mappings</> Columns</title>
7154 <tgroup cols="3">
7155 <thead>
7156 <row>
7157 <entry>Name</entry>
7158 <entry>Type</entry>
7159 <entry>References</entry>
7160 <entry>Description</entry>
7161 </row>
7162 </thead>
7164 <tbody>
7165 <row>
7166 <entry><structfield>umid</structfield></entry>
7167 <entry><type>oid</type></entry>
7168 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
7169 <entry>OID of the user mapping</entry>
7170 </row>
7172 <row>
7173 <entry><structfield>srvid</structfield></entry>
7174 <entry><type>oid</type></entry>
7175 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7176 <entry>
7177 The OID of the foreign server that contains this mapping
7178 </entry>
7179 </row>
7181 <row>
7182 <entry><structfield>srvname</structfield></entry>
7183 <entry><type>text</type></entry>
7184 <entry></entry>
7185 <entry>
7186 Name of the foreign server
7187 </entry>
7188 </row>
7190 <row>
7191 <entry><structfield>umuser</structfield></entry>
7192 <entry><type>oid</type></entry>
7193 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7194 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7195 </row>
7197 <row>
7198 <entry><structfield>usename</structfield></entry>
7199 <entry><type>name</type></entry>
7200 <entry></entry>
7201 <entry>Name of the local user to be mapped</entry>
7202 </row>
7204 <row>
7205 <entry><structfield>umoptions</structfield></entry>
7206 <entry><type>text[]</type></entry>
7207 <entry></entry>
7208 <entry>
7209 User mapping specific options, as <quote>keyword=value</>
7210 strings, if the current user is the owner of the foreign
7211 server, else null.
7212 </entry>
7213 </row>
7214 </tbody>
7215 </tgroup>
7216 </table>
7217 </sect1>
7220 <sect1 id="view-pg-views">
7221 <title><structname>pg_views</structname></title>
7223 <indexterm zone="view-pg-views">
7224 <primary>pg_views</primary>
7225 </indexterm>
7227 <para>
7228 The view <structname>pg_views</structname> provides access to
7229 useful information about each view in the database.
7230 </para>
7232 <table>
7233 <title><structname>pg_views</> Columns</title>
7235 <tgroup cols="4">
7236 <thead>
7237 <row>
7238 <entry>Name</entry>
7239 <entry>Type</entry>
7240 <entry>References</entry>
7241 <entry>Description</entry>
7242 </row>
7243 </thead>
7244 <tbody>
7245 <row>
7246 <entry><structfield>schemaname</structfield></entry>
7247 <entry><type>name</type></entry>
7248 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7249 <entry>Name of schema containing view</entry>
7250 </row>
7251 <row>
7252 <entry><structfield>viewname</structfield></entry>
7253 <entry><type>name</type></entry>
7254 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7255 <entry>Name of view</entry>
7256 </row>
7257 <row>
7258 <entry><structfield>viewowner</structfield></entry>
7259 <entry><type>name</type></entry>
7260 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7261 <entry>Name of view's owner</entry>
7262 </row>
7263 <row>
7264 <entry><structfield>definition</structfield></entry>
7265 <entry><type>text</type></entry>
7266 <entry></entry>
7267 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
7268 </row>
7269 </tbody>
7270 </tgroup>
7271 </table>
7273 </sect1>
7275 </chapter>