Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / doc / src / sgml / catalogs.sgml
blob34679d85ea5238598165dafb99ef27c2338ae252
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, or zero if none</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, or zero if none</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>relistemp</structfield></entry>
1537 <entry><type>bool</type></entry>
1538 <entry></entry>
1539 <entry>
1540 True if this table is a temporary relation. If so, only the creating
1541 session can safely access its contents
1542 </entry>
1543 </row>
1545 <row>
1546 <entry><structfield>relkind</structfield></entry>
1547 <entry><type>char</type></entry>
1548 <entry></entry>
1549 <entry>
1550 <literal>r</> = ordinary table, <literal>i</> = index,
1551 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1552 composite type, <literal>t</> = TOAST
1553 table
1554 </entry>
1555 </row>
1557 <row>
1558 <entry><structfield>relnatts</structfield></entry>
1559 <entry><type>int2</type></entry>
1560 <entry></entry>
1561 <entry>
1562 Number of user columns in the relation (system columns not
1563 counted). There must be this many corresponding entries in
1564 <structname>pg_attribute</structname>. See also
1565 <literal>pg_attribute.attnum</literal>
1566 </entry>
1567 </row>
1569 <row>
1570 <entry><structfield>relchecks</structfield></entry>
1571 <entry><type>int2</type></entry>
1572 <entry></entry>
1573 <entry>
1574 Number of <literal>CHECK</> constraints on the table; see
1575 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1576 </entry>
1577 </row>
1579 <row>
1580 <entry><structfield>relhasoids</structfield></entry>
1581 <entry><type>bool</type></entry>
1582 <entry></entry>
1583 <entry>
1584 True if we generate an OID for each row of the relation
1585 </entry>
1586 </row>
1588 <row>
1589 <entry><structfield>relhaspkey</structfield></entry>
1590 <entry><type>bool</type></entry>
1591 <entry></entry>
1592 <entry>
1593 True if the table has (or once had) a primary key
1594 </entry>
1595 </row>
1597 <row>
1598 <entry><structfield>relhasrules</structfield></entry>
1599 <entry><type>bool</type></entry>
1600 <entry></entry>
1601 <entry>
1602 True if table has (or once had) rules; see
1603 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1604 </entry>
1605 </row>
1607 <row>
1608 <entry><structfield>relhastriggers</structfield></entry>
1609 <entry><type>bool</type></entry>
1610 <entry></entry>
1611 <entry>
1612 True if table has (or once had) triggers; see
1613 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1614 </entry>
1615 </row>
1617 <row>
1618 <entry><structfield>relhassubclass</structfield></entry>
1619 <entry><type>bool</type></entry>
1620 <entry></entry>
1621 <entry>True if table has (or once had) any inheritance children</entry>
1622 </row>
1624 <row>
1625 <entry><structfield>relfrozenxid</structfield></entry>
1626 <entry><type>xid</type></entry>
1627 <entry></entry>
1628 <entry>
1629 All transaction IDs before this one have been replaced with a permanent
1630 (<quote>frozen</>) transaction ID in this table. This is used to track
1631 whether the table needs to be vacuumed in order to prevent transaction
1632 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1633 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table
1634 </entry>
1635 </row>
1637 <row>
1638 <entry><structfield>relacl</structfield></entry>
1639 <entry><type>aclitem[]</type></entry>
1640 <entry></entry>
1641 <entry>
1642 Access privileges; see
1643 <xref linkend="sql-grant" endterm="sql-grant-title"> and
1644 <xref linkend="sql-revoke" endterm="sql-revoke-title">
1645 for details
1646 </entry>
1647 </row>
1649 <row>
1650 <entry><structfield>reloptions</structfield></entry>
1651 <entry><type>text[]</type></entry>
1652 <entry></entry>
1653 <entry>
1654 Access-method-specific options, as <quote>keyword=value</> strings
1655 </entry>
1656 </row>
1657 </tbody>
1658 </tgroup>
1659 </table>
1660 </sect1>
1662 <sect1 id="catalog-pg-constraint">
1663 <title><structname>pg_constraint</structname></title>
1665 <indexterm zone="catalog-pg-constraint">
1666 <primary>pg_constraint</primary>
1667 </indexterm>
1669 <para>
1670 The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
1671 key constraints on tables. (Column constraints are not treated
1672 specially. Every column constraint is equivalent to some table
1673 constraint.) Not-null constraints are represented in the
1674 <structname>pg_attribute</> catalog.
1675 </para>
1677 <para>
1678 Check constraints on domains are stored here, too.
1679 </para>
1681 <table>
1682 <title><structname>pg_constraint</> Columns</title>
1684 <tgroup cols="4">
1685 <thead>
1686 <row>
1687 <entry>Name</entry>
1688 <entry>Type</entry>
1689 <entry>References</entry>
1690 <entry>Description</entry>
1691 </row>
1692 </thead>
1694 <tbody>
1695 <row>
1696 <entry><structfield>conname</structfield></entry>
1697 <entry><type>name</type></entry>
1698 <entry></entry>
1699 <entry>Constraint name (not necessarily unique!)</entry>
1700 </row>
1702 <row>
1703 <entry><structfield>connamespace</structfield></entry>
1704 <entry><type>oid</type></entry>
1705 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1706 <entry>
1707 The OID of the namespace that contains this constraint
1708 </entry>
1709 </row>
1711 <row>
1712 <entry><structfield>contype</structfield></entry>
1713 <entry><type>char</type></entry>
1714 <entry></entry>
1715 <entry>
1716 <literal>c</> = check constraint,
1717 <literal>f</> = foreign key constraint,
1718 <literal>p</> = primary key constraint,
1719 <literal>u</> = unique constraint
1720 </entry>
1721 </row>
1723 <row>
1724 <entry><structfield>condeferrable</structfield></entry>
1725 <entry><type>bool</type></entry>
1726 <entry></entry>
1727 <entry>Is the constraint deferrable?</entry>
1728 </row>
1730 <row>
1731 <entry><structfield>condeferred</structfield></entry>
1732 <entry><type>bool</type></entry>
1733 <entry></entry>
1734 <entry>Is the constraint deferred by default?</entry>
1735 </row>
1737 <row>
1738 <entry><structfield>conrelid</structfield></entry>
1739 <entry><type>oid</type></entry>
1740 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1741 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1742 </row>
1744 <row>
1745 <entry><structfield>contypid</structfield></entry>
1746 <entry><type>oid</type></entry>
1747 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1748 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1749 </row>
1751 <row>
1752 <entry><structfield>confrelid</structfield></entry>
1753 <entry><type>oid</type></entry>
1754 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1755 <entry>If a foreign key, the referenced table; else 0</entry>
1756 </row>
1758 <row>
1759 <entry><structfield>confupdtype</structfield></entry>
1760 <entry><type>char</type></entry>
1761 <entry></entry>
1762 <entry>Foreign key update action code:
1763 <literal>a</> = no action,
1764 <literal>r</> = restrict,
1765 <literal>c</> = cascade,
1766 <literal>n</> = set null,
1767 <literal>d</> = set default
1768 </entry>
1769 </row>
1771 <row>
1772 <entry><structfield>confdeltype</structfield></entry>
1773 <entry><type>char</type></entry>
1774 <entry></entry>
1775 <entry>Foreign key deletion action code:
1776 <literal>a</> = no action,
1777 <literal>r</> = restrict,
1778 <literal>c</> = cascade,
1779 <literal>n</> = set null,
1780 <literal>d</> = set default
1781 </entry>
1782 </row>
1784 <row>
1785 <entry><structfield>confmatchtype</structfield></entry>
1786 <entry><type>char</type></entry>
1787 <entry></entry>
1788 <entry>Foreign key match type:
1789 <literal>f</> = full,
1790 <literal>p</> = partial,
1791 <literal>u</> = simple (unspecified)
1792 </entry>
1793 </row>
1795 <row>
1796 <entry><structfield>conislocal</structfield></entry>
1797 <entry><type>bool</type></entry>
1798 <entry></entry>
1799 <entry>
1800 This constraint is defined locally in the relation. Note that a
1801 constraint can be locally defined and inherited simultaneously
1802 </entry>
1803 </row>
1805 <row>
1806 <entry><structfield>coninhcount</structfield></entry>
1807 <entry><type>int4</type></entry>
1808 <entry></entry>
1809 <entry>
1810 The number of direct ancestors this constraint has. A constraint with
1811 a nonzero number of ancestors cannot be dropped nor renamed
1812 </entry>
1813 </row>
1815 <row>
1816 <entry><structfield>conkey</structfield></entry>
1817 <entry><type>int2[]</type></entry>
1818 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1819 <entry>If a table constraint (including a foreign key), list of the constrained columns</entry>
1820 </row>
1822 <row>
1823 <entry><structfield>confkey</structfield></entry>
1824 <entry><type>int2[]</type></entry>
1825 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1826 <entry>If a foreign key, list of the referenced columns</entry>
1827 </row>
1829 <row>
1830 <entry><structfield>conpfeqop</structfield></entry>
1831 <entry><type>oid[]</type></entry>
1832 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1833 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
1834 </row>
1836 <row>
1837 <entry><structfield>conppeqop</structfield></entry>
1838 <entry><type>oid[]</type></entry>
1839 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1840 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
1841 </row>
1843 <row>
1844 <entry><structfield>conffeqop</structfield></entry>
1845 <entry><type>oid[]</type></entry>
1846 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1847 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
1848 </row>
1850 <row>
1851 <entry><structfield>conbin</structfield></entry>
1852 <entry><type>text</type></entry>
1853 <entry></entry>
1854 <entry>If a check constraint, an internal representation of the expression</entry>
1855 </row>
1857 <row>
1858 <entry><structfield>consrc</structfield></entry>
1859 <entry><type>text</type></entry>
1860 <entry></entry>
1861 <entry>If a check constraint, a human-readable representation of the expression</entry>
1862 </row>
1863 </tbody>
1864 </tgroup>
1865 </table>
1867 <note>
1868 <para>
1869 <structfield>consrc</structfield> is not updated when referenced objects
1870 change; for example, it won't track renaming of columns. Rather than
1871 relying on this field, it's best to use <function>pg_get_constraintdef()</>
1872 to extract the definition of a check constraint.
1873 </para>
1874 </note>
1876 <note>
1877 <para>
1878 <literal>pg_class.relchecks</literal> needs to agree with the
1879 number of check-constraint entries found in this table for each
1880 relation.
1881 </para>
1882 </note>
1884 </sect1>
1886 <sect1 id="catalog-pg-conversion">
1887 <title><structname>pg_conversion</structname></title>
1889 <indexterm zone="catalog-pg-conversion">
1890 <primary>pg_conversion</primary>
1891 </indexterm>
1893 <para>
1894 The catalog <structname>pg_conversion</structname> describes the
1895 available encoding conversion procedures. See
1896 <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
1897 for more information.
1898 </para>
1900 <table>
1901 <title><structname>pg_conversion</> Columns</title>
1903 <tgroup cols="4">
1904 <thead>
1905 <row>
1906 <entry>Name</entry>
1907 <entry>Type</entry>
1908 <entry>References</entry>
1909 <entry>Description</entry>
1910 </row>
1911 </thead>
1913 <tbody>
1914 <row>
1915 <entry><structfield>conname</structfield></entry>
1916 <entry><type>name</type></entry>
1917 <entry></entry>
1918 <entry>Conversion name (unique within a namespace)</entry>
1919 </row>
1921 <row>
1922 <entry><structfield>connamespace</structfield></entry>
1923 <entry><type>oid</type></entry>
1924 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1925 <entry>
1926 The OID of the namespace that contains this conversion
1927 </entry>
1928 </row>
1930 <row>
1931 <entry><structfield>conowner</structfield></entry>
1932 <entry><type>oid</type></entry>
1933 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1934 <entry>Owner of the conversion</entry>
1935 </row>
1937 <row>
1938 <entry><structfield>conforencoding</structfield></entry>
1939 <entry><type>int4</type></entry>
1940 <entry></entry>
1941 <entry>Source encoding ID</entry>
1942 </row>
1944 <row>
1945 <entry><structfield>contoencoding</structfield></entry>
1946 <entry><type>int4</type></entry>
1947 <entry></entry>
1948 <entry>Destination encoding ID</entry>
1949 </row>
1951 <row>
1952 <entry><structfield>conproc</structfield></entry>
1953 <entry><type>regproc</type></entry>
1954 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1955 <entry>Conversion procedure</entry>
1956 </row>
1958 <row>
1959 <entry><structfield>condefault</structfield></entry>
1960 <entry><type>bool</type></entry>
1961 <entry></entry>
1962 <entry>True if this is the default conversion</entry>
1963 </row>
1965 </tbody>
1966 </tgroup>
1967 </table>
1969 </sect1>
1971 <sect1 id="catalog-pg-database">
1972 <title><structname>pg_database</structname></title>
1974 <indexterm zone="catalog-pg-database">
1975 <primary>pg_database</primary>
1976 </indexterm>
1978 <para>
1979 The catalog <structname>pg_database</structname> stores information about
1980 the available databases. Databases are created with the <xref
1981 linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
1982 Consult <xref linkend="managing-databases"> for details about the meaning
1983 of some of the parameters.
1984 </para>
1986 <para>
1987 Unlike most system catalogs, <structname>pg_database</structname>
1988 is shared across all databases of a cluster: there is only one
1989 copy of <structname>pg_database</structname> per cluster, not
1990 one per database.
1991 </para>
1993 <table>
1994 <title><structname>pg_database</> Columns</title>
1996 <tgroup cols="4">
1997 <thead>
1998 <row>
1999 <entry>Name</entry>
2000 <entry>Type</entry>
2001 <entry>References</entry>
2002 <entry>Description</entry>
2003 </row>
2004 </thead>
2006 <tbody>
2007 <row>
2008 <entry><structfield>datname</structfield></entry>
2009 <entry><type>name</type></entry>
2010 <entry></entry>
2011 <entry>Database name</entry>
2012 </row>
2014 <row>
2015 <entry><structfield>datdba</structfield></entry>
2016 <entry><type>oid</type></entry>
2017 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2018 <entry>Owner of the database, usually the user who created it</entry>
2019 </row>
2021 <row>
2022 <entry><structfield>encoding</structfield></entry>
2023 <entry><type>int4</type></entry>
2024 <entry></entry>
2025 <entry>Character encoding for this database
2026 (<function>pg_encoding_to_char()</function> can translate
2027 this number to the encoding name)</entry>
2028 </row>
2030 <row>
2031 <entry><structfield>datcollate</structfield></entry>
2032 <entry><type>name</type></entry>
2033 <entry></entry>
2034 <entry>LC_COLLATE for this database</entry>
2035 </row>
2037 <row>
2038 <entry><structfield>datctype</structfield></entry>
2039 <entry><type>name</type></entry>
2040 <entry></entry>
2041 <entry>LC_CTYPE for this database</entry>
2042 </row>
2044 <row>
2045 <entry><structfield>datistemplate</structfield></entry>
2046 <entry><type>bool</type></entry>
2047 <entry></entry>
2048 <entry>
2049 If true then this database can be used in the
2050 <literal>TEMPLATE</literal> clause of <command>CREATE
2051 DATABASE</command> to create a new database as a clone of
2052 this one
2053 </entry>
2054 </row>
2056 <row>
2057 <entry><structfield>datallowconn</structfield></entry>
2058 <entry><type>bool</type></entry>
2059 <entry></entry>
2060 <entry>
2061 If false then no one can connect to this database. This is
2062 used to protect the <literal>template0</> database from being altered
2063 </entry>
2064 </row>
2066 <row>
2067 <entry><structfield>datconnlimit</structfield></entry>
2068 <entry><type>int4</type></entry>
2069 <entry></entry>
2070 <entry>
2071 Sets maximum number of concurrent connections that can be made
2072 to this database. -1 means no limit
2073 </entry>
2074 </row>
2076 <row>
2077 <entry><structfield>datlastsysoid</structfield></entry>
2078 <entry><type>oid</type></entry>
2079 <entry></entry>
2080 <entry>
2081 Last system OID in the database; useful
2082 particularly to <application>pg_dump</application>
2083 </entry>
2084 </row>
2086 <row>
2087 <entry><structfield>datfrozenxid</structfield></entry>
2088 <entry><type>xid</type></entry>
2089 <entry></entry>
2090 <entry>
2091 All transaction IDs before this one have been replaced with a permanent
2092 (<quote>frozen</>) transaction ID in this database. This is used to
2093 track whether the database needs to be vacuumed in order to prevent
2094 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2095 It is the minimum of the per-table
2096 <structname>pg_class</>.<structfield>relfrozenxid</> values
2097 </entry>
2098 </row>
2100 <row>
2101 <entry><structfield>dattablespace</structfield></entry>
2102 <entry><type>oid</type></entry>
2103 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2104 <entry>
2105 The default tablespace for the database.
2106 Within this database, all tables for which
2107 <structname>pg_class</>.<structfield>reltablespace</> is zero
2108 will be stored in this tablespace; in particular, all the non-shared
2109 system catalogs will be there
2110 </entry>
2111 </row>
2113 <row>
2114 <entry><structfield>datconfig</structfield></entry>
2115 <entry><type>text[]</type></entry>
2116 <entry></entry>
2117 <entry>Session defaults for run-time configuration variables</entry>
2118 </row>
2120 <row>
2121 <entry><structfield>datacl</structfield></entry>
2122 <entry><type>aclitem[]</type></entry>
2123 <entry></entry>
2124 <entry>
2125 Access privileges; see
2126 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2127 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2128 for details
2129 </entry>
2130 </row>
2131 </tbody>
2132 </tgroup>
2133 </table>
2134 </sect1>
2137 <sect1 id="catalog-pg-depend">
2138 <title><structname>pg_depend</structname></title>
2140 <indexterm zone="catalog-pg-depend">
2141 <primary>pg_depend</primary>
2142 </indexterm>
2144 <para>
2145 The catalog <structname>pg_depend</structname> records the dependency
2146 relationships between database objects. This information allows
2147 <command>DROP</> commands to find which other objects must be dropped
2148 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2149 RESTRICT</> case.
2150 </para>
2152 <para>
2153 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2154 which performs a similar function for dependencies involving objects
2155 that are shared across a database cluster.
2156 </para>
2158 <table>
2159 <title><structname>pg_depend</> Columns</title>
2161 <tgroup cols="4">
2162 <thead>
2163 <row>
2164 <entry>Name</entry>
2165 <entry>Type</entry>
2166 <entry>References</entry>
2167 <entry>Description</entry>
2168 </row>
2169 </thead>
2171 <tbody>
2172 <row>
2173 <entry><structfield>classid</structfield></entry>
2174 <entry><type>oid</type></entry>
2175 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2176 <entry>The OID of the system catalog the dependent object is in</entry>
2177 </row>
2179 <row>
2180 <entry><structfield>objid</structfield></entry>
2181 <entry><type>oid</type></entry>
2182 <entry>any OID column</entry>
2183 <entry>The OID of the specific dependent object</entry>
2184 </row>
2186 <row>
2187 <entry><structfield>objsubid</structfield></entry>
2188 <entry><type>int4</type></entry>
2189 <entry></entry>
2190 <entry>
2191 For a table column, this is the column number (the
2192 <structfield>objid</> and <structfield>classid</> refer to the
2193 table itself). For all other object types, this column is
2194 zero
2195 </entry>
2196 </row>
2198 <row>
2199 <entry><structfield>refclassid</structfield></entry>
2200 <entry><type>oid</type></entry>
2201 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2202 <entry>The OID of the system catalog the referenced object is in</entry>
2203 </row>
2205 <row>
2206 <entry><structfield>refobjid</structfield></entry>
2207 <entry><type>oid</type></entry>
2208 <entry>any OID column</entry>
2209 <entry>The OID of the specific referenced object</entry>
2210 </row>
2212 <row>
2213 <entry><structfield>refobjsubid</structfield></entry>
2214 <entry><type>int4</type></entry>
2215 <entry></entry>
2216 <entry>
2217 For a table column, this is the column number (the
2218 <structfield>refobjid</> and <structfield>refclassid</> refer
2219 to the table itself). For all other object types, this column
2220 is zero
2221 </entry>
2222 </row>
2224 <row>
2225 <entry><structfield>deptype</structfield></entry>
2226 <entry><type>char</type></entry>
2227 <entry></entry>
2228 <entry>
2229 A code defining the specific semantics of this dependency relationship; see text
2230 </entry>
2231 </row>
2233 </tbody>
2234 </tgroup>
2235 </table>
2237 <para>
2238 In all cases, a <structname>pg_depend</structname> entry indicates that the
2239 referenced object cannot be dropped without also dropping the dependent
2240 object. However, there are several subflavors identified by
2241 <structfield>deptype</>:
2243 <variablelist>
2244 <varlistentry>
2245 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2246 <listitem>
2247 <para>
2248 A normal relationship between separately-created objects. The
2249 dependent object can be dropped without affecting the
2250 referenced object. The referenced object can only be dropped
2251 by specifying <literal>CASCADE</>, in which case the dependent
2252 object is dropped, too. Example: a table column has a normal
2253 dependency on its data type.
2254 </para>
2255 </listitem>
2256 </varlistentry>
2258 <varlistentry>
2259 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2260 <listitem>
2261 <para>
2262 The dependent object can be dropped separately from the
2263 referenced object, and should be automatically dropped
2264 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2265 mode) if the referenced object is dropped. Example: a named
2266 constraint on a table is made autodependent on the table, so
2267 that it will go away if the table is dropped.
2268 </para>
2269 </listitem>
2270 </varlistentry>
2272 <varlistentry>
2273 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2274 <listitem>
2275 <para>
2276 The dependent object was created as part of creation of the
2277 referenced object, and is really just a part of its internal
2278 implementation. A <command>DROP</> of the dependent object
2279 will be disallowed outright (we'll tell the user to issue a
2280 <command>DROP</> against the referenced object, instead). A
2281 <command>DROP</> of the referenced object will be propagated
2282 through to drop the dependent object whether
2283 <command>CASCADE</> is specified or not. Example: a trigger
2284 that's created to enforce a foreign-key constraint is made
2285 internally dependent on the constraint's
2286 <structname>pg_constraint</> entry.
2287 </para>
2288 </listitem>
2289 </varlistentry>
2291 <varlistentry>
2292 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2293 <listitem>
2294 <para>
2295 There is no dependent object; this type of entry is a signal
2296 that the system itself depends on the referenced object, and so
2297 that object must never be deleted. Entries of this type are
2298 created only by <command>initdb</command>. The columns for the
2299 dependent object contain zeroes.
2300 </para>
2301 </listitem>
2302 </varlistentry>
2303 </variablelist>
2305 Other dependency flavors might be needed in future.
2306 </para>
2308 </sect1>
2311 <sect1 id="catalog-pg-description">
2312 <title><structname>pg_description</structname></title>
2314 <indexterm zone="catalog-pg-description">
2315 <primary>pg_description</primary>
2316 </indexterm>
2318 <para>
2319 The catalog <structname>pg_description</> stores optional descriptions
2320 (comments) for each database object. Descriptions can be manipulated
2321 with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2322 <application>psql</application>'s <literal>\d</literal> commands.
2323 Descriptions of many built-in system objects are provided in the initial
2324 contents of <structname>pg_description</structname>.
2325 </para>
2327 <para>
2328 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2329 which performs a similar function for descriptions involving objects that
2330 are shared across a database cluster.
2331 </para>
2333 <table>
2334 <title><structname>pg_description</> Columns</title>
2336 <tgroup cols="4">
2337 <thead>
2338 <row>
2339 <entry>Name</entry>
2340 <entry>Type</entry>
2341 <entry>References</entry>
2342 <entry>Description</entry>
2343 </row>
2344 </thead>
2346 <tbody>
2347 <row>
2348 <entry><structfield>objoid</structfield></entry>
2349 <entry><type>oid</type></entry>
2350 <entry>any OID column</entry>
2351 <entry>The OID of the object this description pertains to</entry>
2352 </row>
2354 <row>
2355 <entry><structfield>classoid</structfield></entry>
2356 <entry><type>oid</type></entry>
2357 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2358 <entry>The OID of the system catalog this object appears in</entry>
2359 </row>
2361 <row>
2362 <entry><structfield>objsubid</structfield></entry>
2363 <entry><type>int4</type></entry>
2364 <entry></entry>
2365 <entry>
2366 For a comment on a table column, this is the column number (the
2367 <structfield>objoid</> and <structfield>classoid</> refer to
2368 the table itself). For all other object types, this column is
2369 zero
2370 </entry>
2371 </row>
2373 <row>
2374 <entry><structfield>description</structfield></entry>
2375 <entry><type>text</type></entry>
2376 <entry></entry>
2377 <entry>Arbitrary text that serves as the description of this object</entry>
2378 </row>
2379 </tbody>
2380 </tgroup>
2381 </table>
2383 </sect1>
2386 <sect1 id="catalog-pg-enum">
2387 <title><structname>pg_enum</structname></title>
2389 <indexterm zone="catalog-pg-enum">
2390 <primary>pg_enum</primary>
2391 </indexterm>
2393 <para>
2394 The <structname>pg_enum</structname> catalog contains entries
2395 matching enum types to their associated values and labels. The
2396 internal representation of a given enum value is actually the OID
2397 of its associated row in <structname>pg_enum</structname>. The
2398 OIDs for a particular enum type are guaranteed to be ordered in
2399 the way the type should sort, but there is no guarantee about the
2400 ordering of OIDs of unrelated enum types.
2401 </para>
2403 <table>
2404 <title><structname>pg_enum</> Columns</title>
2406 <tgroup cols="4">
2407 <thead>
2408 <row>
2409 <entry>Name</entry>
2410 <entry>Type</entry>
2411 <entry>References</entry>
2412 <entry>Description</entry>
2413 </row>
2414 </thead>
2416 <tbody>
2417 <row>
2418 <entry><structfield>enumtypid</structfield></entry>
2419 <entry><type>oid</type></entry>
2420 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2421 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2422 </row>
2424 <row>
2425 <entry><structfield>enumlabel</structfield></entry>
2426 <entry><type>name</type></entry>
2427 <entry></entry>
2428 <entry>The textual label for this enum value</entry>
2429 </row>
2430 </tbody>
2431 </tgroup>
2432 </table>
2433 </sect1>
2436 <sect1 id="catalog-pg-foreign-data-wrapper">
2437 <title><structname>pg_foreign_data_wrapper</structname></title>
2439 <indexterm zone="catalog-pg-foreign-data-wrapper">
2440 <primary>pg_foreign_data_wrapper</primary>
2441 </indexterm>
2443 <para>
2444 The catalog <structname>pg_foreign_data_wrapper</structname> stores
2445 foreign-data wrapper definitions. A foreign-data wrapper is the
2446 mechanism by which external data, residing on foreign servers, is
2447 accessed.
2448 </para>
2450 <table>
2451 <title><structname>pg_foreign_data_wrapper</> Columns</title>
2453 <tgroup cols="4">
2454 <thead>
2455 <row>
2456 <entry>Name</entry>
2457 <entry>Type</entry>
2458 <entry>References</entry>
2459 <entry>Description</entry>
2460 </row>
2461 </thead>
2463 <tbody>
2464 <row>
2465 <entry><structfield>fdwname</structfield></entry>
2466 <entry><type>name</type></entry>
2467 <entry></entry>
2468 <entry>Name of the foreign-data wrapper</entry>
2469 </row>
2471 <row>
2472 <entry><structfield>fdwowner</structfield></entry>
2473 <entry><type>oid</type></entry>
2474 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2475 <entry>Owner of the foreign-data wrapper</entry>
2476 </row>
2478 <row>
2479 <entry><structfield>fdwvalidator</structfield></entry>
2480 <entry><type>oid</type></entry>
2481 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2482 <entry>
2483 References a validator function that is responsible for
2484 checking the validity of the generic options given to the
2485 foreign-data wrapper, as well as to foreign servers and user
2486 mappings using the foreign-data wrapper. Zero if no validator
2487 is provided.
2488 </entry>
2489 </row>
2491 <row>
2492 <entry><structfield>fdwacl</structfield></entry>
2493 <entry><type>aclitem[]</type></entry>
2494 <entry></entry>
2495 <entry>
2496 Access privileges; see
2497 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2498 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2499 for details
2500 </entry>
2501 </row>
2503 <row>
2504 <entry><structfield>fdwoptions</structfield></entry>
2505 <entry><type>text[]</type></entry>
2506 <entry></entry>
2507 <entry>
2508 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
2509 </entry>
2510 </row>
2511 </tbody>
2512 </tgroup>
2513 </table>
2514 </sect1>
2517 <sect1 id="catalog-pg-foreign-server">
2518 <title><structname>pg_foreign_server</structname></title>
2520 <indexterm zone="catalog-pg-foreign-server">
2521 <primary>pg_foreign_server</primary>
2522 </indexterm>
2524 <para>
2525 The catalog <structname>pg_foreign_server</structname> stores
2526 foreign server definitions. A foreign server describes the
2527 connection to a remote server, managing external data. Foreign
2528 servers are accessed via foreign-data wrappers.
2529 </para>
2531 <table>
2532 <title><structname>pg_foreign_server</> Columns</title>
2534 <tgroup cols="4">
2535 <thead>
2536 <row>
2537 <entry>Name</entry>
2538 <entry>Type</entry>
2539 <entry>References</entry>
2540 <entry>Description</entry>
2541 </row>
2542 </thead>
2544 <tbody>
2545 <row>
2546 <entry><structfield>srvname</structfield></entry>
2547 <entry><type>name</type></entry>
2548 <entry></entry>
2549 <entry>Name of the foreign server</entry>
2550 </row>
2552 <row>
2553 <entry><structfield>srvowner</structfield></entry>
2554 <entry><type>oid</type></entry>
2555 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2556 <entry>Owner of the foreign server</entry>
2557 </row>
2559 <row>
2560 <entry><structfield>srvfdw</structfield></entry>
2561 <entry><type>oid</type></entry>
2562 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
2563 <entry>The OID of the foreign-data wrapper of this foreign server</entry>
2564 </row>
2566 <row>
2567 <entry><structfield>srvtype</structfield></entry>
2568 <entry><type>text</type></entry>
2569 <entry></entry>
2570 <entry>Type of the server (optional)</entry>
2571 </row>
2573 <row>
2574 <entry><structfield>srvversion</structfield></entry>
2575 <entry><type>text</type></entry>
2576 <entry></entry>
2577 <entry>Version of the server (optional)</entry>
2578 </row>
2580 <row>
2581 <entry><structfield>srvacl</structfield></entry>
2582 <entry><type>aclitem[]</type></entry>
2583 <entry></entry>
2584 <entry>
2585 Access privileges; see
2586 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2587 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2588 for details
2589 </entry>
2590 </row>
2592 <row>
2593 <entry><structfield>srvoptions</structfield></entry>
2594 <entry><type>text[]</type></entry>
2595 <entry></entry>
2596 <entry>
2597 Foreign server specific options, as <quote>keyword=value</> strings.
2598 </entry>
2599 </row>
2600 </tbody>
2601 </tgroup>
2602 </table>
2603 </sect1>
2606 <sect1 id="catalog-pg-index">
2607 <title><structname>pg_index</structname></title>
2609 <indexterm zone="catalog-pg-index">
2610 <primary>pg_index</primary>
2611 </indexterm>
2613 <para>
2614 The catalog <structname>pg_index</structname> contains part of the information
2615 about indexes. The rest is mostly in
2616 <structname>pg_class</structname>.
2617 </para>
2619 <table>
2620 <title><structname>pg_index</> Columns</title>
2622 <tgroup cols="4">
2623 <thead>
2624 <row>
2625 <entry>Name</entry>
2626 <entry>Type</entry>
2627 <entry>References</entry>
2628 <entry>Description</entry>
2629 </row>
2630 </thead>
2632 <tbody>
2633 <row>
2634 <entry><structfield>indexrelid</structfield></entry>
2635 <entry><type>oid</type></entry>
2636 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2637 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2638 </row>
2640 <row>
2641 <entry><structfield>indrelid</structfield></entry>
2642 <entry><type>oid</type></entry>
2643 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2644 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2645 </row>
2647 <row>
2648 <entry><structfield>indnatts</structfield></entry>
2649 <entry><type>int2</type></entry>
2650 <entry></entry>
2651 <entry>The number of columns in the index (duplicates
2652 <literal>pg_class.relnatts</literal>)</entry>
2653 </row>
2655 <row>
2656 <entry><structfield>indisunique</structfield></entry>
2657 <entry><type>bool</type></entry>
2658 <entry></entry>
2659 <entry>If true, this is a unique index</entry>
2660 </row>
2662 <row>
2663 <entry><structfield>indisprimary</structfield></entry>
2664 <entry><type>bool</type></entry>
2665 <entry></entry>
2666 <entry>If true, this index represents the primary key of the table
2667 (<structfield>indisunique</> should always be true when this is true)</entry>
2668 </row>
2670 <row>
2671 <entry><structfield>indisclustered</structfield></entry>
2672 <entry><type>bool</type></entry>
2673 <entry></entry>
2674 <entry>If true, the table was last clustered on this index</entry>
2675 </row>
2677 <row>
2678 <entry><structfield>indisvalid</structfield></entry>
2679 <entry><type>bool</type></entry>
2680 <entry></entry>
2681 <entry>
2682 If true, the index is currently valid for queries. False means the
2683 index is possibly incomplete: it must still be modified by
2684 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2685 be used for queries. If it is unique, the uniqueness property is not
2686 true either
2687 </entry>
2688 </row>
2690 <row>
2691 <entry><structfield>indcheckxmin</structfield></entry>
2692 <entry><type>bool</type></entry>
2693 <entry></entry>
2694 <entry>
2695 If true, queries must not use the index until the <structfield>xmin</>
2696 of this <structname>pg_index</> row is below their TransactionXmin
2697 event horizon, because the table may contain broken HOT chains with
2698 incompatible rows that they can see
2699 </entry>
2700 </row>
2702 <row>
2703 <entry><structfield>indisready</structfield></entry>
2704 <entry><type>bool</type></entry>
2705 <entry></entry>
2706 <entry>
2707 If true, the index is currently ready for inserts. False means the
2708 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2709 operations
2710 </entry>
2711 </row>
2713 <row>
2714 <entry><structfield>indkey</structfield></entry>
2715 <entry><type>int2vector</type></entry>
2716 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2717 <entry>
2718 This is an array of <structfield>indnatts</structfield> values that
2719 indicate which table columns this index indexes. For example a value
2720 of <literal>1 3</literal> would mean that the first and the third table
2721 columns make up the index key. A zero in this array indicates that the
2722 corresponding index attribute is an expression over the table columns,
2723 rather than a simple column reference
2724 </entry>
2725 </row>
2727 <row>
2728 <entry><structfield>indclass</structfield></entry>
2729 <entry><type>oidvector</type></entry>
2730 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2731 <entry>
2732 For each column in the index key, this contains the OID of
2733 the operator class to use. See
2734 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2735 </entry>
2736 </row>
2738 <row>
2739 <entry><structfield>indoption</structfield></entry>
2740 <entry><type>int2vector</type></entry>
2741 <entry></entry>
2742 <entry>
2743 This is an array of <structfield>indnatts</structfield> values that
2744 store per-column flag bits. The meaning of the bits is defined by
2745 the index's access method
2746 </entry>
2747 </row>
2749 <row>
2750 <entry><structfield>indexprs</structfield></entry>
2751 <entry><type>text</type></entry>
2752 <entry></entry>
2753 <entry>Expression trees (in <function>nodeToString()</function> representation)
2754 for index attributes that are not simple column references. This is a
2755 list with one element for each zero entry in <structfield>indkey</>.
2756 NULL if all index attributes are simple references</entry>
2757 </row>
2759 <row>
2760 <entry><structfield>indpred</structfield></entry>
2761 <entry><type>text</type></entry>
2762 <entry></entry>
2763 <entry>Expression tree (in <function>nodeToString()</function> representation)
2764 for partial index predicate. NULL if not a partial index</entry>
2765 </row>
2766 </tbody>
2767 </tgroup>
2768 </table>
2770 </sect1>
2773 <sect1 id="catalog-pg-inherits">
2774 <title><structname>pg_inherits</structname></title>
2776 <indexterm zone="catalog-pg-inherits">
2777 <primary>pg_inherits</primary>
2778 </indexterm>
2780 <para>
2781 The catalog <structname>pg_inherits</> records information about
2782 table inheritance hierarchies. There is one entry for each direct
2783 child table in the database. (Indirect inheritance can be determined
2784 by following chains of entries.)
2785 </para>
2787 <table>
2788 <title><structname>pg_inherits</> Columns</title>
2790 <tgroup cols="4">
2791 <thead>
2792 <row>
2793 <entry>Name</entry>
2794 <entry>Type</entry>
2795 <entry>References</entry>
2796 <entry>Description</entry>
2797 </row>
2798 </thead>
2800 <tbody>
2801 <row>
2802 <entry><structfield>inhrelid</structfield></entry>
2803 <entry><type>oid</type></entry>
2804 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2805 <entry>
2806 The OID of the child table
2807 </entry>
2808 </row>
2810 <row>
2811 <entry><structfield>inhparent</structfield></entry>
2812 <entry><type>oid</type></entry>
2813 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2814 <entry>
2815 The OID of the parent table
2816 </entry>
2817 </row>
2819 <row>
2820 <entry><structfield>inhseqno</structfield></entry>
2821 <entry><type>int4</type></entry>
2822 <entry></entry>
2823 <entry>
2824 If there is more than one direct parent for a child table (multiple
2825 inheritance), this number tells the order in which the
2826 inherited columns are to be arranged. The count starts at 1
2827 </entry>
2828 </row>
2829 </tbody>
2830 </tgroup>
2831 </table>
2833 </sect1>
2836 <sect1 id="catalog-pg-language">
2837 <title><structname>pg_language</structname></title>
2839 <indexterm zone="catalog-pg-language">
2840 <primary>pg_language</primary>
2841 </indexterm>
2843 <para>
2844 The catalog <structname>pg_language</structname> registers
2845 languages in which you can write functions or stored procedures.
2846 See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
2847 and <xref linkend="xplang"> for more information about language handlers.
2848 </para>
2850 <table>
2851 <title><structname>pg_language</> Columns</title>
2853 <tgroup cols="4">
2854 <thead>
2855 <row>
2856 <entry>Name</entry>
2857 <entry>Type</entry>
2858 <entry>References</entry>
2859 <entry>Description</entry>
2860 </row>
2861 </thead>
2863 <tbody>
2864 <row>
2865 <entry><structfield>lanname</structfield></entry>
2866 <entry><type>name</type></entry>
2867 <entry></entry>
2868 <entry>Name of the language</entry>
2869 </row>
2871 <row>
2872 <entry><structfield>lanowner</structfield></entry>
2873 <entry><type>oid</type></entry>
2874 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2875 <entry>Owner of the language</entry>
2876 </row>
2878 <row>
2879 <entry><structfield>lanispl</structfield></entry>
2880 <entry><type>bool</type></entry>
2881 <entry></entry>
2882 <entry>
2883 This is false for internal languages (such as
2884 <acronym>SQL</acronym>) and true for user-defined languages.
2885 Currently, <application>pg_dump</application> still uses this
2886 to determine which languages need to be dumped, but this might be
2887 replaced by a different mechanism in the future
2888 </entry>
2889 </row>
2891 <row>
2892 <entry><structfield>lanpltrusted</structfield></entry>
2893 <entry><type>bool</type></entry>
2894 <entry></entry>
2895 <entry>
2896 True if this is a trusted language, which means that it is believed
2897 not to grant access to anything outside the normal SQL execution
2898 environment. Only superusers can create functions in untrusted
2899 languages
2900 </entry>
2901 </row>
2903 <row>
2904 <entry><structfield>lanplcallfoid</structfield></entry>
2905 <entry><type>oid</type></entry>
2906 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2907 <entry>
2908 For noninternal languages this references the language
2909 handler, which is a special function that is responsible for
2910 executing all functions that are written in the particular
2911 language
2912 </entry>
2913 </row>
2915 <row>
2916 <entry><structfield>lanvalidator</structfield></entry>
2917 <entry><type>oid</type></entry>
2918 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2919 <entry>
2920 This references a language validator function that is responsible
2921 for checking the syntax and validity of new functions when they
2922 are created. Zero if no validator is provided
2923 </entry>
2924 </row>
2926 <row>
2927 <entry><structfield>lanacl</structfield></entry>
2928 <entry><type>aclitem[]</type></entry>
2929 <entry></entry>
2930 <entry>
2931 Access privileges; see
2932 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2933 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2934 for details
2935 </entry>
2936 </row>
2937 </tbody>
2938 </tgroup>
2939 </table>
2941 </sect1>
2944 <sect1 id="catalog-pg-largeobject">
2945 <title><structname>pg_largeobject</structname></title>
2947 <indexterm zone="catalog-pg-largeobject">
2948 <primary>pg_largeobject</primary>
2949 </indexterm>
2951 <para>
2952 The catalog <structname>pg_largeobject</structname> holds the data making up
2953 <quote>large objects</quote>. A large object is identified by an
2954 OID assigned when it is created. Each large object is broken into
2955 segments or <quote>pages</> small enough to be conveniently stored as rows
2956 in <structname>pg_largeobject</structname>.
2957 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
2958 <literal>BLCKSZ/4</>, or typically 2 kB).
2959 </para>
2961 <table>
2962 <title><structname>pg_largeobject</> Columns</title>
2964 <tgroup cols="3">
2965 <thead>
2966 <row>
2967 <entry>Name</entry>
2968 <entry>Type</entry>
2969 <entry>Description</entry>
2970 </row>
2971 </thead>
2973 <tbody>
2974 <row>
2975 <entry><structfield>loid</structfield></entry>
2976 <entry><type>oid</type></entry>
2977 <entry>Identifier of the large object that includes this page</entry>
2978 </row>
2980 <row>
2981 <entry><structfield>pageno</structfield></entry>
2982 <entry><type>int4</type></entry>
2983 <entry>Page number of this page within its large object
2984 (counting from zero)</entry>
2985 </row>
2987 <row>
2988 <entry><structfield>data</structfield></entry>
2989 <entry><type>bytea</type></entry>
2990 <entry>
2991 Actual data stored in the large object.
2992 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
2993 </entry>
2994 </row>
2995 </tbody>
2996 </tgroup>
2997 </table>
2999 <para>
3000 Each row of <structname>pg_largeobject</structname> holds data
3001 for one page of a large object, beginning at
3002 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
3003 allows sparse storage: pages might be missing, and might be shorter than
3004 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
3005 Missing regions within a large object read as zeroes.
3006 </para>
3008 </sect1>
3011 <sect1 id="catalog-pg-listener">
3012 <title><structname>pg_listener</structname></title>
3014 <indexterm zone="catalog-pg-listener">
3015 <primary>pg_listener</primary>
3016 </indexterm>
3018 <para>
3019 The catalog <structname>pg_listener</structname> supports the
3020 <xref linkend="sql-listen" endterm="sql-listen-title"> and
3021 <xref linkend="sql-notify" endterm="sql-notify-title">
3022 commands. A listener creates an entry in
3023 <structname>pg_listener</structname> for each notification name
3024 it is listening for. A notifier scans <structname>pg_listener</structname>
3025 and updates each matching entry to show that a notification has occurred.
3026 The notifier also sends a signal (using the PID recorded in the table)
3027 to awaken the listener from sleep.
3028 </para>
3030 <table>
3031 <title><structname>pg_listener</> Columns</title>
3033 <tgroup cols="3">
3034 <thead>
3035 <row>
3036 <entry>Name</entry>
3037 <entry>Type</entry>
3038 <entry>Description</entry>
3039 </row>
3040 </thead>
3042 <tbody>
3043 <row>
3044 <entry><structfield>relname</structfield></entry>
3045 <entry><type>name</type></entry>
3046 <entry>
3047 Notify condition name. (The name need not match any actual
3048 relation in the database; the name <structfield>relname</> is historical.)
3049 </entry>
3050 </row>
3052 <row>
3053 <entry><structfield>listenerpid</structfield></entry>
3054 <entry><type>int4</type></entry>
3055 <entry>PID of the server process that created this entry</entry>
3056 </row>
3058 <row>
3059 <entry><structfield>notification</structfield></entry>
3060 <entry><type>int4</type></entry>
3061 <entry>
3062 Zero if no event is pending for this listener. If an event is
3063 pending, the PID of the server process that sent the notification
3064 </entry>
3065 </row>
3066 </tbody>
3067 </tgroup>
3068 </table>
3070 </sect1>
3073 <sect1 id="catalog-pg-namespace">
3074 <title><structname>pg_namespace</structname></title>
3076 <indexterm zone="catalog-pg-namespace">
3077 <primary>pg_namespace</primary>
3078 </indexterm>
3080 <para>
3081 The catalog <structname>pg_namespace</> stores namespaces.
3082 A namespace is the structure underlying SQL schemas: each namespace
3083 can have a separate collection of relations, types, etc. without name
3084 conflicts.
3085 </para>
3087 <table>
3088 <title><structname>pg_namespace</> Columns</title>
3090 <tgroup cols="4">
3091 <thead>
3092 <row>
3093 <entry>Name</entry>
3094 <entry>Type</entry>
3095 <entry>References</entry>
3096 <entry>Description</entry>
3097 </row>
3098 </thead>
3100 <tbody>
3101 <row>
3102 <entry><structfield>nspname</structfield></entry>
3103 <entry><type>name</type></entry>
3104 <entry></entry>
3105 <entry>Name of the namespace</entry>
3106 </row>
3108 <row>
3109 <entry><structfield>nspowner</structfield></entry>
3110 <entry><type>oid</type></entry>
3111 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3112 <entry>Owner of the namespace</entry>
3113 </row>
3115 <row>
3116 <entry><structfield>nspacl</structfield></entry>
3117 <entry><type>aclitem[]</type></entry>
3118 <entry></entry>
3119 <entry>
3120 Access privileges; see
3121 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3122 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3123 for details
3124 </entry>
3125 </row>
3126 </tbody>
3127 </tgroup>
3128 </table>
3130 </sect1>
3133 <sect1 id="catalog-pg-opclass">
3134 <title><structname>pg_opclass</structname></title>
3136 <indexterm zone="catalog-pg-opclass">
3137 <primary>pg_opclass</primary>
3138 </indexterm>
3140 <para>
3141 The catalog <structname>pg_opclass</structname> defines
3142 index access method operator classes. Each operator class defines
3143 semantics for index columns of a particular data type and a particular
3144 index access method. An operator class essentially specifies that a
3145 particular operator family is applicable to a particular indexable column
3146 data type. The set of operators from the family that are actually usable
3147 with the indexed column are whichever ones accept the column's data type
3148 as their lefthand input.
3149 </para>
3151 <para>
3152 Operator classes are described at length in <xref linkend="xindex">.
3153 </para>
3155 <table>
3156 <title><structname>pg_opclass</> Columns</title>
3158 <tgroup cols="4">
3159 <thead>
3160 <row>
3161 <entry>Name</entry>
3162 <entry>Type</entry>
3163 <entry>References</entry>
3164 <entry>Description</entry>
3165 </row>
3166 </thead>
3167 <tbody>
3169 <row>
3170 <entry><structfield>opcmethod</structfield></entry>
3171 <entry><type>oid</type></entry>
3172 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3173 <entry>Index access method operator class is for</entry>
3174 </row>
3176 <row>
3177 <entry><structfield>opcname</structfield></entry>
3178 <entry><type>name</type></entry>
3179 <entry></entry>
3180 <entry>Name of this operator class</entry>
3181 </row>
3183 <row>
3184 <entry><structfield>opcnamespace</structfield></entry>
3185 <entry><type>oid</type></entry>
3186 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3187 <entry>Namespace of this operator class</entry>
3188 </row>
3190 <row>
3191 <entry><structfield>opcowner</structfield></entry>
3192 <entry><type>oid</type></entry>
3193 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3194 <entry>Owner of the operator class</entry>
3195 </row>
3197 <row>
3198 <entry><structfield>opcfamily</structfield></entry>
3199 <entry><type>oid</type></entry>
3200 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3201 <entry>Operator family containing the operator class</entry>
3202 </row>
3204 <row>
3205 <entry><structfield>opcintype</structfield></entry>
3206 <entry><type>oid</type></entry>
3207 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3208 <entry>Data type that the operator class indexes</entry>
3209 </row>
3211 <row>
3212 <entry><structfield>opcdefault</structfield></entry>
3213 <entry><type>bool</type></entry>
3214 <entry></entry>
3215 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3216 </row>
3218 <row>
3219 <entry><structfield>opckeytype</structfield></entry>
3220 <entry><type>oid</type></entry>
3221 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3222 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3223 </row>
3225 </tbody>
3226 </tgroup>
3227 </table>
3229 <para>
3230 An operator class's <structfield>opcmethod</> must match the
3231 <structname>opfmethod</> of its containing operator family.
3232 Also, there must be no more than one <structname>pg_opclass</structname>
3233 row having <structname>opcdefault</> true for any given combination of
3234 <structname>opcmethod</> and <structname>opcintype</>.
3235 </para>
3237 </sect1>
3240 <sect1 id="catalog-pg-operator">
3241 <title><structname>pg_operator</structname></title>
3243 <indexterm zone="catalog-pg-operator">
3244 <primary>pg_operator</primary>
3245 </indexterm>
3247 <para>
3248 The catalog <structname>pg_operator</> stores information about operators.
3249 See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3250 and <xref linkend="xoper"> for more information.
3251 </para>
3253 <table>
3254 <title><structname>pg_operator</> Columns</title>
3256 <tgroup cols="4">
3257 <thead>
3258 <row>
3259 <entry>Name</entry>
3260 <entry>Type</entry>
3261 <entry>References</entry>
3262 <entry>Description</entry>
3263 </row>
3264 </thead>
3266 <tbody>
3267 <row>
3268 <entry><structfield>oprname</structfield></entry>
3269 <entry><type>name</type></entry>
3270 <entry></entry>
3271 <entry>Name of the operator</entry>
3272 </row>
3274 <row>
3275 <entry><structfield>oprnamespace</structfield></entry>
3276 <entry><type>oid</type></entry>
3277 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3278 <entry>
3279 The OID of the namespace that contains this operator
3280 </entry>
3281 </row>
3283 <row>
3284 <entry><structfield>oprowner</structfield></entry>
3285 <entry><type>oid</type></entry>
3286 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3287 <entry>Owner of the operator</entry>
3288 </row>
3290 <row>
3291 <entry><structfield>oprkind</structfield></entry>
3292 <entry><type>char</type></entry>
3293 <entry></entry>
3294 <entry>
3295 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3296 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3297 </entry>
3298 </row>
3300 <row>
3301 <entry><structfield>oprcanmerge</structfield></entry>
3302 <entry><type>bool</type></entry>
3303 <entry></entry>
3304 <entry>This operator supports merge joins</entry>
3305 </row>
3307 <row>
3308 <entry><structfield>oprcanhash</structfield></entry>
3309 <entry><type>bool</type></entry>
3310 <entry></entry>
3311 <entry>This operator supports hash joins</entry>
3312 </row>
3314 <row>
3315 <entry><structfield>oprleft</structfield></entry>
3316 <entry><type>oid</type></entry>
3317 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3318 <entry>Type of the left operand</entry>
3319 </row>
3321 <row>
3322 <entry><structfield>oprright</structfield></entry>
3323 <entry><type>oid</type></entry>
3324 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3325 <entry>Type of the right operand</entry>
3326 </row>
3328 <row>
3329 <entry><structfield>oprresult</structfield></entry>
3330 <entry><type>oid</type></entry>
3331 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3332 <entry>Type of the result</entry>
3333 </row>
3335 <row>
3336 <entry><structfield>oprcom</structfield></entry>
3337 <entry><type>oid</type></entry>
3338 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3339 <entry>Commutator of this operator, if any</entry>
3340 </row>
3342 <row>
3343 <entry><structfield>oprnegate</structfield></entry>
3344 <entry><type>oid</type></entry>
3345 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3346 <entry>Negator of this operator, if any</entry>
3347 </row>
3349 <row>
3350 <entry><structfield>oprcode</structfield></entry>
3351 <entry><type>regproc</type></entry>
3352 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3353 <entry>Function that implements this operator</entry>
3354 </row>
3356 <row>
3357 <entry><structfield>oprrest</structfield></entry>
3358 <entry><type>regproc</type></entry>
3359 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3360 <entry>Restriction selectivity estimation function for this operator</entry>
3361 </row>
3363 <row>
3364 <entry><structfield>oprjoin</structfield></entry>
3365 <entry><type>regproc</type></entry>
3366 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3367 <entry>Join selectivity estimation function for this operator</entry>
3368 </row>
3369 </tbody>
3370 </tgroup>
3371 </table>
3373 <para>
3374 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3375 is zero for a prefix operator.
3376 </para>
3378 </sect1>
3381 <sect1 id="catalog-pg-opfamily">
3382 <title><structname>pg_opfamily</structname></title>
3384 <indexterm zone="catalog-pg-opfamily">
3385 <primary>pg_opfamily</primary>
3386 </indexterm>
3388 <para>
3389 The catalog <structname>pg_opfamily</structname> defines operator families.
3390 Each operator family is a collection of operators and associated
3391 support routines that implement the semantics specified for a particular
3392 index access method. Furthermore, the operators in a family are all
3393 <quote>compatible</>, in a way that is specified by the access method.
3394 The operator family concept allows cross-data-type operators to be used
3395 with indexes and to be reasoned about using knowledge of access method
3396 semantics.
3397 </para>
3399 <para>
3400 Operator families are described at length in <xref linkend="xindex">.
3401 </para>
3403 <table>
3404 <title><structname>pg_opfamily</> Columns</title>
3406 <tgroup cols="4">
3407 <thead>
3408 <row>
3409 <entry>Name</entry>
3410 <entry>Type</entry>
3411 <entry>References</entry>
3412 <entry>Description</entry>
3413 </row>
3414 </thead>
3415 <tbody>
3417 <row>
3418 <entry><structfield>opfmethod</structfield></entry>
3419 <entry><type>oid</type></entry>
3420 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3421 <entry>Index access method operator family is for</entry>
3422 </row>
3424 <row>
3425 <entry><structfield>opfname</structfield></entry>
3426 <entry><type>name</type></entry>
3427 <entry></entry>
3428 <entry>Name of this operator family</entry>
3429 </row>
3431 <row>
3432 <entry><structfield>opfnamespace</structfield></entry>
3433 <entry><type>oid</type></entry>
3434 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3435 <entry>Namespace of this operator family</entry>
3436 </row>
3438 <row>
3439 <entry><structfield>opfowner</structfield></entry>
3440 <entry><type>oid</type></entry>
3441 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3442 <entry>Owner of the operator family</entry>
3443 </row>
3445 </tbody>
3446 </tgroup>
3447 </table>
3449 <para>
3450 The majority of the information defining an operator family is not in its
3451 <structname>pg_opfamily</structname> row, but in the associated rows in
3452 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3453 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3455 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3456 </para>
3458 </sect1>
3461 <sect1 id="catalog-pg-pltemplate">
3462 <title><structname>pg_pltemplate</structname></title>
3464 <indexterm zone="catalog-pg-pltemplate">
3465 <primary>pg_pltemplate</primary>
3466 </indexterm>
3468 <para>
3469 The catalog <structname>pg_pltemplate</structname> stores
3470 <quote>template</> information for procedural languages.
3471 A template for a language allows the language to be created in a
3472 particular database by a simple <command>CREATE LANGUAGE</> command,
3473 with no need to specify implementation details.
3474 </para>
3476 <para>
3477 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3478 is shared across all databases of a cluster: there is only one
3479 copy of <structname>pg_pltemplate</structname> per cluster, not
3480 one per database. This allows the information to be accessible in
3481 each database as it is needed.
3482 </para>
3484 <table>
3485 <title><structname>pg_pltemplate</> Columns</title>
3487 <tgroup cols="3">
3488 <thead>
3489 <row>
3490 <entry>Name</entry>
3491 <entry>Type</entry>
3492 <entry>Description</entry>
3493 </row>
3494 </thead>
3496 <tbody>
3497 <row>
3498 <entry><structfield>tmplname</structfield></entry>
3499 <entry><type>name</type></entry>
3500 <entry>Name of the language this template is for</entry>
3501 </row>
3503 <row>
3504 <entry><structfield>tmpltrusted</structfield></entry>
3505 <entry><type>boolean</type></entry>
3506 <entry>True if language is considered trusted</entry>
3507 </row>
3509 <row>
3510 <entry><structfield>tmpldbacreate</structfield></entry>
3511 <entry><type>boolean</type></entry>
3512 <entry>True if language may be created by a database owner</entry>
3513 </row>
3515 <row>
3516 <entry><structfield>tmplhandler</structfield></entry>
3517 <entry><type>text</type></entry>
3518 <entry>Name of call handler function</entry>
3519 </row>
3521 <row>
3522 <entry><structfield>tmplvalidator</structfield></entry>
3523 <entry><type>text</type></entry>
3524 <entry>Name of validator function, or NULL if none</entry>
3525 </row>
3527 <row>
3528 <entry><structfield>tmpllibrary</structfield></entry>
3529 <entry><type>text</type></entry>
3530 <entry>Path of shared library that implements language</entry>
3531 </row>
3533 <row>
3534 <entry><structfield>tmplacl</structfield></entry>
3535 <entry><type>aclitem[]</type></entry>
3536 <entry>Access privileges for template (not yet used)</entry>
3537 </row>
3539 </tbody>
3540 </tgroup>
3541 </table>
3543 <para>
3544 There are not currently any commands that manipulate procedural language
3545 templates; to change the built-in information, a superuser must modify
3546 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3547 or <command>UPDATE</command> commands. It is likely that a future
3548 release of <productname>PostgreSQL</productname> will offer
3549 commands to change the entries in a cleaner fashion.
3550 </para>
3552 <para>
3553 When implemented, the <structfield>tmplacl</structfield> field will provide
3554 access control for the template itself (i.e., the right to create a
3555 language using it), not for the languages created from the template.
3556 </para>
3558 </sect1>
3561 <sect1 id="catalog-pg-proc">
3562 <title><structname>pg_proc</structname></title>
3564 <indexterm zone="catalog-pg-proc">
3565 <primary>pg_proc</primary>
3566 </indexterm>
3568 <para>
3569 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3570 See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3571 and <xref linkend="xfunc"> for more information.
3572 </para>
3574 <para>
3575 The table contains data for aggregate functions as well as plain functions.
3576 If <structfield>proisagg</structfield> is true, there should be a matching
3577 row in <structfield>pg_aggregate</structfield>.
3578 </para>
3580 <table>
3581 <title><structname>pg_proc</> Columns</title>
3583 <tgroup cols="4">
3584 <thead>
3585 <row>
3586 <entry>Name</entry>
3587 <entry>Type</entry>
3588 <entry>References</entry>
3589 <entry>Description</entry>
3590 </row>
3591 </thead>
3593 <tbody>
3594 <row>
3595 <entry><structfield>proname</structfield></entry>
3596 <entry><type>name</type></entry>
3597 <entry></entry>
3598 <entry>Name of the function</entry>
3599 </row>
3601 <row>
3602 <entry><structfield>pronamespace</structfield></entry>
3603 <entry><type>oid</type></entry>
3604 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3605 <entry>
3606 The OID of the namespace that contains this function
3607 </entry>
3608 </row>
3610 <row>
3611 <entry><structfield>proowner</structfield></entry>
3612 <entry><type>oid</type></entry>
3613 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3614 <entry>Owner of the function</entry>
3615 </row>
3617 <row>
3618 <entry><structfield>prolang</structfield></entry>
3619 <entry><type>oid</type></entry>
3620 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3621 <entry>Implementation language or call interface of this function</entry>
3622 </row>
3624 <row>
3625 <entry><structfield>procost</structfield></entry>
3626 <entry><type>float4</type></entry>
3627 <entry></entry>
3628 <entry>Estimated execution cost (in units of
3629 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3630 this is cost per row returned</entry>
3631 </row>
3633 <row>
3634 <entry><structfield>prorows</structfield></entry>
3635 <entry><type>float4</type></entry>
3636 <entry></entry>
3637 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3638 </row>
3640 <row>
3641 <entry><structfield>provariadic</structfield></entry>
3642 <entry><type>oid</type></entry>
3643 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3644 <entry>Data type of the variadic array parameter's elements,
3645 or zero if the function does not have a variadic parameter</entry>
3646 </row>
3648 <row>
3649 <entry><structfield>proisagg</structfield></entry>
3650 <entry><type>bool</type></entry>
3651 <entry></entry>
3652 <entry>Function is an aggregate function</entry>
3653 </row>
3655 <row>
3656 <entry><structfield>proiswindow</structfield></entry>
3657 <entry><type>bool</type></entry>
3658 <entry></entry>
3659 <entry>Function is a window function</entry>
3660 </row>
3662 <row>
3663 <entry><structfield>prosecdef</structfield></entry>
3664 <entry><type>bool</type></entry>
3665 <entry></entry>
3666 <entry>Function is a security definer (i.e., a <quote>setuid</>
3667 function)</entry>
3668 </row>
3670 <row>
3671 <entry><structfield>proisstrict</structfield></entry>
3672 <entry><type>bool</type></entry>
3673 <entry></entry>
3674 <entry>
3675 Function returns null if any call argument is null. In that
3676 case the function won't actually be called at all. Functions
3677 that are not <quote>strict</quote> must be prepared to handle
3678 null inputs
3679 </entry>
3680 </row>
3682 <row>
3683 <entry><structfield>proretset</structfield></entry>
3684 <entry><type>bool</type></entry>
3685 <entry></entry>
3686 <entry>Function returns a set (i.e., multiple values of the specified
3687 data type)</entry>
3688 </row>
3690 <row>
3691 <entry><structfield>provolatile</structfield></entry>
3692 <entry><type>char</type></entry>
3693 <entry></entry>
3694 <entry>
3695 <structfield>provolatile</structfield> tells whether the function's
3696 result depends only on its input arguments, or is affected by outside
3697 factors.
3698 It is <literal>i</literal> for <quote>immutable</> functions,
3699 which always deliver the same result for the same inputs.
3700 It is <literal>s</literal> for <quote>stable</> functions,
3701 whose results (for fixed inputs) do not change within a scan.
3702 It is <literal>v</literal> for <quote>volatile</> functions,
3703 whose results might change at any time. (Use <literal>v</literal> also
3704 for functions with side-effects, so that calls to them cannot get
3705 optimized away.)
3706 </entry>
3707 </row>
3709 <row>
3710 <entry><structfield>pronargs</structfield></entry>
3711 <entry><type>int2</type></entry>
3712 <entry></entry>
3713 <entry>Number of input arguments</entry>
3714 </row>
3716 <row>
3717 <entry><structfield>pronargdefaults</structfield></entry>
3718 <entry><type>int2</type></entry>
3719 <entry></entry>
3720 <entry>Number of arguments that have defaults</entry>
3721 </row>
3723 <row>
3724 <entry><structfield>prorettype</structfield></entry>
3725 <entry><type>oid</type></entry>
3726 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3727 <entry>Data type of the return value</entry>
3728 </row>
3730 <row>
3731 <entry><structfield>proargtypes</structfield></entry>
3732 <entry><type>oidvector</type></entry>
3733 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3734 <entry>
3735 An array with the data types of the function arguments. This includes
3736 only input arguments (including <literal>INOUT</literal> and
3737 <literal>VARIADIC</> arguments), and thus represents
3738 the call signature of the function
3739 </entry>
3740 </row>
3742 <row>
3743 <entry><structfield>proallargtypes</structfield></entry>
3744 <entry><type>oid[]</type></entry>
3745 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3746 <entry>
3747 An array with the data types of the function arguments. This includes
3748 all arguments (including <literal>OUT</literal> and
3749 <literal>INOUT</literal> arguments); however, if all the
3750 arguments are <literal>IN</literal> arguments, this field will be null.
3751 Note that subscripting is 1-based, whereas for historical reasons
3752 <structfield>proargtypes</> is subscripted from 0
3753 </entry>
3754 </row>
3756 <row>
3757 <entry><structfield>proargmodes</structfield></entry>
3758 <entry><type>char[]</type></entry>
3759 <entry></entry>
3760 <entry>
3761 An array with the modes of the function arguments, encoded as
3762 <literal>i</literal> for <literal>IN</> arguments,
3763 <literal>o</literal> for <literal>OUT</> arguments,
3764 <literal>b</literal> for <literal>INOUT</> arguments,
3765 <literal>v</literal> for <literal>VARIADIC</> arguments,
3766 <literal>t</literal> for <literal>TABLE</> arguments.
3767 If all the arguments are <literal>IN</literal> arguments,
3768 this field will be null.
3769 Note that subscripts correspond to positions of
3770 <structfield>proallargtypes</> not <structfield>proargtypes</>
3771 </entry>
3772 </row>
3774 <row>
3775 <entry><structfield>proargnames</structfield></entry>
3776 <entry><type>text[]</type></entry>
3777 <entry></entry>
3778 <entry>
3779 An array with the names of the function arguments.
3780 Arguments without a name are set to empty strings in the array.
3781 If none of the arguments have a name, this field will be null.
3782 Note that subscripts correspond to positions of
3783 <structfield>proallargtypes</> not <structfield>proargtypes</>
3784 </entry>
3785 </row>
3787 <row>
3788 <entry><structfield>proargdefaults</structfield></entry>
3789 <entry><type>text</type></entry>
3790 <entry></entry>
3791 <entry>
3792 Expression trees (in <function>nodeToString()</function> representation)
3793 for default values. This is a list with
3794 <structfield>pronargdefaults</> elements, corresponding to the last
3795 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
3796 <replaceable>N</> <structfield>proargtypes</> positions).
3797 If none of the arguments have defaults, this field will be null
3798 </entry>
3799 </row>
3801 <row>
3802 <entry><structfield>prosrc</structfield></entry>
3803 <entry><type>text</type></entry>
3804 <entry></entry>
3805 <entry>
3806 This tells the function handler how to invoke the function. It
3807 might be the actual source code of the function for interpreted
3808 languages, a link symbol, a file name, or just about anything
3809 else, depending on the implementation language/call convention
3810 </entry>
3811 </row>
3813 <row>
3814 <entry><structfield>probin</structfield></entry>
3815 <entry><type>bytea</type></entry>
3816 <entry></entry>
3817 <entry>
3818 Additional information about how to invoke the function.
3819 Again, the interpretation is language-specific
3820 </entry>
3821 </row>
3823 <row>
3824 <entry><structfield>proconfig</structfield></entry>
3825 <entry><type>text[]</type></entry>
3826 <entry></entry>
3827 <entry>Function's local settings for run-time configuration variables</entry>
3828 </row>
3830 <row>
3831 <entry><structfield>proacl</structfield></entry>
3832 <entry><type>aclitem[]</type></entry>
3833 <entry></entry>
3834 <entry>
3835 Access privileges; see
3836 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3837 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3838 for details
3839 </entry>
3840 </row>
3841 </tbody>
3842 </tgroup>
3843 </table>
3845 <para>
3846 For compiled functions, both built-in and dynamically loaded,
3847 <structfield>prosrc</structfield> contains the function's C-language
3848 name (link symbol). For all other currently-known language types,
3849 <structfield>prosrc</structfield> contains the function's source
3850 text. <structfield>probin</structfield> is unused except for
3851 dynamically-loaded C functions, for which it gives the name of the
3852 shared library file containing the function.
3853 </para>
3855 </sect1>
3857 <sect1 id="catalog-pg-rewrite">
3858 <title><structname>pg_rewrite</structname></title>
3860 <indexterm zone="catalog-pg-rewrite">
3861 <primary>pg_rewrite</primary>
3862 </indexterm>
3864 <para>
3865 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
3866 </para>
3868 <table>
3869 <title><structname>pg_rewrite</> Columns</title>
3871 <tgroup cols="4">
3872 <thead>
3873 <row>
3874 <entry>Name</entry>
3875 <entry>Type</entry>
3876 <entry>References</entry>
3877 <entry>Description</entry>
3878 </row>
3879 </thead>
3881 <tbody>
3882 <row>
3883 <entry><structfield>rulename</structfield></entry>
3884 <entry><type>name</type></entry>
3885 <entry></entry>
3886 <entry>Rule name</entry>
3887 </row>
3889 <row>
3890 <entry><structfield>ev_class</structfield></entry>
3891 <entry><type>oid</type></entry>
3892 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3893 <entry>The table this rule is for</entry>
3894 </row>
3896 <row>
3897 <entry><structfield>ev_attr</structfield></entry>
3898 <entry><type>int2</type></entry>
3899 <entry></entry>
3900 <entry>The column this rule is for (currently, always zero to
3901 indicate the whole table)</entry>
3902 </row>
3904 <row>
3905 <entry><structfield>ev_type</structfield></entry>
3906 <entry><type>char</type></entry>
3907 <entry></entry>
3908 <entry>
3909 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
3910 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
3911 <command>DELETE</>
3912 </entry>
3913 </row>
3915 <row>
3916 <entry><structfield>ev_enabled</structfield></entry>
3917 <entry><type>char</type></entry>
3918 <entry></entry>
3919 <entry>
3920 Controls in which <xref linkend="guc-session-replication-role"> modes
3921 the rule fires.
3922 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
3923 <literal>D</> = rule is disabled,
3924 <literal>R</> = rule fires in <quote>replica</> mode,
3925 <literal>A</> = rule fires always.
3926 </entry>
3927 </row>
3929 <row>
3930 <entry><structfield>is_instead</structfield></entry>
3931 <entry><type>bool</type></entry>
3932 <entry></entry>
3933 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
3934 </row>
3936 <row>
3937 <entry><structfield>ev_qual</structfield></entry>
3938 <entry><type>text</type></entry>
3939 <entry></entry>
3940 <entry>
3941 Expression tree (in the form of a
3942 <function>nodeToString()</function> representation) for the
3943 rule's qualifying condition
3944 </entry>
3945 </row>
3947 <row>
3948 <entry><structfield>ev_action</structfield></entry>
3949 <entry><type>text</type></entry>
3950 <entry></entry>
3951 <entry>
3952 Query tree (in the form of a
3953 <function>nodeToString()</function> representation) for the
3954 rule's action
3955 </entry>
3956 </row>
3957 </tbody>
3958 </tgroup>
3959 </table>
3961 <note>
3962 <para>
3963 <literal>pg_class.relhasrules</literal>
3964 must be true if a table has any rules in this catalog.
3965 </para>
3966 </note>
3968 </sect1>
3971 <sect1 id="catalog-pg-shdepend">
3972 <title><structname>pg_shdepend</structname></title>
3974 <indexterm zone="catalog-pg-shdepend">
3975 <primary>pg_shdepend</primary>
3976 </indexterm>
3978 <para>
3979 The catalog <structname>pg_shdepend</structname> records the
3980 dependency relationships between database objects and shared objects,
3981 such as roles. This information allows
3982 <productname>PostgreSQL</productname> to ensure that those objects are
3983 unreferenced before attempting to delete them.
3984 </para>
3986 <para>
3987 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
3988 which performs a similar function for dependencies involving objects
3989 within a single database.
3990 </para>
3992 <para>
3993 Unlike most system catalogs, <structname>pg_shdepend</structname>
3994 is shared across all databases of a cluster: there is only one
3995 copy of <structname>pg_shdepend</structname> per cluster, not
3996 one per database.
3997 </para>
3999 <table>
4000 <title><structname>pg_shdepend</> Columns</title>
4002 <tgroup cols="4">
4003 <thead>
4004 <row>
4005 <entry>Name</entry>
4006 <entry>Type</entry>
4007 <entry>References</entry>
4008 <entry>Description</entry>
4009 </row>
4010 </thead>
4012 <tbody>
4013 <row>
4014 <entry><structfield>dbid</structfield></entry>
4015 <entry><type>oid</type></entry>
4016 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4017 <entry>The OID of the database the dependent object is in,
4018 or zero for a shared object</entry>
4019 </row>
4021 <row>
4022 <entry><structfield>classid</structfield></entry>
4023 <entry><type>oid</type></entry>
4024 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4025 <entry>The OID of the system catalog the dependent object is in</entry>
4026 </row>
4028 <row>
4029 <entry><structfield>objid</structfield></entry>
4030 <entry><type>oid</type></entry>
4031 <entry>any OID column</entry>
4032 <entry>The OID of the specific dependent object</entry>
4033 </row>
4035 <row>
4036 <entry><structfield>objsubid</structfield></entry>
4037 <entry><type>int4</type></entry>
4038 <entry></entry>
4039 <entry>
4040 For a table column, this is the column number (the
4041 <structfield>objid</> and <structfield>classid</> refer to the
4042 table itself). For all other object types, this column is zero
4043 </entry>
4044 </row>
4046 <row>
4047 <entry><structfield>refclassid</structfield></entry>
4048 <entry><type>oid</type></entry>
4049 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4050 <entry>The OID of the system catalog the referenced object is in
4051 (must be a shared catalog)</entry>
4052 </row>
4054 <row>
4055 <entry><structfield>refobjid</structfield></entry>
4056 <entry><type>oid</type></entry>
4057 <entry>any OID column</entry>
4058 <entry>The OID of the specific referenced object</entry>
4059 </row>
4061 <row>
4062 <entry><structfield>deptype</structfield></entry>
4063 <entry><type>char</type></entry>
4064 <entry></entry>
4065 <entry>
4066 A code defining the specific semantics of this dependency relationship; see text
4067 </entry>
4068 </row>
4070 </tbody>
4071 </tgroup>
4072 </table>
4074 <para>
4075 In all cases, a <structname>pg_shdepend</structname> entry indicates that
4076 the referenced object cannot be dropped without also dropping the dependent
4077 object. However, there are several subflavors identified by
4078 <structfield>deptype</>:
4080 <variablelist>
4081 <varlistentry>
4082 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4083 <listitem>
4084 <para>
4085 The referenced object (which must be a role) is the owner of the
4086 dependent object.
4087 </para>
4088 </listitem>
4089 </varlistentry>
4091 <varlistentry>
4092 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4093 <listitem>
4094 <para>
4095 The referenced object (which must be a role) is mentioned in the
4096 ACL (access control list, i.e., privileges list) of the
4097 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4098 not made for the owner of the object, since the owner will have
4099 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4100 </para>
4101 </listitem>
4102 </varlistentry>
4104 <varlistentry>
4105 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4106 <listitem>
4107 <para>
4108 There is no dependent object; this type of entry is a signal
4109 that the system itself depends on the referenced object, and so
4110 that object must never be deleted. Entries of this type are
4111 created only by <command>initdb</command>. The columns for the
4112 dependent object contain zeroes.
4113 </para>
4114 </listitem>
4115 </varlistentry>
4116 </variablelist>
4118 Other dependency flavors might be needed in future. Note in particular
4119 that the current definition only supports roles as referenced objects.
4120 </para>
4122 </sect1>
4124 <sect1 id="catalog-pg-shdescription">
4125 <title><structname>pg_shdescription</structname></title>
4127 <indexterm zone="catalog-pg-shdescription">
4128 <primary>pg_shdescription</primary>
4129 </indexterm>
4131 <para>
4132 The catalog <structname>pg_shdescription</structname> stores optional
4133 descriptions (comments) for shared database objects. Descriptions can be
4134 manipulated with the <xref linkend="sql-comment"
4135 endterm="sql-comment-title"> command and viewed with
4136 <application>psql</application>'s <literal>\d</literal> commands.
4137 </para>
4139 <para>
4140 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4141 which performs a similar function for descriptions involving objects
4142 within a single database.
4143 </para>
4145 <para>
4146 Unlike most system catalogs, <structname>pg_shdescription</structname>
4147 is shared across all databases of a cluster: there is only one
4148 copy of <structname>pg_shdescription</structname> per cluster, not
4149 one per database.
4150 </para>
4152 <table>
4153 <title><structname>pg_shdescription</> Columns</title>
4155 <tgroup cols="4">
4156 <thead>
4157 <row>
4158 <entry>Name</entry>
4159 <entry>Type</entry>
4160 <entry>References</entry>
4161 <entry>Description</entry>
4162 </row>
4163 </thead>
4165 <tbody>
4166 <row>
4167 <entry><structfield>objoid</structfield></entry>
4168 <entry><type>oid</type></entry>
4169 <entry>any OID column</entry>
4170 <entry>The OID of the object this description pertains to</entry>
4171 </row>
4173 <row>
4174 <entry><structfield>classoid</structfield></entry>
4175 <entry><type>oid</type></entry>
4176 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4177 <entry>The OID of the system catalog this object appears in</entry>
4178 </row>
4180 <row>
4181 <entry><structfield>description</structfield></entry>
4182 <entry><type>text</type></entry>
4183 <entry></entry>
4184 <entry>Arbitrary text that serves as the description of this object</entry>
4185 </row>
4186 </tbody>
4187 </tgroup>
4188 </table>
4190 </sect1>
4193 <sect1 id="catalog-pg-statistic">
4194 <title><structname>pg_statistic</structname></title>
4196 <indexterm zone="catalog-pg-statistic">
4197 <primary>pg_statistic</primary>
4198 </indexterm>
4200 <para>
4201 The catalog <structname>pg_statistic</structname> stores
4202 statistical data about the contents of the database. Entries are
4203 created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4204 and subsequently used by the query planner. There is one entry for
4205 each table column that has been analyzed. Note that all the
4206 statistical data is inherently approximate, even assuming that it
4207 is up-to-date.
4208 </para>
4210 <para>
4211 <structname>pg_statistic</structname> also stores statistical data about
4212 the values of index expressions. These are described as if they were
4213 actual data columns; in particular, <structfield>starelid</structfield>
4214 references the index. No entry is made for an ordinary non-expression
4215 index column, however, since it would be redundant with the entry
4216 for the underlying table column.
4217 </para>
4219 <para>
4220 Since different kinds of statistics might be appropriate for different
4221 kinds of data, <structname>pg_statistic</structname> is designed not
4222 to assume very much about what sort of statistics it stores. Only
4223 extremely general statistics (such as nullness) are given dedicated
4224 columns in <structname>pg_statistic</structname>. Everything else
4225 is stored in <quote>slots</quote>, which are groups of associated columns
4226 whose content is identified by a code number in one of the slot's columns.
4227 For more information see
4228 <filename>src/include/catalog/pg_statistic.h</filename>.
4229 </para>
4231 <para>
4232 <structname>pg_statistic</structname> should not be readable by the
4233 public, since even statistical information about a table's contents
4234 might be considered sensitive. (Example: minimum and maximum values
4235 of a salary column might be quite interesting.)
4236 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4237 is a publicly readable view on
4238 <structname>pg_statistic</structname> that only exposes information
4239 about those tables that are readable by the current user.
4240 </para>
4242 <table>
4243 <title><structname>pg_statistic</> Columns</title>
4245 <tgroup cols="4">
4246 <thead>
4247 <row>
4248 <entry>Name</entry>
4249 <entry>Type</entry>
4250 <entry>References</entry>
4251 <entry>Description</entry>
4252 </row>
4253 </thead>
4255 <tbody>
4256 <row>
4257 <entry><structfield>starelid</structfield></entry>
4258 <entry><type>oid</type></entry>
4259 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4260 <entry>The table or index that the described column belongs to</entry>
4261 </row>
4263 <row>
4264 <entry><structfield>staattnum</structfield></entry>
4265 <entry><type>int2</type></entry>
4266 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4267 <entry>The number of the described column</entry>
4268 </row>
4270 <row>
4271 <entry><structfield>stanullfrac</structfield></entry>
4272 <entry><type>float4</type></entry>
4273 <entry></entry>
4274 <entry>The fraction of the column's entries that are null</entry>
4275 </row>
4277 <row>
4278 <entry><structfield>stawidth</structfield></entry>
4279 <entry><type>int4</type></entry>
4280 <entry></entry>
4281 <entry>The average stored width, in bytes, of nonnull entries</entry>
4282 </row>
4284 <row>
4285 <entry><structfield>stadistinct</structfield></entry>
4286 <entry><type>float4</type></entry>
4287 <entry></entry>
4288 <entry>The number of distinct nonnull data values in the column.
4289 A value greater than zero is the actual number of distinct values.
4290 A value less than zero is the negative of a fraction of the number
4291 of rows in the table (for example, a column in which values appear about
4292 twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4293 A zero value means the number of distinct values is unknown
4294 </entry>
4295 </row>
4297 <row>
4298 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4299 <entry><type>int2</type></entry>
4300 <entry></entry>
4301 <entry>
4302 A code number indicating the kind of statistics stored in the
4303 <replaceable>N</>th <quote>slot</quote> of the
4304 <structname>pg_statistic</structname> row
4305 </entry>
4306 </row>
4308 <row>
4309 <entry><structfield>staop<replaceable>N</></structfield></entry>
4310 <entry><type>oid</type></entry>
4311 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4312 <entry>
4313 An operator used to derive the statistics stored in the
4314 <replaceable>N</>th <quote>slot</quote>. For example, a
4315 histogram slot would show the <literal>&lt;</literal> operator
4316 that defines the sort order of the data
4317 </entry>
4318 </row>
4320 <row>
4321 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4322 <entry><type>float4[]</type></entry>
4323 <entry></entry>
4324 <entry>
4325 Numerical statistics of the appropriate kind for the
4326 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4327 kind does not involve numerical values
4328 </entry>
4329 </row>
4331 <row>
4332 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4333 <entry><type>anyarray</type></entry>
4334 <entry></entry>
4335 <entry>
4336 Column data values of the appropriate kind for the
4337 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4338 kind does not store any data values. Each array's element
4339 values are actually of the specific column's data type, so there
4340 is no way to define these columns' type more specifically than
4341 <type>anyarray</>
4342 </entry>
4343 </row>
4344 </tbody>
4345 </tgroup>
4346 </table>
4348 </sect1>
4351 <sect1 id="catalog-pg-tablespace">
4352 <title><structname>pg_tablespace</structname></title>
4354 <indexterm zone="catalog-pg-tablespace">
4355 <primary>pg_tablespace</primary>
4356 </indexterm>
4358 <para>
4359 The catalog <structname>pg_tablespace</structname> stores information
4360 about the available tablespaces. Tables can be placed in particular
4361 tablespaces to aid administration of disk layout.
4362 </para>
4364 <para>
4365 Unlike most system catalogs, <structname>pg_tablespace</structname>
4366 is shared across all databases of a cluster: there is only one
4367 copy of <structname>pg_tablespace</structname> per cluster, not
4368 one per database.
4369 </para>
4371 <table>
4372 <title><structname>pg_tablespace</> Columns</title>
4374 <tgroup cols="4">
4375 <thead>
4376 <row>
4377 <entry>Name</entry>
4378 <entry>Type</entry>
4379 <entry>References</entry>
4380 <entry>Description</entry>
4381 </row>
4382 </thead>
4384 <tbody>
4385 <row>
4386 <entry><structfield>spcname</structfield></entry>
4387 <entry><type>name</type></entry>
4388 <entry></entry>
4389 <entry>Tablespace name</entry>
4390 </row>
4392 <row>
4393 <entry><structfield>spcowner</structfield></entry>
4394 <entry><type>oid</type></entry>
4395 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4396 <entry>Owner of the tablespace, usually the user who created it</entry>
4397 </row>
4399 <row>
4400 <entry><structfield>spclocation</structfield></entry>
4401 <entry><type>text</type></entry>
4402 <entry></entry>
4403 <entry>Location (directory path) of the tablespace</entry>
4404 </row>
4406 <row>
4407 <entry><structfield>spcacl</structfield></entry>
4408 <entry><type>aclitem[]</type></entry>
4409 <entry></entry>
4410 <entry>
4411 Access privileges; see
4412 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4413 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4414 for details
4415 </entry>
4416 </row>
4417 </tbody>
4418 </tgroup>
4419 </table>
4420 </sect1>
4423 <sect1 id="catalog-pg-trigger">
4424 <title><structname>pg_trigger</structname></title>
4426 <indexterm zone="catalog-pg-trigger">
4427 <primary>pg_trigger</primary>
4428 </indexterm>
4430 <para>
4431 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4432 See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4433 for more information.
4434 </para>
4436 <table>
4437 <title><structname>pg_trigger</> Columns</title>
4439 <tgroup cols="4">
4440 <thead>
4441 <row>
4442 <entry>Name</entry>
4443 <entry>Type</entry>
4444 <entry>References</entry>
4445 <entry>Description</entry>
4446 </row>
4447 </thead>
4449 <tbody>
4450 <row>
4451 <entry><structfield>tgrelid</structfield></entry>
4452 <entry><type>oid</type></entry>
4453 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4454 <entry>The table this trigger is on</entry>
4455 </row>
4457 <row>
4458 <entry><structfield>tgname</structfield></entry>
4459 <entry><type>name</type></entry>
4460 <entry></entry>
4461 <entry>Trigger name (must be unique among triggers of same table)</entry>
4462 </row>
4464 <row>
4465 <entry><structfield>tgfoid</structfield></entry>
4466 <entry><type>oid</type></entry>
4467 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4468 <entry>The function to be called</entry>
4469 </row>
4471 <row>
4472 <entry><structfield>tgtype</structfield></entry>
4473 <entry><type>int2</type></entry>
4474 <entry></entry>
4475 <entry>Bit mask identifying trigger conditions</entry>
4476 </row>
4478 <row>
4479 <entry><structfield>tgenabled</structfield></entry>
4480 <entry><type>char</type></entry>
4481 <entry></entry>
4482 <entry>
4483 Controls in which <xref linkend="guc-session-replication-role"> modes
4484 the trigger fires.
4485 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4486 <literal>D</> = trigger is disabled,
4487 <literal>R</> = trigger fires in <quote>replica</> mode,
4488 <literal>A</> = trigger fires always.
4489 </entry>
4490 </row>
4492 <row>
4493 <entry><structfield>tgisconstraint</structfield></entry>
4494 <entry><type>bool</type></entry>
4495 <entry></entry>
4496 <entry>True if trigger is a <quote>constraint trigger</></entry>
4497 </row>
4499 <row>
4500 <entry><structfield>tgconstrname</structfield></entry>
4501 <entry><type>name</type></entry>
4502 <entry></entry>
4503 <entry>Constraint name, if a constraint trigger</entry>
4504 </row>
4506 <row>
4507 <entry><structfield>tgconstrrelid</structfield></entry>
4508 <entry><type>oid</type></entry>
4509 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4510 <entry>The table referenced by a referential integrity constraint</entry>
4511 </row>
4513 <row>
4514 <entry><structfield>tgconstraint</structfield></entry>
4515 <entry><type>oid</type></entry>
4516 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4517 <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4518 </row>
4520 <row>
4521 <entry><structfield>tgdeferrable</structfield></entry>
4522 <entry><type>bool</type></entry>
4523 <entry></entry>
4524 <entry>True if constraint trigger is deferrable</entry>
4525 </row>
4527 <row>
4528 <entry><structfield>tginitdeferred</structfield></entry>
4529 <entry><type>bool</type></entry>
4530 <entry></entry>
4531 <entry>True if constraint trigger is initially deferred</entry>
4532 </row>
4534 <row>
4535 <entry><structfield>tgnargs</structfield></entry>
4536 <entry><type>int2</type></entry>
4537 <entry></entry>
4538 <entry>Number of argument strings passed to trigger function</entry>
4539 </row>
4541 <row>
4542 <entry><structfield>tgattr</structfield></entry>
4543 <entry><type>int2vector</type></entry>
4544 <entry></entry>
4545 <entry>Currently unused</entry>
4546 </row>
4548 <row>
4549 <entry><structfield>tgargs</structfield></entry>
4550 <entry><type>bytea</type></entry>
4551 <entry></entry>
4552 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4553 </row>
4554 </tbody>
4555 </tgroup>
4556 </table>
4558 <note>
4559 <para>
4560 When <structfield>tgconstraint</> is nonzero,
4561 <structfield>tgisconstraint</> must be true, and
4562 <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4563 <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4564 with the referenced <structname>pg_constraint</> entry. The reason we
4565 keep these fields is that we support <quote>stand-alone</> constraint
4566 triggers with no corresponding <structname>pg_constraint</> entry.
4567 </para>
4568 </note>
4570 <note>
4571 <para>
4572 <literal>pg_class.relhastriggers</literal>
4573 must be true if a table has any triggers in this catalog.
4574 </para>
4575 </note>
4577 </sect1>
4580 <sect1 id="catalog-pg-ts-config">
4581 <title><structname>pg_ts_config</structname></title>
4583 <indexterm zone="catalog-pg-ts-config">
4584 <primary>pg_ts_config</primary>
4585 </indexterm>
4587 <para>
4588 The <structname>pg_ts_config</structname> catalog contains entries
4589 representing text search configurations. A configuration specifies
4590 a particular text search parser and a list of dictionaries to use
4591 for each of the parser's output token types. The parser is shown
4592 in the <structname>pg_ts_config</structname> entry, but the
4593 token-to-dictionary mapping is defined by subsidiary entries in <link
4594 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4595 </para>
4597 <para>
4598 <productname>PostgreSQL</productname>'s text search features are
4599 described at length in <xref linkend="textsearch">.
4600 </para>
4602 <table>
4603 <title><structname>pg_ts_config</> Columns</title>
4605 <tgroup cols="4">
4606 <thead>
4607 <row>
4608 <entry>Name</entry>
4609 <entry>Type</entry>
4610 <entry>References</entry>
4611 <entry>Description</entry>
4612 </row>
4613 </thead>
4615 <tbody>
4616 <row>
4617 <entry><structfield>cfgname</structfield></entry>
4618 <entry><type>name</type></entry>
4619 <entry></entry>
4620 <entry>Text search configuration name</entry>
4621 </row>
4623 <row>
4624 <entry><structfield>cfgnamespace</structfield></entry>
4625 <entry><type>oid</type></entry>
4626 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4627 <entry>
4628 The OID of the namespace that contains this configuration
4629 </entry>
4630 </row>
4632 <row>
4633 <entry><structfield>cfgowner</structfield></entry>
4634 <entry><type>oid</type></entry>
4635 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4636 <entry>Owner of the configuration</entry>
4637 </row>
4639 <row>
4640 <entry><structfield>cfgparser</structfield></entry>
4641 <entry><type>oid</type></entry>
4642 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4643 <entry>The OID of the text search parser for this configuration</entry>
4644 </row>
4645 </tbody>
4646 </tgroup>
4647 </table>
4648 </sect1>
4651 <sect1 id="catalog-pg-ts-config-map">
4652 <title><structname>pg_ts_config_map</structname></title>
4654 <indexterm zone="catalog-pg-ts-config-map">
4655 <primary>pg_ts_config_map</primary>
4656 </indexterm>
4658 <para>
4659 The <structname>pg_ts_config_map</structname> catalog contains entries
4660 showing which text search dictionaries should be consulted, and in
4661 what order, for each output token type of each text search configuration's
4662 parser.
4663 </para>
4665 <para>
4666 <productname>PostgreSQL</productname>'s text search features are
4667 described at length in <xref linkend="textsearch">.
4668 </para>
4670 <table>
4671 <title><structname>pg_ts_config_map</> Columns</title>
4673 <tgroup cols="4">
4674 <thead>
4675 <row>
4676 <entry>Name</entry>
4677 <entry>Type</entry>
4678 <entry>References</entry>
4679 <entry>Description</entry>
4680 </row>
4681 </thead>
4683 <tbody>
4684 <row>
4685 <entry><structfield>mapcfg</structfield></entry>
4686 <entry><type>oid</type></entry>
4687 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4688 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4689 </row>
4691 <row>
4692 <entry><structfield>maptokentype</structfield></entry>
4693 <entry><type>integer</type></entry>
4694 <entry></entry>
4695 <entry>A token type emitted by the configuration's parser</entry>
4696 </row>
4698 <row>
4699 <entry><structfield>mapseqno</structfield></entry>
4700 <entry><type>integer</type></entry>
4701 <entry></entry>
4702 <entry>Order in which to consult this entry (lower
4703 <structfield>mapseqno</>s first)</entry>
4704 </row>
4706 <row>
4707 <entry><structfield>mapdict</structfield></entry>
4708 <entry><type>oid</type></entry>
4709 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4710 <entry>The OID of the text search dictionary to consult</entry>
4711 </row>
4712 </tbody>
4713 </tgroup>
4714 </table>
4715 </sect1>
4718 <sect1 id="catalog-pg-ts-dict">
4719 <title><structname>pg_ts_dict</structname></title>
4721 <indexterm zone="catalog-pg-ts-dict">
4722 <primary>pg_ts_dict</primary>
4723 </indexterm>
4725 <para>
4726 The <structname>pg_ts_dict</structname> catalog contains entries
4727 defining text search dictionaries. A dictionary depends on a text
4728 search template, which specifies all the implementation functions
4729 needed; the dictionary itself provides values for the user-settable
4730 parameters supported by the template. This division of labor allows
4731 dictionaries to be created by unprivileged users. The parameters
4732 are specified by a text string <structfield>dictinitoption</>,
4733 whose format and meaning vary depending on the template.
4734 </para>
4736 <para>
4737 <productname>PostgreSQL</productname>'s text search features are
4738 described at length in <xref linkend="textsearch">.
4739 </para>
4741 <table>
4742 <title><structname>pg_ts_dict</> Columns</title>
4744 <tgroup cols="4">
4745 <thead>
4746 <row>
4747 <entry>Name</entry>
4748 <entry>Type</entry>
4749 <entry>References</entry>
4750 <entry>Description</entry>
4751 </row>
4752 </thead>
4754 <tbody>
4755 <row>
4756 <entry><structfield>dictname</structfield></entry>
4757 <entry><type>name</type></entry>
4758 <entry></entry>
4759 <entry>Text search dictionary name</entry>
4760 </row>
4762 <row>
4763 <entry><structfield>dictnamespace</structfield></entry>
4764 <entry><type>oid</type></entry>
4765 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4766 <entry>
4767 The OID of the namespace that contains this dictionary
4768 </entry>
4769 </row>
4771 <row>
4772 <entry><structfield>dictowner</structfield></entry>
4773 <entry><type>oid</type></entry>
4774 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4775 <entry>Owner of the dictionary</entry>
4776 </row>
4778 <row>
4779 <entry><structfield>dicttemplate</structfield></entry>
4780 <entry><type>oid</type></entry>
4781 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4782 <entry>The OID of the text search template for this dictionary</entry>
4783 </row>
4785 <row>
4786 <entry><structfield>dictinitoption</structfield></entry>
4787 <entry><type>text</type></entry>
4788 <entry></entry>
4789 <entry>Initialization option string for the template</entry>
4790 </row>
4791 </tbody>
4792 </tgroup>
4793 </table>
4794 </sect1>
4797 <sect1 id="catalog-pg-ts-parser">
4798 <title><structname>pg_ts_parser</structname></title>
4800 <indexterm zone="catalog-pg-ts-parser">
4801 <primary>pg_ts_parser</primary>
4802 </indexterm>
4804 <para>
4805 The <structname>pg_ts_parser</structname> catalog contains entries
4806 defining text search parsers. A parser is responsible for splitting
4807 input text into lexemes and assigning a token type to each lexeme.
4808 Since a parser must be implemented by C-language-level functions,
4809 creation of new parsers is restricted to database superusers.
4810 </para>
4812 <para>
4813 <productname>PostgreSQL</productname>'s text search features are
4814 described at length in <xref linkend="textsearch">.
4815 </para>
4817 <table>
4818 <title><structname>pg_ts_parser</> Columns</title>
4820 <tgroup cols="4">
4821 <thead>
4822 <row>
4823 <entry>Name</entry>
4824 <entry>Type</entry>
4825 <entry>References</entry>
4826 <entry>Description</entry>
4827 </row>
4828 </thead>
4830 <tbody>
4831 <row>
4832 <entry><structfield>prsname</structfield></entry>
4833 <entry><type>name</type></entry>
4834 <entry></entry>
4835 <entry>Text search parser name</entry>
4836 </row>
4838 <row>
4839 <entry><structfield>prsnamespace</structfield></entry>
4840 <entry><type>oid</type></entry>
4841 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4842 <entry>
4843 The OID of the namespace that contains this parser
4844 </entry>
4845 </row>
4847 <row>
4848 <entry><structfield>prsstart</structfield></entry>
4849 <entry><type>regproc</type></entry>
4850 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4851 <entry>OID of the parser's startup function</entry>
4852 </row>
4854 <row>
4855 <entry><structfield>prstoken</structfield></entry>
4856 <entry><type>regproc</type></entry>
4857 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4858 <entry>OID of the parser's next-token function</entry>
4859 </row>
4861 <row>
4862 <entry><structfield>prsend</structfield></entry>
4863 <entry><type>regproc</type></entry>
4864 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4865 <entry>OID of the parser's shutdown function</entry>
4866 </row>
4868 <row>
4869 <entry><structfield>prsheadline</structfield></entry>
4870 <entry><type>regproc</type></entry>
4871 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4872 <entry>OID of the parser's headline function</entry>
4873 </row>
4875 <row>
4876 <entry><structfield>prslextype</structfield></entry>
4877 <entry><type>regproc</type></entry>
4878 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4879 <entry>OID of the parser's lextype function</entry>
4880 </row>
4881 </tbody>
4882 </tgroup>
4883 </table>
4884 </sect1>
4887 <sect1 id="catalog-pg-ts-template">
4888 <title><structname>pg_ts_template</structname></title>
4890 <indexterm zone="catalog-pg-ts-template">
4891 <primary>pg_ts_template</primary>
4892 </indexterm>
4894 <para>
4895 The <structname>pg_ts_template</structname> catalog contains entries
4896 defining text search templates. A template is the implementation
4897 skeleton for a class of text search dictionaries.
4898 Since a template must be implemented by C-language-level functions,
4899 creation of new templates is restricted to database superusers.
4900 </para>
4902 <para>
4903 <productname>PostgreSQL</productname>'s text search features are
4904 described at length in <xref linkend="textsearch">.
4905 </para>
4907 <table>
4908 <title><structname>pg_ts_template</> Columns</title>
4910 <tgroup cols="4">
4911 <thead>
4912 <row>
4913 <entry>Name</entry>
4914 <entry>Type</entry>
4915 <entry>References</entry>
4916 <entry>Description</entry>
4917 </row>
4918 </thead>
4920 <tbody>
4921 <row>
4922 <entry><structfield>tmplname</structfield></entry>
4923 <entry><type>name</type></entry>
4924 <entry></entry>
4925 <entry>Text search template name</entry>
4926 </row>
4928 <row>
4929 <entry><structfield>tmplnamespace</structfield></entry>
4930 <entry><type>oid</type></entry>
4931 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4932 <entry>
4933 The OID of the namespace that contains this template
4934 </entry>
4935 </row>
4937 <row>
4938 <entry><structfield>tmplinit</structfield></entry>
4939 <entry><type>regproc</type></entry>
4940 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4941 <entry>OID of the template's initialization function</entry>
4942 </row>
4944 <row>
4945 <entry><structfield>tmpllexize</structfield></entry>
4946 <entry><type>regproc</type></entry>
4947 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4948 <entry>OID of the template's lexize function</entry>
4949 </row>
4950 </tbody>
4951 </tgroup>
4952 </table>
4953 </sect1>
4956 <sect1 id="catalog-pg-type">
4957 <title><structname>pg_type</structname></title>
4959 <indexterm zone="catalog-pg-type">
4960 <primary>pg_type</primary>
4961 </indexterm>
4963 <para>
4964 The catalog <structname>pg_type</structname> stores information about data
4965 types. Base types and enum types (scalar types) are created with
4966 <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
4967 domains with
4968 <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
4969 A composite type is automatically created for each table in the database, to
4970 represent the row structure of the table. It is also possible to create
4971 composite types with <command>CREATE TYPE AS</command>.
4972 </para>
4974 <table>
4975 <title><structname>pg_type</> Columns</title>
4977 <tgroup cols="4">
4978 <thead>
4979 <row>
4980 <entry>Name</entry>
4981 <entry>Type</entry>
4982 <entry>References</entry>
4983 <entry>Description</entry>
4984 </row>
4985 </thead>
4987 <tbody>
4988 <row>
4989 <entry><structfield>typname</structfield></entry>
4990 <entry><type>name</type></entry>
4991 <entry></entry>
4992 <entry>Data type name</entry>
4993 </row>
4995 <row>
4996 <entry><structfield>typnamespace</structfield></entry>
4997 <entry><type>oid</type></entry>
4998 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4999 <entry>
5000 The OID of the namespace that contains this type
5001 </entry>
5002 </row>
5004 <row>
5005 <entry><structfield>typowner</structfield></entry>
5006 <entry><type>oid</type></entry>
5007 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5008 <entry>Owner of the type</entry>
5009 </row>
5011 <row>
5012 <entry><structfield>typlen</structfield></entry>
5013 <entry><type>int2</type></entry>
5014 <entry></entry>
5015 <entry>
5016 For a fixed-size type, <structfield>typlen</structfield> is the number
5017 of bytes in the internal representation of the type. But for a
5018 variable-length type, <structfield>typlen</structfield> is negative.
5019 -1 indicates a <quote>varlena</> type (one that has a length word),
5020 -2 indicates a null-terminated C string.
5021 </entry>
5022 </row>
5024 <row>
5025 <entry><structfield>typbyval</structfield></entry>
5026 <entry><type>bool</type></entry>
5027 <entry></entry>
5028 <entry>
5029 <structfield>typbyval</structfield> determines whether internal
5030 routines pass a value of this type by value or by reference.
5031 <structfield>typbyval</structfield> had better be false if
5032 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
5033 where Datum is 8 bytes).
5034 Variable-length types are always passed by reference. Note that
5035 <structfield>typbyval</structfield> can be false even if the
5036 length would allow pass-by-value
5037 </entry>
5038 </row>
5040 <row>
5041 <entry><structfield>typtype</structfield></entry>
5042 <entry><type>char</type></entry>
5043 <entry></entry>
5044 <entry>
5045 <structfield>typtype</structfield> is
5046 <literal>b</literal> for a base type,
5047 <literal>c</literal> for a composite type (e.g., a table's row type),
5048 <literal>d</literal> for a domain,
5049 <literal>e</literal> for an enum type,
5050 or <literal>p</literal> for a pseudo-type.
5051 See also <structfield>typrelid</structfield> and
5052 <structfield>typbasetype</structfield>
5053 </entry>
5054 </row>
5056 <row>
5057 <entry><structfield>typcategory</structfield></entry>
5058 <entry><type>char</type></entry>
5059 <entry></entry>
5060 <entry>
5061 <structfield>typcategory</structfield> is an arbitrary classification
5062 of data types that is used by the parser to determine which implicit
5063 casts should be <quote>preferred</>.
5064 See <xref linkend="catalog-typcategory-table">
5065 </entry>
5066 </row>
5068 <row>
5069 <entry><structfield>typispreferred</structfield></entry>
5070 <entry><type>bool</type></entry>
5071 <entry></entry>
5072 <entry>
5073 True if the type is a preferred cast target within its
5074 <structfield>typcategory</structfield>
5075 </entry>
5076 </row>
5078 <row>
5079 <entry><structfield>typisdefined</structfield></entry>
5080 <entry><type>bool</type></entry>
5081 <entry></entry>
5082 <entry>
5083 True if the type is defined, false if this is a placeholder
5084 entry for a not-yet-defined type. When
5085 <structfield>typisdefined</structfield> is false, nothing
5086 except the type name, namespace, and OID can be relied on
5087 </entry>
5088 </row>
5090 <row>
5091 <entry><structfield>typdelim</structfield></entry>
5092 <entry><type>char</type></entry>
5093 <entry></entry>
5094 <entry>
5095 Character that separates two values of this type when parsing
5096 array input. Note that the delimiter is associated with the array
5097 element data type, not the array data type
5098 </entry>
5099 </row>
5101 <row>
5102 <entry><structfield>typrelid</structfield></entry>
5103 <entry><type>oid</type></entry>
5104 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5105 <entry>
5106 If this is a composite type (see
5107 <structfield>typtype</structfield>), then this column points to
5108 the <structname>pg_class</structname> entry that defines the
5109 corresponding table. (For a free-standing composite type, the
5110 <structname>pg_class</structname> entry doesn't really represent
5111 a table, but it is needed anyway for the type's
5112 <structname>pg_attribute</structname> entries to link to.)
5113 Zero for non-composite types
5114 </entry>
5115 </row>
5117 <row>
5118 <entry><structfield>typelem</structfield></entry>
5119 <entry><type>oid</type></entry>
5120 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5121 <entry>
5122 If <structfield>typelem</structfield> is not 0 then it
5123 identifies another row in <structname>pg_type</structname>.
5124 The current type can then be subscripted like an array yielding
5125 values of type <structfield>typelem</structfield>. A
5126 <quote>true</quote> array type is variable length
5127 (<structfield>typlen</structfield> = -1),
5128 but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
5129 also have nonzero <structfield>typelem</structfield>, for example
5130 <type>name</type> and <type>point</type>.
5131 If a fixed-length type has a <structfield>typelem</structfield> then
5132 its internal representation must be some number of values of the
5133 <structfield>typelem</structfield> data type with no other data.
5134 Variable-length array types have a header defined by the array
5135 subroutines
5136 </entry>
5137 </row>
5139 <row>
5140 <entry><structfield>typarray</structfield></entry>
5141 <entry><type>oid</type></entry>
5142 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5143 <entry>
5144 If <structfield>typarray</structfield> is not 0 then it
5145 identifies another row in <structname>pg_type</structname>, which
5146 is the <quote>true</quote> array type having this type as element
5147 </entry>
5148 </row>
5150 <row>
5151 <entry><structfield>typinput</structfield></entry>
5152 <entry><type>regproc</type></entry>
5153 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5154 <entry>Input conversion function (text format)</entry>
5155 </row>
5157 <row>
5158 <entry><structfield>typoutput</structfield></entry>
5159 <entry><type>regproc</type></entry>
5160 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5161 <entry>Output conversion function (text format)</entry>
5162 </row>
5164 <row>
5165 <entry><structfield>typreceive</structfield></entry>
5166 <entry><type>regproc</type></entry>
5167 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5168 <entry>Input conversion function (binary format), or 0 if none</entry>
5169 </row>
5171 <row>
5172 <entry><structfield>typsend</structfield></entry>
5173 <entry><type>regproc</type></entry>
5174 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5175 <entry>Output conversion function (binary format), or 0 if none</entry>
5176 </row>
5178 <row>
5179 <entry><structfield>typmodin</structfield></entry>
5180 <entry><type>regproc</type></entry>
5181 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5182 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5183 </row>
5185 <row>
5186 <entry><structfield>typmodout</structfield></entry>
5187 <entry><type>regproc</type></entry>
5188 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5189 <entry>Type modifier output function, or 0 to use the standard format</entry>
5190 </row>
5192 <row>
5193 <entry><structfield>typanalyze</structfield></entry>
5194 <entry><type>regproc</type></entry>
5195 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5196 <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5197 </row>
5199 <row>
5200 <entry><structfield>typalign</structfield></entry>
5201 <entry><type>char</type></entry>
5202 <entry></entry>
5203 <entry><para>
5205 <structfield>typalign</structfield> is the alignment required
5206 when storing a value of this type. It applies to storage on
5207 disk as well as most representations of the value inside
5208 <productname>PostgreSQL</>.
5209 When multiple values are stored consecutively, such
5210 as in the representation of a complete row on disk, padding is
5211 inserted before a datum of this type so that it begins on the
5212 specified boundary. The alignment reference is the beginning
5213 of the first datum in the sequence.
5214 </para><para>
5215 Possible values are:
5216 <itemizedlist>
5217 <listitem>
5218 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5219 </listitem>
5220 <listitem>
5221 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5222 </listitem>
5223 <listitem>
5224 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5225 </listitem>
5226 <listitem>
5227 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5228 </listitem>
5229 </itemizedlist>
5230 </para><note>
5231 <para>
5232 For types used in system tables, it is critical that the size
5233 and alignment defined in <structname>pg_type</structname>
5234 agree with the way that the compiler will lay out the column in
5235 a structure representing a table row.
5236 </para>
5237 </note></entry>
5238 </row>
5240 <row>
5241 <entry><structfield>typstorage</structfield></entry>
5242 <entry><type>char</type></entry>
5243 <entry></entry>
5244 <entry><para>
5245 <structfield>typstorage</structfield> tells for varlena
5246 types (those with <structfield>typlen</structfield> = -1) if
5247 the type is prepared for toasting and what the default strategy
5248 for attributes of this type should be.
5249 Possible values are
5250 <itemizedlist>
5251 <listitem>
5252 <para><literal>p</>: Value must always be stored plain.</para>
5253 </listitem>
5254 <listitem>
5255 <para>
5256 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5257 relation (if relation has one, see
5258 <literal>pg_class.reltoastrelid</literal>).
5259 </para>
5260 </listitem>
5261 <listitem>
5262 <para><literal>m</>: Value can be stored compressed inline.</para>
5263 </listitem>
5264 <listitem>
5265 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5266 </listitem>
5267 </itemizedlist>
5268 Note that <literal>m</> columns can also be moved out to secondary
5269 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5270 moved first).
5271 </para></entry>
5272 </row>
5274 <row>
5275 <entry><structfield>typnotnull</structfield></entry>
5276 <entry><type>bool</type></entry>
5277 <entry></entry>
5278 <entry><para>
5279 <structfield>typnotnull</structfield> represents a not-null
5280 constraint on a type. Used for domains only
5281 </para></entry>
5282 </row>
5284 <row>
5285 <entry><structfield>typbasetype</structfield></entry>
5286 <entry><type>oid</type></entry>
5287 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5288 <entry><para>
5289 If this is a domain (see <structfield>typtype</structfield>), then
5290 <structfield>typbasetype</structfield> identifies the type that this
5291 one is based on. Zero if this type is not a domain
5292 </para></entry>
5293 </row>
5295 <row>
5296 <entry><structfield>typtypmod</structfield></entry>
5297 <entry><type>int4</type></entry>
5298 <entry></entry>
5299 <entry><para>
5300 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5301 to be applied to their base type (-1 if base type does not use a
5302 <literal>typmod</>). -1 if this type is not a domain
5303 </para></entry>
5304 </row>
5306 <row>
5307 <entry><structfield>typndims</structfield></entry>
5308 <entry><type>int4</type></entry>
5309 <entry></entry>
5310 <entry><para>
5311 <structfield>typndims</structfield> is the number of array dimensions
5312 for a domain that is an array (that is, <structfield>typbasetype</> is
5313 an array type; the domain's <structfield>typelem</> will match the base
5314 type's <structfield>typelem</structfield>).
5315 Zero for types other than domains over array types
5316 </para></entry>
5317 </row>
5319 <row>
5320 <entry><structfield>typdefaultbin</structfield></entry>
5321 <entry><type>text</type></entry>
5322 <entry></entry>
5323 <entry><para>
5324 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5325 representation of a default expression for the type. This is
5326 only used for domains
5327 </para></entry>
5328 </row>
5330 <row>
5331 <entry><structfield>typdefault</structfield></entry>
5332 <entry><type>text</type></entry>
5333 <entry></entry>
5334 <entry><para>
5335 <structfield>typdefault</> is null if the type has no associated
5336 default value. If <structfield>typdefaultbin</> is not null,
5337 <structfield>typdefault</> must contain a human-readable version of the
5338 default expression represented by <structfield>typdefaultbin</>. If
5339 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5340 not, then <structfield>typdefault</> is the external representation of
5341 the type's default value, which might be fed to the type's input
5342 converter to produce a constant
5343 </para></entry>
5344 </row>
5345 </tbody>
5346 </tgroup>
5347 </table>
5349 <para>
5350 <xref linkend="catalog-typcategory-table"> lists the system-defined values
5351 of <structfield>typcategory</>. Any future additions to this list will
5352 also be upper-case ASCII letters. All other ASCII characters are reserved
5353 for user-defined categories.
5354 </para>
5356 <table id="catalog-typcategory-table">
5357 <title><structfield>typcategory</> Codes</title>
5359 <tgroup cols="2">
5360 <thead>
5361 <row>
5362 <entry>Code</entry>
5363 <entry>Category</entry>
5364 </row>
5365 </thead>
5367 <tbody>
5368 <row>
5369 <entry><literal>A</literal></entry>
5370 <entry>Array types</entry>
5371 </row>
5372 <row>
5373 <entry><literal>B</literal></entry>
5374 <entry>Boolean types</entry>
5375 </row>
5376 <row>
5377 <entry><literal>C</literal></entry>
5378 <entry>Composite types</entry>
5379 </row>
5380 <row>
5381 <entry><literal>D</literal></entry>
5382 <entry>Date/time types</entry>
5383 </row>
5384 <row>
5385 <entry><literal>E</literal></entry>
5386 <entry>Enum types</entry>
5387 </row>
5388 <row>
5389 <entry><literal>G</literal></entry>
5390 <entry>Geometric types</entry>
5391 </row>
5392 <row>
5393 <entry><literal>I</literal></entry>
5394 <entry>Network address types</entry>
5395 </row>
5396 <row>
5397 <entry><literal>N</literal></entry>
5398 <entry>Numeric types</entry>
5399 </row>
5400 <row>
5401 <entry><literal>P</literal></entry>
5402 <entry>Pseudo-types</entry>
5403 </row>
5404 <row>
5405 <entry><literal>S</literal></entry>
5406 <entry>String types</entry>
5407 </row>
5408 <row>
5409 <entry><literal>T</literal></entry>
5410 <entry>Timespan types</entry>
5411 </row>
5412 <row>
5413 <entry><literal>U</literal></entry>
5414 <entry>User-defined types</entry>
5415 </row>
5416 <row>
5417 <entry><literal>V</literal></entry>
5418 <entry>Bit-string types</entry>
5419 </row>
5420 <row>
5421 <entry><literal>X</literal></entry>
5422 <entry><type>unknown</> type</entry>
5423 </row>
5424 </tbody>
5425 </tgroup>
5426 </table>
5428 </sect1>
5431 <sect1 id="catalog-pg-user-mapping">
5432 <title><structname>pg_user_mapping</structname></title>
5434 <indexterm zone="catalog-pg-user-mapping">
5435 <primary>pg_user_mapping</primary>
5436 </indexterm>
5438 <para>
5439 The catalog <structname>pg_user_mapping</structname> stores
5440 the mappings from local user to remote. Access to this catalog is
5441 restricted from normal users, use the view
5442 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
5443 instead.
5444 </para>
5446 <table>
5447 <title><structname>pg_user_mapping</> Columns</title>
5449 <tgroup cols="4">
5450 <thead>
5451 <row>
5452 <entry>Name</entry>
5453 <entry>Type</entry>
5454 <entry>References</entry>
5455 <entry>Description</entry>
5456 </row>
5457 </thead>
5459 <tbody>
5460 <row>
5461 <entry><structfield>umuser</structfield></entry>
5462 <entry><type>oid</type></entry>
5463 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5464 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
5465 </row>
5467 <row>
5468 <entry><structfield>umserver</structfield></entry>
5469 <entry><type>oid</type></entry>
5470 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
5471 <entry>
5472 The OID of the foreign server that contains this mapping
5473 </entry>
5474 </row>
5476 <row>
5477 <entry><structfield>umoptions</structfield></entry>
5478 <entry><type>text[]</type></entry>
5479 <entry></entry>
5480 <entry>
5481 User mapping specific options, as <quote>keyword=value</> strings.
5482 </entry>
5483 </row>
5484 </tbody>
5485 </tgroup>
5486 </table>
5487 </sect1>
5490 <sect1 id="views-overview">
5491 <title>System Views</title>
5493 <para>
5494 In addition to the system catalogs, <productname>PostgreSQL</productname>
5495 provides a number of built-in views. Some system views provide convenient
5496 access to some commonly used queries on the system catalogs. Other views
5497 provide access to internal server state.
5498 </para>
5500 <para>
5501 The information schema (<xref linkend="information-schema">) provides
5502 an alternative set of views which overlap the functionality of the system
5503 views. Since the information schema is SQL-standard whereas the views
5504 described here are <productname>PostgreSQL</productname>-specific,
5505 it's usually better to use the information schema if it provides all
5506 the information you need.
5507 </para>
5509 <para>
5510 <xref linkend="view-table"> lists the system views described here.
5511 More detailed documentation of each view follows below.
5512 There are some additional views that provide access to the results of
5513 the statistics collector; they are described in <xref
5514 linkend="monitoring-stats-views-table">.
5515 </para>
5517 <para>
5518 Except where noted, all the views described here are read-only.
5519 </para>
5521 <table id="view-table">
5522 <title>System Views</title>
5524 <tgroup cols="2">
5525 <thead>
5526 <row>
5527 <entry>View Name</entry>
5528 <entry>Purpose</entry>
5529 </row>
5530 </thead>
5532 <tbody>
5533 <row>
5534 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5535 <entry>open cursors</entry>
5536 </row>
5538 <row>
5539 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5540 <entry>groups of database users</entry>
5541 </row>
5543 <row>
5544 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5545 <entry>indexes</entry>
5546 </row>
5548 <row>
5549 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5550 <entry>currently held locks</entry>
5551 </row>
5553 <row>
5554 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5555 <entry>prepared statements</entry>
5556 </row>
5558 <row>
5559 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5560 <entry>prepared transactions</entry>
5561 </row>
5563 <row>
5564 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5565 <entry>database roles</entry>
5566 </row>
5568 <row>
5569 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5570 <entry>rules</entry>
5571 </row>
5573 <row>
5574 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5575 <entry>parameter settings</entry>
5576 </row>
5578 <row>
5579 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5580 <entry>database users</entry>
5581 </row>
5583 <row>
5584 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5585 <entry>planner statistics</entry>
5586 </row>
5588 <row>
5589 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5590 <entry>tables</entry>
5591 </row>
5593 <row>
5594 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5595 <entry>time zone abbreviations</entry>
5596 </row>
5598 <row>
5599 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5600 <entry>time zone names</entry>
5601 </row>
5603 <row>
5604 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5605 <entry>database users</entry>
5606 </row>
5608 <row>
5609 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5610 <entry>views</entry>
5611 </row>
5613 </tbody>
5614 </tgroup>
5615 </table>
5616 </sect1>
5618 <sect1 id="view-pg-cursors">
5619 <title><structname>pg_cursors</structname></title>
5621 <indexterm zone="view-pg-cursors">
5622 <primary>pg_cursors</primary>
5623 </indexterm>
5625 <para>
5626 The <structname>pg_cursors</structname> view lists the cursors that
5627 are currently available. Cursors can be defined in several ways:
5628 <itemizedlist>
5629 <listitem>
5630 <para>
5631 via the <xref linkend="sql-declare" endterm="sql-declare-title">
5632 statement in SQL
5633 </para>
5634 </listitem>
5636 <listitem>
5637 <para>
5638 via the Bind message in the frontend/backend protocol, as
5639 described in <xref linkend="protocol-flow-ext-query">
5640 </para>
5641 </listitem>
5643 <listitem>
5644 <para>
5645 via the Server Programming Interface (SPI), as described in
5646 <xref linkend="spi-interface">
5647 </para>
5648 </listitem>
5649 </itemizedlist>
5651 The <structname>pg_cursors</structname> view displays cursors
5652 created by any of these means. Cursors only exist for the duration
5653 of the transaction that defines them, unless they have been
5654 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5655 cursors are only present in the view until the end of their
5656 creating transaction.
5658 <note>
5659 <para>
5660 Cursors are used internally to implement some of the components
5661 of <productname>PostgreSQL</>, such as procedural languages.
5662 Therefore, the <structname>pg_cursors</> view might include cursors
5663 that have not been explicitly created by the user.
5664 </para>
5665 </note>
5666 </para>
5668 <table>
5669 <title><structname>pg_cursors</> Columns</title>
5671 <tgroup cols="3">
5672 <thead>
5673 <row>
5674 <entry>Name</entry>
5675 <entry>Type</entry>
5676 <entry>Description</entry>
5677 </row>
5678 </thead>
5680 <tbody>
5681 <row>
5682 <entry><structfield>name</structfield></entry>
5683 <entry><type>text</type></entry>
5684 <entry>The name of the cursor</entry>
5685 </row>
5687 <row>
5688 <entry><structfield>statement</structfield></entry>
5689 <entry><type>text</type></entry>
5690 <entry>The verbatim query string submitted to declare this cursor</entry>
5691 </row>
5693 <row>
5694 <entry><structfield>is_holdable</structfield></entry>
5695 <entry><type>boolean</type></entry>
5696 <entry>
5697 <literal>true</literal> if the cursor is holdable (that is, it
5698 can be accessed after the transaction that declared the cursor
5699 has committed); <literal>false</literal> otherwise
5700 </entry>
5701 </row>
5703 <row>
5704 <entry><structfield>is_binary</structfield></entry>
5705 <entry><type>boolean</type></entry>
5706 <entry>
5707 <literal>true</literal> if the cursor was declared
5708 <literal>BINARY</literal>; <literal>false</literal>
5709 otherwise
5710 </entry>
5711 </row>
5713 <row>
5714 <entry><structfield>is_scrollable</structfield></entry>
5715 <entry><type>boolean</type></entry>
5716 <entry>
5717 <literal>true</> if the cursor is scrollable (that is, it
5718 allows rows to be retrieved in a nonsequential manner);
5719 <literal>false</literal> otherwise
5720 </entry>
5721 </row>
5723 <row>
5724 <entry><structfield>creation_time</structfield></entry>
5725 <entry><type>timestamptz</type></entry>
5726 <entry>The time at which the cursor was declared</entry>
5727 </row>
5728 </tbody>
5729 </tgroup>
5730 </table>
5732 <para>
5733 The <structname>pg_cursors</structname> view is read only.
5734 </para>
5736 </sect1>
5738 <sect1 id="view-pg-group">
5739 <title><structname>pg_group</structname></title>
5741 <indexterm zone="view-pg-group">
5742 <primary>pg_group</primary>
5743 </indexterm>
5745 <para>
5746 The view <structname>pg_group</structname> exists for backwards
5747 compatibility: it emulates a catalog that existed in
5748 <productname>PostgreSQL</productname> before version 8.1.
5749 It shows the names and members of all roles that are marked as not
5750 <structfield>rolcanlogin</>, which is an approximation to the set
5751 of roles that are being used as groups.
5752 </para>
5754 <table>
5755 <title><structname>pg_group</> Columns</title>
5757 <tgroup cols="4">
5758 <thead>
5759 <row>
5760 <entry>Name</entry>
5761 <entry>Type</entry>
5762 <entry>References</entry>
5763 <entry>Description</entry>
5764 </row>
5765 </thead>
5767 <tbody>
5768 <row>
5769 <entry><structfield>groname</structfield></entry>
5770 <entry><type>name</type></entry>
5771 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5772 <entry>Name of the group</entry>
5773 </row>
5775 <row>
5776 <entry><structfield>grosysid</structfield></entry>
5777 <entry><type>oid</type></entry>
5778 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5779 <entry>ID of this group</entry>
5780 </row>
5782 <row>
5783 <entry><structfield>grolist</structfield></entry>
5784 <entry><type>oid[]</type></entry>
5785 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5786 <entry>An array containing the IDs of the roles in this group</entry>
5787 </row>
5788 </tbody>
5789 </tgroup>
5790 </table>
5792 </sect1>
5794 <sect1 id="view-pg-indexes">
5795 <title><structname>pg_indexes</structname></title>
5797 <indexterm zone="view-pg-indexes">
5798 <primary>pg_indexes</primary>
5799 </indexterm>
5801 <para>
5802 The view <structname>pg_indexes</structname> provides access to
5803 useful information about each index in the database.
5804 </para>
5806 <table>
5807 <title><structname>pg_indexes</> Columns</title>
5809 <tgroup cols="4">
5810 <thead>
5811 <row>
5812 <entry>Name</entry>
5813 <entry>Type</entry>
5814 <entry>References</entry>
5815 <entry>Description</entry>
5816 </row>
5817 </thead>
5818 <tbody>
5819 <row>
5820 <entry><structfield>schemaname</structfield></entry>
5821 <entry><type>name</type></entry>
5822 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5823 <entry>Name of schema containing table and index</entry>
5824 </row>
5825 <row>
5826 <entry><structfield>tablename</structfield></entry>
5827 <entry><type>name</type></entry>
5828 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5829 <entry>Name of table the index is for</entry>
5830 </row>
5831 <row>
5832 <entry><structfield>indexname</structfield></entry>
5833 <entry><type>name</type></entry>
5834 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5835 <entry>Name of index</entry>
5836 </row>
5837 <row>
5838 <entry><structfield>tablespace</structfield></entry>
5839 <entry><type>name</type></entry>
5840 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
5841 <entry>Name of tablespace containing index (NULL if default for database)</entry>
5842 </row>
5843 <row>
5844 <entry><structfield>indexdef</structfield></entry>
5845 <entry><type>text</type></entry>
5846 <entry></entry>
5847 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
5848 command)</entry>
5849 </row>
5850 </tbody>
5851 </tgroup>
5852 </table>
5854 </sect1>
5856 <sect1 id="view-pg-locks">
5857 <title><structname>pg_locks</structname></title>
5859 <indexterm zone="view-pg-locks">
5860 <primary>pg_locks</primary>
5861 </indexterm>
5863 <para>
5864 The view <structname>pg_locks</structname> provides access to
5865 information about the locks held by open transactions within the
5866 database server. See <xref linkend="mvcc"> for more discussion
5867 of locking.
5868 </para>
5870 <para>
5871 <structname>pg_locks</structname> contains one row per active lockable
5872 object, requested lock mode, and relevant transaction. Thus, the same
5873 lockable object might
5874 appear many times, if multiple transactions are holding or waiting
5875 for locks on it. However, an object that currently has no locks on it
5876 will not appear at all.
5877 </para>
5879 <para>
5880 There are several distinct types of lockable objects:
5881 whole relations (e.g., tables), individual pages of relations,
5882 individual tuples of relations,
5883 transaction IDs (both virtual and permanent IDs),
5884 and general database objects (identified by class OID and object OID,
5885 in the same way as in <structname>pg_description</structname> or
5886 <structname>pg_depend</structname>). Also, the right to extend a
5887 relation is represented as a separate lockable object.
5888 </para>
5890 <table>
5891 <title><structname>pg_locks</> Columns</title>
5893 <tgroup cols="4">
5894 <thead>
5895 <row>
5896 <entry>Name</entry>
5897 <entry>Type</entry>
5898 <entry>References</entry>
5899 <entry>Description</entry>
5900 </row>
5901 </thead>
5902 <tbody>
5903 <row>
5904 <entry><structfield>locktype</structfield></entry>
5905 <entry><type>text</type></entry>
5906 <entry></entry>
5907 <entry>
5908 type of the lockable object:
5909 <literal>relation</>,
5910 <literal>extend</>,
5911 <literal>page</>,
5912 <literal>tuple</>,
5913 <literal>transactionid</>,
5914 <literal>virtualxid</>,
5915 <literal>object</>,
5916 <literal>userlock</>, or
5917 <literal>advisory</>
5918 </entry>
5919 </row>
5920 <row>
5921 <entry><structfield>database</structfield></entry>
5922 <entry><type>oid</type></entry>
5923 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5924 <entry>
5925 OID of the database in which the object exists, or
5926 zero if the object is a shared object, or
5927 NULL if the object is a transaction ID
5928 </entry>
5929 </row>
5930 <row>
5931 <entry><structfield>relation</structfield></entry>
5932 <entry><type>oid</type></entry>
5933 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5934 <entry>
5935 OID of the relation, or NULL if the object is not
5936 a relation or part of a relation
5937 </entry>
5938 </row>
5939 <row>
5940 <entry><structfield>page</structfield></entry>
5941 <entry><type>integer</type></entry>
5942 <entry></entry>
5943 <entry>
5944 Page number within the relation, or NULL if the object
5945 is not a tuple or relation page
5946 </entry>
5947 </row>
5948 <row>
5949 <entry><structfield>tuple</structfield></entry>
5950 <entry><type>smallint</type></entry>
5951 <entry></entry>
5952 <entry>
5953 Tuple number within the page, or NULL if the object is not a tuple
5954 </entry>
5955 </row>
5956 <row>
5957 <entry><structfield>virtualxid</structfield></entry>
5958 <entry><type>text</type></entry>
5959 <entry></entry>
5960 <entry>
5961 Virtual ID of a transaction, or NULL if the object is not a
5962 virtual transaction ID
5963 </entry>
5964 </row>
5965 <row>
5966 <entry><structfield>transactionid</structfield></entry>
5967 <entry><type>xid</type></entry>
5968 <entry></entry>
5969 <entry>
5970 ID of a transaction, or NULL if the object is not a transaction ID
5971 </entry>
5972 </row>
5973 <row>
5974 <entry><structfield>classid</structfield></entry>
5975 <entry><type>oid</type></entry>
5976 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5977 <entry>
5978 OID of the system catalog containing the object, or NULL if the
5979 object is not a general database object
5980 </entry>
5981 </row>
5982 <row>
5983 <entry><structfield>objid</structfield></entry>
5984 <entry><type>oid</type></entry>
5985 <entry>any OID column</entry>
5986 <entry>
5987 OID of the object within its system catalog, or NULL if the
5988 object is not a general database object.
5989 For advisory locks it is used to distinguish the two key
5990 spaces (<literal>1</> for an int8 key, <literal>2</> for two
5991 int4 keys).
5992 </entry>
5993 </row>
5994 <row>
5995 <entry><structfield>objsubid</structfield></entry>
5996 <entry><type>smallint</type></entry>
5997 <entry></entry>
5998 <entry>
5999 For a table column, this is the column number (the
6000 <structfield>classid</> and <structfield>objid</> refer to the
6001 table itself). For all other object types, this column is
6002 zero. NULL if the object is not a general database object
6003 </entry>
6004 </row>
6005 <row>
6006 <entry><structfield>virtualtransaction</structfield></entry>
6007 <entry><type>text</type></entry>
6008 <entry></entry>
6009 <entry>
6010 Virtual ID of the transaction that is holding or awaiting this lock
6011 </entry>
6012 </row>
6013 <row>
6014 <entry><structfield>pid</structfield></entry>
6015 <entry><type>integer</type></entry>
6016 <entry></entry>
6017 <entry>
6018 Process ID of the server process holding or awaiting this
6019 lock. NULL if the lock is held by a prepared transaction
6020 </entry>
6021 </row>
6022 <row>
6023 <entry><structfield>mode</structfield></entry>
6024 <entry><type>text</type></entry>
6025 <entry></entry>
6026 <entry>Name of the lock mode held or desired by this process (see <xref
6027 linkend="locking-tables">)</entry>
6028 </row>
6029 <row>
6030 <entry><structfield>granted</structfield></entry>
6031 <entry><type>boolean</type></entry>
6032 <entry></entry>
6033 <entry>True if lock is held, false if lock is awaited</entry>
6034 </row>
6035 </tbody>
6036 </tgroup>
6037 </table>
6039 <para>
6040 <structfield>granted</structfield> is true in a row representing a lock
6041 held by the indicated transaction. False indicates that this transaction is
6042 currently waiting to acquire this lock, which implies that some other
6043 transaction is holding a conflicting lock mode on the same lockable object.
6044 The waiting transaction will sleep until the other lock is released (or a
6045 deadlock situation is detected). A single transaction can be waiting to
6046 acquire at most one lock at a time.
6047 </para>
6049 <para>
6050 Every transaction holds an exclusive lock on its virtual transaction ID for
6051 its entire duration. If a permanent ID is assigned to the transaction
6052 (which normally happens only if the transaction changes the state of the
6053 database), it also holds an exclusive lock on its permanent transaction ID
6054 until it ends. When one transaction finds it necessary to wait specifically
6055 for another transaction, it does so by attempting to acquire share lock on
6056 the other transaction ID (either virtual or permanent ID depending on the
6057 situation). That will succeed only when the other transaction
6058 terminates and releases its locks.
6059 </para>
6061 <para>
6062 Although tuples are a lockable type of object,
6063 information about row-level locks is stored on disk, not in memory,
6064 and therefore row-level locks normally do not appear in this view.
6065 If a transaction is waiting for a
6066 row-level lock, it will usually appear in the view as waiting for the
6067 permanent transaction ID of the current holder of that row lock.
6068 </para>
6070 <para>
6071 Advisory locks can be acquired on keys consisting of either a single
6072 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
6073 high-order half in the <structfield>classid</> column, its low-order half
6074 in the <structfield>objid</> column, and <structfield>objsubid</> equal
6075 to 1. Integer keys are displayed with the first key in the
6076 <structfield>classid</> column, the second key in the <structfield>objid</>
6077 column, and <structfield>objsubid</> equal to 2. The actual meaning of
6078 the keys is up to the user. Advisory locks are local to each database,
6079 so the <structfield>database</> column is meaningful for an advisory lock.
6080 </para>
6082 <para>
6083 When the <structname>pg_locks</structname> view is accessed, the
6084 internal lock manager data structures are momentarily locked, and
6085 a copy is made for the view to display. This ensures that the
6086 view produces a consistent set of results, while not blocking
6087 normal lock manager operations longer than necessary. Nonetheless
6088 there could be some impact on database performance if this view is
6089 frequently accessed.
6090 </para>
6092 <para>
6093 <structname>pg_locks</structname> provides a global view of all locks
6094 in the database cluster, not only those relevant to the current database.
6095 Although its <structfield>relation</structfield> column can be joined
6096 against <structname>pg_class</>.<structfield>oid</> to identify locked
6097 relations, this will only work correctly for relations in the current
6098 database (those for which the <structfield>database</structfield> column
6099 is either the current database's OID or zero).
6100 </para>
6102 <para>
6103 The <structfield>pid</structfield> column can be joined to the
6104 <structfield>procpid</structfield> column of the
6105 <structname>pg_stat_activity</structname> view to get more
6106 information on the session holding or waiting to hold each lock.
6107 Also, if you are using prepared transactions, the
6108 <structfield>transaction</> column can be joined to the
6109 <structfield>transaction</structfield> column of the
6110 <structname>pg_prepared_xacts</structname> view to get more
6111 information on prepared transactions that hold locks.
6112 (A prepared transaction can never be waiting for a lock,
6113 but it continues to hold the locks it acquired while running.)
6114 </para>
6116 </sect1>
6118 <sect1 id="view-pg-prepared-statements">
6119 <title><structname>pg_prepared_statements</structname></title>
6121 <indexterm zone="view-pg-prepared-statements">
6122 <primary>pg_prepared_statements</primary>
6123 </indexterm>
6125 <para>
6126 The <structname>pg_prepared_statements</structname> view displays
6127 all the prepared statements that are available in the current
6128 session. See <xref linkend="sql-prepare"
6129 endterm="sql-prepare-title"> for more information about prepared
6130 statements.
6131 </para>
6133 <para>
6134 <structname>pg_prepared_statements</structname> contains one row
6135 for each prepared statement. Rows are added to the view when a new
6136 prepared statement is created and removed when a prepared statement
6137 is released (for example, via the <xref linkend="sql-deallocate"
6138 endterm="sql-deallocate-title"> command).
6139 </para>
6141 <table>
6142 <title><structname>pg_prepared_statements</> Columns</title>
6144 <tgroup cols="3">
6145 <thead>
6146 <row>
6147 <entry>Name</entry>
6148 <entry>Type</entry>
6149 <entry>Description</entry>
6150 </row>
6151 </thead>
6152 <tbody>
6153 <row>
6154 <entry><structfield>name</structfield></entry>
6155 <entry><type>text</type></entry>
6156 <entry>
6157 The identifier of the prepared statement
6158 </entry>
6159 </row>
6160 <row>
6161 <entry><structfield>statement</structfield></entry>
6162 <entry><type>text</type></entry>
6163 <entry>
6164 The query string submitted by the client to create this
6165 prepared statement. For prepared statements created via SQL,
6166 this is the <command>PREPARE</command> statement submitted by
6167 the client. For prepared statements created via the
6168 frontend/backend protocol, this is the text of the prepared
6169 statement itself
6170 </entry>
6171 </row>
6172 <row>
6173 <entry><structfield>prepare_time</structfield></entry>
6174 <entry><type>timestamptz</type></entry>
6175 <entry>
6176 The time at which the prepared statement was created
6177 </entry>
6178 </row>
6179 <row>
6180 <entry><structfield>parameter_types</structfield></entry>
6181 <entry><type>regtype[]</type></entry>
6182 <entry>
6183 The expected parameter types for the prepared statement in the
6184 form of an array of <type>regtype</type>. The OID corresponding
6185 to an element of this array can be obtained by casting the
6186 <type>regtype</type> value to <type>oid</type>
6187 </entry>
6188 </row>
6189 <row>
6190 <entry><structfield>from_sql</structfield></entry>
6191 <entry><type>boolean</type></entry>
6192 <entry>
6193 <literal>true</literal> if the prepared statement was created
6194 via the <command>PREPARE</command> SQL statement;
6195 <literal>false</literal> if the statement was prepared via the
6196 frontend/backend protocol
6197 </entry>
6198 </row>
6199 </tbody>
6200 </tgroup>
6201 </table>
6203 <para>
6204 The <structname>pg_prepared_statements</structname> view is read only.
6205 </para>
6206 </sect1>
6208 <sect1 id="view-pg-prepared-xacts">
6209 <title><structname>pg_prepared_xacts</structname></title>
6211 <indexterm zone="view-pg-prepared-xacts">
6212 <primary>pg_prepared_xacts</primary>
6213 </indexterm>
6215 <para>
6216 The view <structname>pg_prepared_xacts</structname> displays
6217 information about transactions that are currently prepared for two-phase
6218 commit (see <xref linkend="sql-prepare-transaction"
6219 endterm="sql-prepare-transaction-title"> for details).
6220 </para>
6222 <para>
6223 <structname>pg_prepared_xacts</structname> contains one row per prepared
6224 transaction. An entry is removed when the transaction is committed or
6225 rolled back.
6226 </para>
6228 <table>
6229 <title><structname>pg_prepared_xacts</> Columns</title>
6231 <tgroup cols="4">
6232 <thead>
6233 <row>
6234 <entry>Name</entry>
6235 <entry>Type</entry>
6236 <entry>References</entry>
6237 <entry>Description</entry>
6238 </row>
6239 </thead>
6240 <tbody>
6241 <row>
6242 <entry><structfield>transaction</structfield></entry>
6243 <entry><type>xid</type></entry>
6244 <entry></entry>
6245 <entry>
6246 Numeric transaction identifier of the prepared transaction
6247 </entry>
6248 </row>
6249 <row>
6250 <entry><structfield>gid</structfield></entry>
6251 <entry><type>text</type></entry>
6252 <entry></entry>
6253 <entry>
6254 Global transaction identifier that was assigned to the transaction
6255 </entry>
6256 </row>
6257 <row>
6258 <entry><structfield>prepared</structfield></entry>
6259 <entry><type>timestamp with time zone</type></entry>
6260 <entry></entry>
6261 <entry>
6262 Time at which the transaction was prepared for commit
6263 </entry>
6264 </row>
6265 <row>
6266 <entry><structfield>owner</structfield></entry>
6267 <entry><type>name</type></entry>
6268 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6269 <entry>
6270 Name of the user that executed the transaction
6271 </entry>
6272 </row>
6273 <row>
6274 <entry><structfield>database</structfield></entry>
6275 <entry><type>name</type></entry>
6276 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
6277 <entry>
6278 Name of the database in which the transaction was executed
6279 </entry>
6280 </row>
6281 </tbody>
6282 </tgroup>
6283 </table>
6285 <para>
6286 When the <structname>pg_prepared_xacts</structname> view is accessed, the
6287 internal transaction manager data structures are momentarily locked, and
6288 a copy is made for the view to display. This ensures that the
6289 view produces a consistent set of results, while not blocking
6290 normal operations longer than necessary. Nonetheless
6291 there could be some impact on database performance if this view is
6292 frequently accessed.
6293 </para>
6295 </sect1>
6297 <sect1 id="view-pg-roles">
6298 <title><structname>pg_roles</structname></title>
6300 <indexterm zone="view-pg-roles">
6301 <primary>pg_roles</primary>
6302 </indexterm>
6304 <para>
6305 The view <structname>pg_roles</structname> provides access to
6306 information about database roles. This is simply a publicly
6307 readable view of
6308 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6309 that blanks out the password field.
6310 </para>
6312 <para>
6313 This view explicitly exposes the OID column of the underlying table,
6314 since that is needed to do joins to other catalogs.
6315 </para>
6317 <table>
6318 <title><structname>pg_roles</> Columns</title>
6320 <tgroup cols="4">
6321 <thead>
6322 <row>
6323 <entry>Name</entry>
6324 <entry>Type</entry>
6325 <entry>References</entry>
6326 <entry>Description</entry>
6327 </row>
6328 </thead>
6330 <tbody>
6331 <row>
6332 <entry><structfield>rolname</structfield></entry>
6333 <entry><type>name</type></entry>
6334 <entry></entry>
6335 <entry>Role name</entry>
6336 </row>
6338 <row>
6339 <entry><structfield>rolsuper</structfield></entry>
6340 <entry><type>bool</type></entry>
6341 <entry></entry>
6342 <entry>Role has superuser privileges</entry>
6343 </row>
6345 <row>
6346 <entry><structfield>rolinherit</structfield></entry>
6347 <entry><type>bool</type></entry>
6348 <entry></entry>
6349 <entry>Role automatically inherits privileges of roles it is a
6350 member of</entry>
6351 </row>
6353 <row>
6354 <entry><structfield>rolcreaterole</structfield></entry>
6355 <entry><type>bool</type></entry>
6356 <entry></entry>
6357 <entry>Role can create more roles</entry>
6358 </row>
6360 <row>
6361 <entry><structfield>rolcreatedb</structfield></entry>
6362 <entry><type>bool</type></entry>
6363 <entry></entry>
6364 <entry>Role can create databases</entry>
6365 </row>
6367 <row>
6368 <entry><structfield>rolcatupdate</structfield></entry>
6369 <entry><type>bool</type></entry>
6370 <entry></entry>
6371 <entry>
6372 Role can update system catalogs directly. (Even a superuser cannot do
6373 this unless this column is true.)
6374 </entry>
6375 </row>
6377 <row>
6378 <entry><structfield>rolcanlogin</structfield></entry>
6379 <entry><type>bool</type></entry>
6380 <entry></entry>
6381 <entry>
6382 Role can log in. That is, this role can be given as the initial
6383 session authorization identifier
6384 </entry>
6385 </row>
6387 <row>
6388 <entry><structfield>rolconnlimit</structfield></entry>
6389 <entry><type>int4</type></entry>
6390 <entry></entry>
6391 <entry>
6392 For roles that can log in, this sets maximum number of concurrent
6393 connections this role can make. -1 means no limit
6394 </entry>
6395 </row>
6397 <row>
6398 <entry><structfield>rolpassword</structfield></entry>
6399 <entry><type>text</type></entry>
6400 <entry></entry>
6401 <entry>Not the password (always reads as <literal>********</>)</entry>
6402 </row>
6404 <row>
6405 <entry><structfield>rolvaliduntil</structfield></entry>
6406 <entry><type>timestamptz</type></entry>
6407 <entry></entry>
6408 <entry>Password expiry time (only used for password authentication);
6409 NULL if no expiration</entry>
6410 </row>
6412 <row>
6413 <entry><structfield>rolconfig</structfield></entry>
6414 <entry><type>text[]</type></entry>
6415 <entry></entry>
6416 <entry>Session defaults for run-time configuration variables</entry>
6417 </row>
6419 <row>
6420 <entry><structfield>oid</structfield></entry>
6421 <entry><type>oid</type></entry>
6422 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6423 <entry>ID of role</entry>
6424 </row>
6425 </tbody>
6426 </tgroup>
6427 </table>
6429 </sect1>
6431 <sect1 id="view-pg-rules">
6432 <title><structname>pg_rules</structname></title>
6434 <indexterm zone="view-pg-rules">
6435 <primary>pg_rules</primary>
6436 </indexterm>
6438 <para>
6439 The view <structname>pg_rules</structname> provides access to
6440 useful information about query rewrite rules.
6441 </para>
6443 <table>
6444 <title><structname>pg_rules</> Columns</title>
6446 <tgroup cols="4">
6447 <thead>
6448 <row>
6449 <entry>Name</entry>
6450 <entry>Type</entry>
6451 <entry>References</entry>
6452 <entry>Description</entry>
6453 </row>
6454 </thead>
6455 <tbody>
6456 <row>
6457 <entry><structfield>schemaname</structfield></entry>
6458 <entry><type>name</type></entry>
6459 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6460 <entry>Name of schema containing table</entry>
6461 </row>
6462 <row>
6463 <entry><structfield>tablename</structfield></entry>
6464 <entry><type>name</type></entry>
6465 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6466 <entry>Name of table the rule is for</entry>
6467 </row>
6468 <row>
6469 <entry><structfield>rulename</structfield></entry>
6470 <entry><type>name</type></entry>
6471 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6472 <entry>Name of rule</entry>
6473 </row>
6474 <row>
6475 <entry><structfield>definition</structfield></entry>
6476 <entry><type>text</type></entry>
6477 <entry></entry>
6478 <entry>Rule definition (a reconstructed creation command)</entry>
6479 </row>
6480 </tbody>
6481 </tgroup>
6482 </table>
6484 <para>
6485 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6486 of views; those can be seen in <structname>pg_views</>.
6487 </para>
6489 </sect1>
6491 <sect1 id="view-pg-settings">
6492 <title><structname>pg_settings</structname></title>
6494 <indexterm zone="view-pg-settings">
6495 <primary>pg_settings</primary>
6496 </indexterm>
6498 <para>
6499 The view <structname>pg_settings</structname> provides access to
6500 run-time parameters of the server. It is essentially an alternative
6501 interface to the <xref linkend="sql-show" endterm="sql-show-title">
6502 and <xref linkend="sql-set" endterm="sql-set-title"> commands.
6503 It also provides access to some facts about each parameter that are
6504 not directly available from <command>SHOW</>, such as minimum and
6505 maximum values.
6506 </para>
6508 <table>
6509 <title><structname>pg_settings</> Columns</title>
6511 <tgroup cols="3">
6512 <thead>
6513 <row>
6514 <entry>Name</entry>
6515 <entry>Type</entry>
6516 <entry>Description</entry>
6517 </row>
6518 </thead>
6519 <tbody>
6520 <row>
6521 <entry><structfield>name</structfield></entry>
6522 <entry><type>text</type></entry>
6523 <entry>Run-time configuration parameter name</entry>
6524 </row>
6525 <row>
6526 <entry><structfield>setting</structfield></entry>
6527 <entry><type>text</type></entry>
6528 <entry>Current value of the parameter</entry>
6529 </row>
6530 <row>
6531 <entry><structfield>unit</structfield></entry>
6532 <entry><type>text</type></entry>
6533 <entry>Implicit unit of the parameter</entry>
6534 </row>
6535 <row>
6536 <entry><structfield>category</structfield></entry>
6537 <entry><type>text</type></entry>
6538 <entry>Logical group of the parameter</entry>
6539 </row>
6540 <row>
6541 <entry><structfield>short_desc</structfield></entry>
6542 <entry><type>text</type></entry>
6543 <entry>A brief description of the parameter</entry>
6544 </row>
6545 <row>
6546 <entry><structfield>extra_desc</structfield></entry>
6547 <entry><type>text</type></entry>
6548 <entry>Additional, more detailed, description of the parameter</entry>
6549 </row>
6550 <row>
6551 <entry><structfield>context</structfield></entry>
6552 <entry><type>text</type></entry>
6553 <entry>Context required to set the parameter's value</entry>
6554 </row>
6555 <row>
6556 <entry><structfield>vartype</structfield></entry>
6557 <entry><type>text</type></entry>
6558 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6559 <literal>integer</>, <literal>real</>, or <literal>string</>)
6560 </entry>
6561 </row>
6562 <row>
6563 <entry><structfield>source</structfield></entry>
6564 <entry><type>text</type></entry>
6565 <entry>Source of the current parameter value</entry>
6566 </row>
6567 <row>
6568 <entry><structfield>min_val</structfield></entry>
6569 <entry><type>text</type></entry>
6570 <entry>Minimum allowed value of the parameter (NULL for non-numeric
6571 values)</entry>
6572 </row>
6573 <row>
6574 <entry><structfield>max_val</structfield></entry>
6575 <entry><type>text</type></entry>
6576 <entry>Maximum allowed value of the parameter (NULL for non-numeric
6577 values)</entry>
6578 </row>
6579 <row>
6580 <entry><structfield>enumvals</structfield></entry>
6581 <entry><type>text[]</type></entry>
6582 <entry>Allowed values of an enum parameter (NULL for non-enum
6583 values)</entry>
6584 </row>
6585 <row>
6586 <entry><structfield>boot_val</structfield></entry>
6587 <entry><type>text</type></entry>
6588 <entry>Parameter value assumed at server startup if the parameter is
6589 not otherwise set</entry>
6590 </row>
6591 <row>
6592 <entry><structfield>reset_val</structfield></entry>
6593 <entry><type>text</type></entry>
6594 <entry>Value that <command>RESET</command> would reset the parameter to
6595 in the current session</entry>
6596 </row>
6597 <row>
6598 <entry><structfield>sourcefile</structfield></entry>
6599 <entry><type>text</type></entry>
6600 <entry>Configuration file the current value was set in (NULL for
6601 values set from sources other than configuration files, or when
6602 examined by a non-superuser).
6603 Helpful when using configuration include directives</entry>
6604 </row>
6605 <row>
6606 <entry><structfield>sourceline</structfield></entry>
6607 <entry><type>integer</type></entry>
6608 <entry>Line number within the configuration file the current value was
6609 set at (NULL for values set from sources other than configuration files,
6610 or when examined by a non-superuser)
6611 </entry>
6612 </row>
6613 </tbody>
6614 </tgroup>
6615 </table>
6617 <para>
6618 The <structname>pg_settings</structname> view cannot be inserted into or
6619 deleted from, but it can be updated. An <command>UPDATE</command> applied
6620 to a row of <structname>pg_settings</structname> is equivalent to executing
6621 the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6622 parameter. The change only affects the value used by the current
6623 session. If an <command>UPDATE</command> is issued within a transaction
6624 that is later aborted, the effects of the <command>UPDATE</command> command
6625 disappear when the transaction is rolled back. Once the surrounding
6626 transaction is committed, the effects will persist until the end of the
6627 session, unless overridden by another <command>UPDATE</command> or
6628 <command>SET</command>.
6629 </para>
6631 </sect1>
6633 <sect1 id="view-pg-shadow">
6634 <title><structname>pg_shadow</structname></title>
6636 <indexterm zone="view-pg-shadow">
6637 <primary>pg_shadow</primary>
6638 </indexterm>
6640 <para>
6641 The view <structname>pg_shadow</structname> exists for backwards
6642 compatibility: it emulates a catalog that existed in
6643 <productname>PostgreSQL</productname> before version 8.1.
6644 It shows properties of all roles that are marked as
6645 <structfield>rolcanlogin</>.
6646 </para>
6648 <para>
6649 The name stems from the fact that this table
6650 should not be readable by the public since it contains passwords.
6651 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6652 is a publicly readable view on
6653 <structname>pg_shadow</structname> that blanks out the password field.
6654 </para>
6656 <table>
6657 <title><structname>pg_shadow</> Columns</title>
6659 <tgroup cols="4">
6660 <thead>
6661 <row>
6662 <entry>Name</entry>
6663 <entry>Type</entry>
6664 <entry>References</entry>
6665 <entry>Description</entry>
6666 </row>
6667 </thead>
6669 <tbody>
6670 <row>
6671 <entry><structfield>usename</structfield></entry>
6672 <entry><type>name</type></entry>
6673 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6674 <entry>User name</entry>
6675 </row>
6677 <row>
6678 <entry><structfield>usesysid</structfield></entry>
6679 <entry><type>oid</type></entry>
6680 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6681 <entry>ID of this user</entry>
6682 </row>
6684 <row>
6685 <entry><structfield>usecreatedb</structfield></entry>
6686 <entry><type>bool</type></entry>
6687 <entry></entry>
6688 <entry>User can create databases</entry>
6689 </row>
6691 <row>
6692 <entry><structfield>usesuper</structfield></entry>
6693 <entry><type>bool</type></entry>
6694 <entry></entry>
6695 <entry>User is a superuser</entry>
6696 </row>
6698 <row>
6699 <entry><structfield>usecatupd</structfield></entry>
6700 <entry><type>bool</type></entry>
6701 <entry></entry>
6702 <entry>
6703 User can update system catalogs. (Even a superuser cannot do
6704 this unless this column is true.)
6705 </entry>
6706 </row>
6708 <row>
6709 <entry><structfield>passwd</structfield></entry>
6710 <entry><type>text</type></entry>
6711 <entry></entry>
6712 <entry>Password (possibly encrypted)</entry>
6713 </row>
6715 <row>
6716 <entry><structfield>valuntil</structfield></entry>
6717 <entry><type>abstime</type></entry>
6718 <entry></entry>
6719 <entry>Password expiry time (only used for password authentication)</entry>
6720 </row>
6722 <row>
6723 <entry><structfield>useconfig</structfield></entry>
6724 <entry><type>text[]</type></entry>
6725 <entry></entry>
6726 <entry>Session defaults for run-time configuration variables</entry>
6727 </row>
6728 </tbody>
6729 </tgroup>
6730 </table>
6732 </sect1>
6734 <sect1 id="view-pg-stats">
6735 <title><structname>pg_stats</structname></title>
6737 <indexterm zone="view-pg-stats">
6738 <primary>pg_stats</primary>
6739 </indexterm>
6741 <para>
6742 The view <structname>pg_stats</structname> provides access to
6743 the information stored in the <link
6744 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6745 catalog. This view allows access only to rows of
6746 <structname>pg_statistic</structname> that correspond to tables the
6747 user has permission to read, and therefore it is safe to allow public
6748 read access to this view.
6749 </para>
6751 <para>
6752 <structname>pg_stats</structname> is also designed to present the
6753 information in a more readable format than the underlying catalog
6754 &mdash; at the cost that its schema must be extended whenever new slot types
6755 are defined for <structname>pg_statistic</structname>.
6756 </para>
6758 <table>
6759 <title><structname>pg_stats</> Columns</title>
6761 <tgroup cols="4">
6762 <thead>
6763 <row>
6764 <entry>Name</entry>
6765 <entry>Type</entry>
6766 <entry>References</entry>
6767 <entry>Description</entry>
6768 </row>
6769 </thead>
6770 <tbody>
6771 <row>
6772 <entry><structfield>schemaname</structfield></entry>
6773 <entry><type>name</type></entry>
6774 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6775 <entry>Name of schema containing table</entry>
6776 </row>
6778 <row>
6779 <entry><structfield>tablename</structfield></entry>
6780 <entry><type>name</type></entry>
6781 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6782 <entry>Name of table</entry>
6783 </row>
6785 <row>
6786 <entry><structfield>attname</structfield></entry>
6787 <entry><type>name</type></entry>
6788 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6789 <entry>Name of the column described by this row</entry>
6790 </row>
6792 <row>
6793 <entry><structfield>null_frac</structfield></entry>
6794 <entry><type>real</type></entry>
6795 <entry></entry>
6796 <entry>Fraction of column entries that are null</entry>
6797 </row>
6799 <row>
6800 <entry><structfield>avg_width</structfield></entry>
6801 <entry><type>integer</type></entry>
6802 <entry></entry>
6803 <entry>Average width in bytes of column's entries</entry>
6804 </row>
6806 <row>
6807 <entry><structfield>n_distinct</structfield></entry>
6808 <entry><type>real</type></entry>
6809 <entry></entry>
6810 <entry>
6811 If greater than zero, the estimated number of distinct values in the
6812 column. If less than zero, the negative of the number of distinct
6813 values divided by the number of rows. (The negated form is used when
6814 <command>ANALYZE</> believes that the number of distinct values is
6815 likely to increase as the table grows; the positive form is used when
6816 the column seems to have a fixed number of possible values.) For
6817 example, -1 indicates a unique column in which the number of distinct
6818 values is the same as the number of rows
6819 </entry>
6820 </row>
6822 <row>
6823 <entry><structfield>most_common_vals</structfield></entry>
6824 <entry><type>anyarray</type></entry>
6825 <entry></entry>
6826 <entry>
6827 A list of the most common values in the column. (NULL if
6828 no values seem to be more common than any others.)
6829 For some datatypes such as <type>tsvector</>, this is a list of
6830 the most common element values rather than values of the type itself.
6831 </entry>
6832 </row>
6834 <row>
6835 <entry><structfield>most_common_freqs</structfield></entry>
6836 <entry><type>real[]</type></entry>
6837 <entry></entry>
6838 <entry>
6839 A list of the frequencies of the most common values or elements,
6840 i.e., number of occurrences of each divided by total number of rows.
6841 (NULL when <structfield>most_common_vals</structfield> is.)
6842 For some datatypes such as <type>tsvector</>, it can also store some
6843 additional information, making it longer than the
6844 <structfield>most_common_vals</> array.
6845 </entry>
6846 </row>
6848 <row>
6849 <entry><structfield>histogram_bounds</structfield></entry>
6850 <entry><type>anyarray</type></entry>
6851 <entry></entry>
6852 <entry>
6853 A list of values that divide the column's values into groups of
6854 approximately equal population. The values in
6855 <structfield>most_common_vals</>, if present, are omitted from this
6856 histogram calculation. (This column is NULL if the column data type
6857 does not have a <literal>&lt;</> operator or if the
6858 <structfield>most_common_vals</> list accounts for the entire
6859 population.)
6860 </entry>
6861 </row>
6863 <row>
6864 <entry><structfield>correlation</structfield></entry>
6865 <entry><type>real</type></entry>
6866 <entry></entry>
6867 <entry>
6868 Statistical correlation between physical row ordering and
6869 logical ordering of the column values. This ranges from -1 to +1.
6870 When the value is near -1 or +1, an index scan on the column will
6871 be estimated to be cheaper than when it is near zero, due to reduction
6872 of random access to the disk. (This column is NULL if the column data
6873 type does not have a <literal>&lt;</> operator.)
6874 </entry>
6875 </row>
6876 </tbody>
6877 </tgroup>
6878 </table>
6880 <para>
6881 The maximum number of entries in the <structfield>most_common_vals</>
6882 and <structfield>histogram_bounds</> arrays can be set on a
6883 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
6884 command, or globally by setting the
6885 <xref linkend="guc-default-statistics-target"> run-time parameter.
6886 </para>
6888 </sect1>
6890 <sect1 id="view-pg-tables">
6891 <title><structname>pg_tables</structname></title>
6893 <indexterm zone="view-pg-tables">
6894 <primary>pg_tables</primary>
6895 </indexterm>
6897 <para>
6898 The view <structname>pg_tables</structname> provides access to
6899 useful information about each table in the database.
6900 </para>
6902 <table>
6903 <title><structname>pg_tables</> Columns</title>
6905 <tgroup cols="4">
6906 <thead>
6907 <row>
6908 <entry>Name</entry>
6909 <entry>Type</entry>
6910 <entry>References</entry>
6911 <entry>Description</entry>
6912 </row>
6913 </thead>
6914 <tbody>
6915 <row>
6916 <entry><structfield>schemaname</structfield></entry>
6917 <entry><type>name</type></entry>
6918 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6919 <entry>Name of schema containing table</entry>
6920 </row>
6921 <row>
6922 <entry><structfield>tablename</structfield></entry>
6923 <entry><type>name</type></entry>
6924 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6925 <entry>Name of table</entry>
6926 </row>
6927 <row>
6928 <entry><structfield>tableowner</structfield></entry>
6929 <entry><type>name</type></entry>
6930 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6931 <entry>Name of table's owner</entry>
6932 </row>
6933 <row>
6934 <entry><structfield>tablespace</structfield></entry>
6935 <entry><type>name</type></entry>
6936 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6937 <entry>Name of tablespace containing table (NULL if default for database)</entry>
6938 </row>
6939 <row>
6940 <entry><structfield>hasindexes</structfield></entry>
6941 <entry><type>boolean</type></entry>
6942 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
6943 <entry>true if table has (or recently had) any indexes</entry>
6944 </row>
6945 <row>
6946 <entry><structfield>hasrules</structfield></entry>
6947 <entry><type>boolean</type></entry>
6948 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
6949 <entry>true if table has (or once had) rules</entry>
6950 </row>
6951 <row>
6952 <entry><structfield>hastriggers</structfield></entry>
6953 <entry><type>boolean</type></entry>
6954 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
6955 <entry>true if table has (or once had) triggers</entry>
6956 </row>
6957 </tbody>
6958 </tgroup>
6959 </table>
6961 </sect1>
6963 <sect1 id="view-pg-timezone-abbrevs">
6964 <title><structname>pg_timezone_abbrevs</structname></title>
6966 <indexterm zone="view-pg-timezone-abbrevs">
6967 <primary>pg_timezone_abbrevs</primary>
6968 </indexterm>
6970 <para>
6971 The view <structname>pg_timezone_abbrevs</structname> provides a list
6972 of time zone abbreviations that are currently recognized by the datetime
6973 input routines. The contents of this view change when the
6974 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
6975 </para>
6977 <table>
6978 <title><structname>pg_timezone_abbrevs</> Columns</title>
6980 <tgroup cols="3">
6981 <thead>
6982 <row>
6983 <entry>Name</entry>
6984 <entry>Type</entry>
6985 <entry>Description</entry>
6986 </row>
6987 </thead>
6988 <tbody>
6989 <row>
6990 <entry><structfield>abbrev</structfield></entry>
6991 <entry><type>text</type></entry>
6992 <entry>Time zone abbreviation</entry>
6993 </row>
6994 <row>
6995 <entry><structfield>utc_offset</structfield></entry>
6996 <entry><type>interval</type></entry>
6997 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6998 </row>
6999 <row>
7000 <entry><structfield>is_dst</structfield></entry>
7001 <entry><type>boolean</type></entry>
7002 <entry>True if this is a daylight-savings abbreviation</entry>
7003 </row>
7004 </tbody>
7005 </tgroup>
7006 </table>
7008 </sect1>
7010 <sect1 id="view-pg-timezone-names">
7011 <title><structname>pg_timezone_names</structname></title>
7013 <indexterm zone="view-pg-timezone-names">
7014 <primary>pg_timezone_names</primary>
7015 </indexterm>
7017 <para>
7018 The view <structname>pg_timezone_names</structname> provides a list
7019 of time zone names that are recognized by <command>SET TIMEZONE</>,
7020 along with their associated abbreviations, UTC offsets,
7021 and daylight-savings status.
7022 Unlike the abbreviations shown in <link
7023 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
7024 date rules. Therefore, the associated information changes across local DST
7025 boundaries. The displayed information is computed based on the current
7026 value of <function>CURRENT_TIMESTAMP</>.
7027 </para>
7029 <table>
7030 <title><structname>pg_timezone_names</> Columns</title>
7032 <tgroup cols="3">
7033 <thead>
7034 <row>
7035 <entry>Name</entry>
7036 <entry>Type</entry>
7037 <entry>Description</entry>
7038 </row>
7039 </thead>
7040 <tbody>
7041 <row>
7042 <entry><structfield>name</structfield></entry>
7043 <entry><type>text</type></entry>
7044 <entry>Time zone name</entry>
7045 </row>
7046 <row>
7047 <entry><structfield>abbrev</structfield></entry>
7048 <entry><type>text</type></entry>
7049 <entry>Time zone abbreviation</entry>
7050 </row>
7051 <row>
7052 <entry><structfield>utc_offset</structfield></entry>
7053 <entry><type>interval</type></entry>
7054 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7055 </row>
7056 <row>
7057 <entry><structfield>is_dst</structfield></entry>
7058 <entry><type>boolean</type></entry>
7059 <entry>True if currently observing daylight savings</entry>
7060 </row>
7061 </tbody>
7062 </tgroup>
7063 </table>
7065 </sect1>
7067 <sect1 id="view-pg-user">
7068 <title><structname>pg_user</structname></title>
7070 <indexterm zone="view-pg-user">
7071 <primary>pg_user</primary>
7072 </indexterm>
7074 <para>
7075 The view <structname>pg_user</structname> provides access to
7076 information about database users. This is simply a publicly
7077 readable view of
7078 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
7079 that blanks out the password field.
7080 </para>
7082 <table>
7083 <title><structname>pg_user</> Columns</title>
7085 <tgroup cols="3">
7086 <thead>
7087 <row>
7088 <entry>Name</entry>
7089 <entry>Type</entry>
7090 <entry>Description</entry>
7091 </row>
7092 </thead>
7093 <tbody>
7094 <row>
7095 <entry><structfield>usename</structfield></entry>
7096 <entry><type>name</type></entry>
7097 <entry>User name</entry>
7098 </row>
7100 <row>
7101 <entry><structfield>usesysid</structfield></entry>
7102 <entry><type>int4</type></entry>
7103 <entry>User ID (arbitrary number used to reference this user)</entry>
7104 </row>
7106 <row>
7107 <entry><structfield>usecreatedb</structfield></entry>
7108 <entry><type>bool</type></entry>
7109 <entry>User can create databases</entry>
7110 </row>
7112 <row>
7113 <entry><structfield>usesuper</structfield></entry>
7114 <entry><type>bool</type></entry>
7115 <entry>User is a superuser</entry>
7116 </row>
7118 <row>
7119 <entry><structfield>usecatupd</structfield></entry>
7120 <entry><type>bool</type></entry>
7121 <entry>
7122 User can update system catalogs. (Even a superuser cannot do
7123 this unless this column is true.)
7124 </entry>
7125 </row>
7127 <row>
7128 <entry><structfield>passwd</structfield></entry>
7129 <entry><type>text</type></entry>
7130 <entry>Not the password (always reads as <literal>********</>)</entry>
7131 </row>
7133 <row>
7134 <entry><structfield>valuntil</structfield></entry>
7135 <entry><type>abstime</type></entry>
7136 <entry>Password expiry time (only used for password authentication)</entry>
7137 </row>
7139 <row>
7140 <entry><structfield>useconfig</structfield></entry>
7141 <entry><type>text[]</type></entry>
7142 <entry>Session defaults for run-time configuration variables</entry>
7143 </row>
7144 </tbody>
7145 </tgroup>
7146 </table>
7148 </sect1>
7150 <sect1 id="view-pg-user-mappings">
7151 <title><structname>pg_user_mappings</structname></title>
7153 <indexterm zone="view-pg-user-mappings">
7154 <primary>pg_user_mappings</primary>
7155 </indexterm>
7157 <para>
7158 The view <structname>pg_user_mappings</structname> provides access
7159 to information about user mappings. This is essentially a publicly
7160 readable view of
7161 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
7162 that leaves out the options field if the user has no rights to use
7164 </para>
7166 <table>
7167 <title><structname>pg_user_mappings</> Columns</title>
7169 <tgroup cols="3">
7170 <thead>
7171 <row>
7172 <entry>Name</entry>
7173 <entry>Type</entry>
7174 <entry>References</entry>
7175 <entry>Description</entry>
7176 </row>
7177 </thead>
7179 <tbody>
7180 <row>
7181 <entry><structfield>umid</structfield></entry>
7182 <entry><type>oid</type></entry>
7183 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
7184 <entry>OID of the user mapping</entry>
7185 </row>
7187 <row>
7188 <entry><structfield>srvid</structfield></entry>
7189 <entry><type>oid</type></entry>
7190 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7191 <entry>
7192 The OID of the foreign server that contains this mapping
7193 </entry>
7194 </row>
7196 <row>
7197 <entry><structfield>srvname</structfield></entry>
7198 <entry><type>text</type></entry>
7199 <entry></entry>
7200 <entry>
7201 Name of the foreign server
7202 </entry>
7203 </row>
7205 <row>
7206 <entry><structfield>umuser</structfield></entry>
7207 <entry><type>oid</type></entry>
7208 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7209 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7210 </row>
7212 <row>
7213 <entry><structfield>usename</structfield></entry>
7214 <entry><type>name</type></entry>
7215 <entry></entry>
7216 <entry>Name of the local user to be mapped</entry>
7217 </row>
7219 <row>
7220 <entry><structfield>umoptions</structfield></entry>
7221 <entry><type>text[]</type></entry>
7222 <entry></entry>
7223 <entry>
7224 User mapping specific options, as <quote>keyword=value</>
7225 strings, if the current user is the owner of the foreign
7226 server, else null.
7227 </entry>
7228 </row>
7229 </tbody>
7230 </tgroup>
7231 </table>
7232 </sect1>
7235 <sect1 id="view-pg-views">
7236 <title><structname>pg_views</structname></title>
7238 <indexterm zone="view-pg-views">
7239 <primary>pg_views</primary>
7240 </indexterm>
7242 <para>
7243 The view <structname>pg_views</structname> provides access to
7244 useful information about each view in the database.
7245 </para>
7247 <table>
7248 <title><structname>pg_views</> Columns</title>
7250 <tgroup cols="4">
7251 <thead>
7252 <row>
7253 <entry>Name</entry>
7254 <entry>Type</entry>
7255 <entry>References</entry>
7256 <entry>Description</entry>
7257 </row>
7258 </thead>
7259 <tbody>
7260 <row>
7261 <entry><structfield>schemaname</structfield></entry>
7262 <entry><type>name</type></entry>
7263 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7264 <entry>Name of schema containing view</entry>
7265 </row>
7266 <row>
7267 <entry><structfield>viewname</structfield></entry>
7268 <entry><type>name</type></entry>
7269 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7270 <entry>Name of view</entry>
7271 </row>
7272 <row>
7273 <entry><structfield>viewowner</structfield></entry>
7274 <entry><type>name</type></entry>
7275 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7276 <entry>Name of view's owner</entry>
7277 </row>
7278 <row>
7279 <entry><structfield>definition</structfield></entry>
7280 <entry><type>text</type></entry>
7281 <entry></entry>
7282 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
7283 </row>
7284 </tbody>
7285 </tgroup>
7286 </table>
7288 </sect1>
7290 </chapter>