gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

833 line
104KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>9.25. System Information Functions and Operators</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="functions-srf.html" title="9.24. Set Returning Functions" /><link rel="next" href="functions-admin.html" title="9.26. System Administration Functions" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">9.25. System Information Functions and Operators</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="functions-srf.html" title="9.24. Set Returning Functions">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="functions.html" title="Chapter 9. Functions and Operators">Up</a></td><th width="60%" align="center">Chapter 9. Functions and Operators</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="functions-admin.html" title="9.26. System Administration Functions">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="FUNCTIONS-INFO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">9.25. System Information Functions and Operators</h2></div></div></div><p>
  3. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-SESSION-TABLE" title="Table 9.63. Session Information Functions">Table 9.63</a> shows several
  4. functions that extract session and system information.
  5. </p><p>
  6. In addition to the functions listed in this section, there are a number of
  7. functions related to the statistics system that also provide system
  8. information. See <a class="xref" href="monitoring-stats.html#MONITORING-STATS-VIEWS" title="27.2.2. Viewing Statistics">Section 27.2.2</a> for more
  9. information.
  10. </p><div class="table" id="FUNCTIONS-INFO-SESSION-TABLE"><p class="title"><strong>Table 9.63. Session Information Functions</strong></p><div class="table-contents"><table class="table" summary="Session Information Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">current_catalog</code></code></td><td><code class="type">name</code></td><td>name of current database (called <span class="quote">“<span class="quote">catalog</span>”</span> in the SQL standard)</td></tr><tr><td><code class="literal"><code class="function">current_database()</code></code></td><td><code class="type">name</code></td><td>name of current database</td></tr><tr><td><code class="literal"><code class="function">current_query()</code></code></td><td><code class="type">text</code></td><td>text of the currently executing query, as submitted
  11. by the client (might contain more than one statement)</td></tr><tr><td><code class="literal"><code class="function">current_role</code></code></td><td><code class="type">name</code></td><td>equivalent to <code class="function">current_user</code></td></tr><tr><td><code class="literal"><code class="function">current_schema</code>[()]</code></td><td><code class="type">name</code></td><td>name of current schema</td></tr><tr><td><code class="literal"><code class="function">current_schemas(<code class="type">boolean</code>)</code></code></td><td><code class="type">name[]</code></td><td>names of schemas in search path, optionally including implicit schemas</td></tr><tr><td><code class="literal"><code class="function">current_user</code></code></td><td><code class="type">name</code></td><td>user name of current execution context</td></tr><tr><td><code class="literal"><code class="function">inet_client_addr()</code></code></td><td><code class="type">inet</code></td><td>address of the remote connection</td></tr><tr><td><code class="literal"><code class="function">inet_client_port()</code></code></td><td><code class="type">int</code></td><td>port of the remote connection</td></tr><tr><td><code class="literal"><code class="function">inet_server_addr()</code></code></td><td><code class="type">inet</code></td><td>address of the local connection</td></tr><tr><td><code class="literal"><code class="function">inet_server_port()</code></code></td><td><code class="type">int</code></td><td>port of the local connection</td></tr><tr><td><code class="literal"><code class="function">pg_backend_pid()</code></code></td><td><code class="type">int</code></td><td>
  12. Process ID of the server process attached to the current session
  13. </td></tr><tr><td><code class="literal"><code class="function">pg_blocking_pids(<code class="type">int</code>)</code></code></td><td><code class="type">int[]</code></td><td>Process ID(s) that are blocking specified server process ID from acquiring a lock</td></tr><tr><td><code class="literal"><code class="function">pg_conf_load_time()</code></code></td><td><code class="type">timestamp with time zone</code></td><td>configuration load time</td></tr><tr><td><code class="literal"><code class="function">pg_current_logfile([<span class="optional"><code class="type">text</code></span>])</code></code></td><td><code class="type">text</code></td><td>Primary log file name, or log in the requested format,
  14. currently in use by the logging collector</td></tr><tr><td><code class="literal"><code class="function">pg_my_temp_schema()</code></code></td><td><code class="type">oid</code></td><td>OID of session's temporary schema, or 0 if none</td></tr><tr><td><code class="literal"><code class="function">pg_is_other_temp_schema(<code class="type">oid</code>)</code></code></td><td><code class="type">boolean</code></td><td>is schema another session's temporary schema?</td></tr><tr><td><code class="literal"><code class="function">pg_jit_available()</code></code></td><td><code class="type">boolean</code></td><td>is a <acronym class="acronym">JIT</acronym> compiler extension available
  15. (see <a class="xref" href="jit.html" title="Chapter 31. Just-in-Time Compilation (JIT)">Chapter 31</a>) and the <a class="xref" href="runtime-config-query.html#GUC-JIT">jit</a>
  16. configuration parameter set to <code class="literal">on</code>.</td></tr><tr><td><code class="literal"><code class="function">pg_listening_channels()</code></code></td><td><code class="type">setof text</code></td><td>channel names that the session is currently listening on</td></tr><tr><td><code class="literal"><code class="function">pg_notification_queue_usage()</code></code></td><td><code class="type">double</code></td><td>fraction of the asynchronous notification queue currently occupied (0-1)</td></tr><tr><td><code class="literal"><code class="function">pg_postmaster_start_time()</code></code></td><td><code class="type">timestamp with time zone</code></td><td>server start time</td></tr><tr><td><code class="literal"><code class="function">pg_safe_snapshot_blocking_pids(<code class="type">int</code>)</code></code></td><td><code class="type">int[]</code></td><td>Process ID(s) that are blocking specified server process ID from acquiring a safe snapshot</td></tr><tr><td><code class="literal"><code class="function">pg_trigger_depth()</code></code></td><td><code class="type">int</code></td><td>current nesting level of <span class="productname">PostgreSQL</span> triggers
  17. (0 if not called, directly or indirectly, from inside a trigger)</td></tr><tr><td><code class="literal"><code class="function">session_user</code></code></td><td><code class="type">name</code></td><td>session user name</td></tr><tr><td><code class="literal"><code class="function">user</code></code></td><td><code class="type">name</code></td><td>equivalent to <code class="function">current_user</code></td></tr><tr><td><code class="literal"><code class="function">version()</code></code></td><td><code class="type">text</code></td><td><span class="productname">PostgreSQL</span> version information. See also <a class="xref" href="runtime-config-preset.html#GUC-SERVER-VERSION-NUM">server_version_num</a> for a machine-readable version.</td></tr></tbody></table></div></div><br class="table-break" /><div class="note"><h3 class="title">Note</h3><p>
  18. <code class="function">current_catalog</code>,
  19. <code class="function">current_role</code>,
  20. <code class="function">current_schema</code>,
  21. <code class="function">current_user</code>,
  22. <code class="function">session_user</code>,
  23. and <code class="function">user</code> have special syntactic status
  24. in <acronym class="acronym">SQL</acronym>: they must be called without trailing
  25. parentheses. (In PostgreSQL, parentheses can optionally be used with
  26. <code class="function">current_schema</code>, but not with the others.)
  27. </p></div><a id="id-1.5.8.30.6" class="indexterm"></a><a id="id-1.5.8.30.7" class="indexterm"></a><a id="id-1.5.8.30.8" class="indexterm"></a><a id="id-1.5.8.30.9" class="indexterm"></a><a id="id-1.5.8.30.10" class="indexterm"></a><a id="id-1.5.8.30.11" class="indexterm"></a><a id="id-1.5.8.30.12" class="indexterm"></a><a id="id-1.5.8.30.13" class="indexterm"></a><a id="id-1.5.8.30.14" class="indexterm"></a><a id="id-1.5.8.30.15" class="indexterm"></a><a id="id-1.5.8.30.16" class="indexterm"></a><a id="id-1.5.8.30.17" class="indexterm"></a><a id="id-1.5.8.30.18" class="indexterm"></a><p>
  28. The <code class="function">session_user</code> is normally the user who initiated
  29. the current database connection; but superusers can change this setting
  30. with <a class="xref" href="sql-set-session-authorization.html" title="SET SESSION AUTHORIZATION"><span class="refentrytitle">SET SESSION AUTHORIZATION</span></a>.
  31. The <code class="function">current_user</code> is the user identifier
  32. that is applicable for permission checking. Normally it is equal
  33. to the session user, but it can be changed with
  34. <a class="xref" href="sql-set-role.html" title="SET ROLE"><span class="refentrytitle">SET ROLE</span></a>.
  35. It also changes during the execution of
  36. functions with the attribute <code class="literal">SECURITY DEFINER</code>.
  37. In Unix parlance, the session user is the <span class="quote">“<span class="quote">real user</span>”</span> and
  38. the current user is the <span class="quote">“<span class="quote">effective user</span>”</span>.
  39. <code class="function">current_role</code> and <code class="function">user</code> are
  40. synonyms for <code class="function">current_user</code>. (The SQL standard draws
  41. a distinction between <code class="function">current_role</code>
  42. and <code class="function">current_user</code>, but <span class="productname">PostgreSQL</span>
  43. does not, since it unifies users and roles into a single kind of entity.)
  44. </p><p>
  45. <code class="function">current_schema</code> returns the name of the schema that is
  46. first in the search path (or a null value if the search path is
  47. empty). This is the schema that will be used for any tables or
  48. other named objects that are created without specifying a target schema.
  49. <code class="function">current_schemas(boolean)</code> returns an array of the names of all
  50. schemas presently in the search path. The Boolean option determines whether or not
  51. implicitly included system schemas such as <code class="literal">pg_catalog</code> are included in the
  52. returned search path.
  53. </p><div class="note"><h3 class="title">Note</h3><p>
  54. The search path can be altered at run time. The command is:
  55. </p><pre class="programlisting">
  56. SET search_path TO <em class="replaceable"><code>schema</code></em> [<span class="optional">, <em class="replaceable"><code>schema</code></em>, ...</span>]
  57. </pre><p>
  58. </p></div><a id="id-1.5.8.30.22" class="indexterm"></a><a id="id-1.5.8.30.23" class="indexterm"></a><a id="id-1.5.8.30.24" class="indexterm"></a><a id="id-1.5.8.30.25" class="indexterm"></a><p>
  59. <code class="function">inet_client_addr</code> returns the IP address of the
  60. current client, and <code class="function">inet_client_port</code> returns the
  61. port number.
  62. <code class="function">inet_server_addr</code> returns the IP address on which
  63. the server accepted the current connection, and
  64. <code class="function">inet_server_port</code> returns the port number.
  65. All these functions return NULL if the current connection is via a
  66. Unix-domain socket.
  67. </p><a id="id-1.5.8.30.27" class="indexterm"></a><p>
  68. <code class="function">pg_blocking_pids</code> returns an array of the process IDs
  69. of the sessions that are blocking the server process with the specified
  70. process ID, or an empty array if there is no such server process or it is
  71. not blocked. One server process blocks another if it either holds a lock
  72. that conflicts with the blocked process's lock request (hard block), or is
  73. waiting for a lock that would conflict with the blocked process's lock
  74. request and is ahead of it in the wait queue (soft block). When using
  75. parallel queries the result always lists client-visible process IDs (that
  76. is, <code class="function">pg_backend_pid</code> results) even if the actual lock is held
  77. or awaited by a child worker process. As a result of that, there may be
  78. duplicated PIDs in the result. Also note that when a prepared transaction
  79. holds a conflicting lock, it will be represented by a zero process ID in
  80. the result of this function.
  81. Frequent calls to this function could have some impact on database
  82. performance, because it needs exclusive access to the lock manager's
  83. shared state for a short time.
  84. </p><a id="id-1.5.8.30.29" class="indexterm"></a><p>
  85. <code class="function">pg_conf_load_time</code> returns the
  86. <code class="type">timestamp with time zone</code> when the
  87. server configuration files were last loaded.
  88. (If the current session was alive at the time, this will be the time
  89. when the session itself re-read the configuration files, so the
  90. reading will vary a little in different sessions. Otherwise it is
  91. the time when the postmaster process re-read the configuration files.)
  92. </p><a id="id-1.5.8.30.31" class="indexterm"></a><a id="id-1.5.8.30.32" class="indexterm"></a><a id="id-1.5.8.30.33" class="indexterm"></a><a id="id-1.5.8.30.34" class="indexterm"></a><p>
  93. <code class="function">pg_current_logfile</code> returns, as <code class="type">text</code>,
  94. the path of the log file(s) currently in use by the logging collector.
  95. The path includes the <a class="xref" href="runtime-config-logging.html#GUC-LOG-DIRECTORY">log_directory</a> directory
  96. and the log file name. Log collection must be enabled or the return value
  97. is <code class="literal">NULL</code>. When multiple log files exist, each in a
  98. different format, <code class="function">pg_current_logfile</code> called
  99. without arguments returns the path of the file having the first format
  100. found in the ordered list: <span class="systemitem">stderr</span>, <span class="systemitem">csvlog</span>.
  101. <code class="literal">NULL</code> is returned when no log file has any of these
  102. formats. To request a specific file format supply, as <code class="type">text</code>,
  103. either <span class="systemitem">csvlog</span> or <span class="systemitem">stderr</span> as the value of the
  104. optional parameter. The return value is <code class="literal">NULL</code> when the
  105. log format requested is not a configured
  106. <a class="xref" href="runtime-config-logging.html#GUC-LOG-DESTINATION">log_destination</a>. The
  107. <code class="function">pg_current_logfile</code> reflects the contents of the
  108. <code class="filename">current_logfiles</code> file.
  109. </p><a id="id-1.5.8.30.36" class="indexterm"></a><a id="id-1.5.8.30.37" class="indexterm"></a><p>
  110. <code class="function">pg_my_temp_schema</code> returns the OID of the current
  111. session's temporary schema, or zero if it has none (because it has not
  112. created any temporary tables).
  113. <code class="function">pg_is_other_temp_schema</code> returns true if the
  114. given OID is the OID of another session's temporary schema.
  115. (This can be useful, for example, to exclude other sessions' temporary
  116. tables from a catalog display.)
  117. </p><a id="id-1.5.8.30.39" class="indexterm"></a><a id="id-1.5.8.30.40" class="indexterm"></a><p>
  118. <code class="function">pg_listening_channels</code> returns a set of names of
  119. asynchronous notification channels that the current session is listening
  120. to. <code class="function">pg_notification_queue_usage</code> returns the
  121. fraction of the total available space for notifications currently
  122. occupied by notifications that are waiting to be processed, as a
  123. <code class="type">double</code> in the range 0-1.
  124. See <a class="xref" href="sql-listen.html" title="LISTEN"><span class="refentrytitle">LISTEN</span></a> and <a class="xref" href="sql-notify.html" title="NOTIFY"><span class="refentrytitle">NOTIFY</span></a>
  125. for more information.
  126. </p><a id="id-1.5.8.30.42" class="indexterm"></a><p>
  127. <code class="function">pg_postmaster_start_time</code> returns the
  128. <code class="type">timestamp with time zone</code> when the
  129. server started.
  130. </p><a id="id-1.5.8.30.44" class="indexterm"></a><p>
  131. <code class="function">pg_safe_snapshot_blocking_pids</code> returns an array of
  132. the process IDs of the sessions that are blocking the server process with
  133. the specified process ID from acquiring a safe snapshot, or an empty array
  134. if there is no such server process or it is not blocked. A session
  135. running a <code class="literal">SERIALIZABLE</code> transaction blocks
  136. a <code class="literal">SERIALIZABLE READ ONLY DEFERRABLE</code> transaction from
  137. acquiring a snapshot until the latter determines that it is safe to avoid
  138. taking any predicate locks. See <a class="xref" href="transaction-iso.html#XACT-SERIALIZABLE" title="13.2.3. Serializable Isolation Level">Section 13.2.3</a> for
  139. more information about serializable and deferrable transactions. Frequent
  140. calls to this function could have some impact on database performance,
  141. because it needs access to the predicate lock manager's shared
  142. state for a short time.
  143. </p><a id="id-1.5.8.30.46" class="indexterm"></a><p>
  144. <code class="function">version</code> returns a string describing the
  145. <span class="productname">PostgreSQL</span> server's version. You can also
  146. get this information from <a class="xref" href="runtime-config-preset.html#GUC-SERVER-VERSION">server_version</a> or
  147. for a machine-readable version, <a class="xref" href="runtime-config-preset.html#GUC-SERVER-VERSION-NUM">server_version_num</a>.
  148. Software developers should use <code class="literal">server_version_num</code>
  149. (available since 8.2) or <a class="xref" href="libpq-status.html#LIBPQ-PQSERVERVERSION">
  150. <code class="function">PQserverVersion</code>
  151. </a> instead
  152. of parsing the text version.
  153. </p><a id="id-1.5.8.30.48" class="indexterm"></a><p>
  154. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE" title="Table 9.64. Access Privilege Inquiry Functions">Table 9.64</a> lists functions that
  155. allow the user to query object access privileges programmatically.
  156. See <a class="xref" href="ddl-priv.html" title="5.7. Privileges">Section 5.7</a> for more information about
  157. privileges.
  158. </p><div class="table" id="FUNCTIONS-INFO-ACCESS-TABLE"><p class="title"><strong>Table 9.64. Access Privilege Inquiry Functions</strong></p><div class="table-contents"><table class="table" summary="Access Privilege Inquiry Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">has_any_column_privilege</code>(<em class="parameter"><code>user</code></em>,
  159. <em class="parameter"><code>table</code></em>,
  160. <em class="parameter"><code>privilege</code></em>)</code>
  161. </td><td><code class="type">boolean</code></td><td>does user have privilege for any column of table</td></tr><tr><td><code class="literal"><code class="function">has_any_column_privilege</code>(<em class="parameter"><code>table</code></em>,
  162. <em class="parameter"><code>privilege</code></em>)</code>
  163. </td><td><code class="type">boolean</code></td><td>does current user have privilege for any column of table</td></tr><tr><td><code class="literal"><code class="function">has_column_privilege</code>(<em class="parameter"><code>user</code></em>,
  164. <em class="parameter"><code>table</code></em>,
  165. <em class="parameter"><code>column</code></em>,
  166. <em class="parameter"><code>privilege</code></em>)</code>
  167. </td><td><code class="type">boolean</code></td><td>does user have privilege for column</td></tr><tr><td><code class="literal"><code class="function">has_column_privilege</code>(<em class="parameter"><code>table</code></em>,
  168. <em class="parameter"><code>column</code></em>,
  169. <em class="parameter"><code>privilege</code></em>)</code>
  170. </td><td><code class="type">boolean</code></td><td>does current user have privilege for column</td></tr><tr><td><code class="literal"><code class="function">has_database_privilege</code>(<em class="parameter"><code>user</code></em>,
  171. <em class="parameter"><code>database</code></em>,
  172. <em class="parameter"><code>privilege</code></em>)</code>
  173. </td><td><code class="type">boolean</code></td><td>does user have privilege for database</td></tr><tr><td><code class="literal"><code class="function">has_database_privilege</code>(<em class="parameter"><code>database</code></em>,
  174. <em class="parameter"><code>privilege</code></em>)</code>
  175. </td><td><code class="type">boolean</code></td><td>does current user have privilege for database</td></tr><tr><td><code class="literal"><code class="function">has_foreign_data_wrapper_privilege</code>(<em class="parameter"><code>user</code></em>,
  176. <em class="parameter"><code>fdw</code></em>,
  177. <em class="parameter"><code>privilege</code></em>)</code>
  178. </td><td><code class="type">boolean</code></td><td>does user have privilege for foreign-data wrapper</td></tr><tr><td><code class="literal"><code class="function">has_foreign_data_wrapper_privilege</code>(<em class="parameter"><code>fdw</code></em>,
  179. <em class="parameter"><code>privilege</code></em>)</code>
  180. </td><td><code class="type">boolean</code></td><td>does current user have privilege for foreign-data wrapper</td></tr><tr><td><code class="literal"><code class="function">has_function_privilege</code>(<em class="parameter"><code>user</code></em>,
  181. <em class="parameter"><code>function</code></em>,
  182. <em class="parameter"><code>privilege</code></em>)</code>
  183. </td><td><code class="type">boolean</code></td><td>does user have privilege for function</td></tr><tr><td><code class="literal"><code class="function">has_function_privilege</code>(<em class="parameter"><code>function</code></em>,
  184. <em class="parameter"><code>privilege</code></em>)</code>
  185. </td><td><code class="type">boolean</code></td><td>does current user have privilege for function</td></tr><tr><td><code class="literal"><code class="function">has_language_privilege</code>(<em class="parameter"><code>user</code></em>,
  186. <em class="parameter"><code>language</code></em>,
  187. <em class="parameter"><code>privilege</code></em>)</code>
  188. </td><td><code class="type">boolean</code></td><td>does user have privilege for language</td></tr><tr><td><code class="literal"><code class="function">has_language_privilege</code>(<em class="parameter"><code>language</code></em>,
  189. <em class="parameter"><code>privilege</code></em>)</code>
  190. </td><td><code class="type">boolean</code></td><td>does current user have privilege for language</td></tr><tr><td><code class="literal"><code class="function">has_schema_privilege</code>(<em class="parameter"><code>user</code></em>,
  191. <em class="parameter"><code>schema</code></em>,
  192. <em class="parameter"><code>privilege</code></em>)</code>
  193. </td><td><code class="type">boolean</code></td><td>does user have privilege for schema</td></tr><tr><td><code class="literal"><code class="function">has_schema_privilege</code>(<em class="parameter"><code>schema</code></em>,
  194. <em class="parameter"><code>privilege</code></em>)</code>
  195. </td><td><code class="type">boolean</code></td><td>does current user have privilege for schema</td></tr><tr><td><code class="literal"><code class="function">has_sequence_privilege</code>(<em class="parameter"><code>user</code></em>,
  196. <em class="parameter"><code>sequence</code></em>,
  197. <em class="parameter"><code>privilege</code></em>)</code>
  198. </td><td><code class="type">boolean</code></td><td>does user have privilege for sequence</td></tr><tr><td><code class="literal"><code class="function">has_sequence_privilege</code>(<em class="parameter"><code>sequence</code></em>,
  199. <em class="parameter"><code>privilege</code></em>)</code>
  200. </td><td><code class="type">boolean</code></td><td>does current user have privilege for sequence</td></tr><tr><td><code class="literal"><code class="function">has_server_privilege</code>(<em class="parameter"><code>user</code></em>,
  201. <em class="parameter"><code>server</code></em>,
  202. <em class="parameter"><code>privilege</code></em>)</code>
  203. </td><td><code class="type">boolean</code></td><td>does user have privilege for foreign server</td></tr><tr><td><code class="literal"><code class="function">has_server_privilege</code>(<em class="parameter"><code>server</code></em>,
  204. <em class="parameter"><code>privilege</code></em>)</code>
  205. </td><td><code class="type">boolean</code></td><td>does current user have privilege for foreign server</td></tr><tr><td><code class="literal"><code class="function">has_table_privilege</code>(<em class="parameter"><code>user</code></em>,
  206. <em class="parameter"><code>table</code></em>,
  207. <em class="parameter"><code>privilege</code></em>)</code>
  208. </td><td><code class="type">boolean</code></td><td>does user have privilege for table</td></tr><tr><td><code class="literal"><code class="function">has_table_privilege</code>(<em class="parameter"><code>table</code></em>,
  209. <em class="parameter"><code>privilege</code></em>)</code>
  210. </td><td><code class="type">boolean</code></td><td>does current user have privilege for table</td></tr><tr><td><code class="literal"><code class="function">has_tablespace_privilege</code>(<em class="parameter"><code>user</code></em>,
  211. <em class="parameter"><code>tablespace</code></em>,
  212. <em class="parameter"><code>privilege</code></em>)</code>
  213. </td><td><code class="type">boolean</code></td><td>does user have privilege for tablespace</td></tr><tr><td><code class="literal"><code class="function">has_tablespace_privilege</code>(<em class="parameter"><code>tablespace</code></em>,
  214. <em class="parameter"><code>privilege</code></em>)</code>
  215. </td><td><code class="type">boolean</code></td><td>does current user have privilege for tablespace</td></tr><tr><td><code class="literal"><code class="function">has_type_privilege</code>(<em class="parameter"><code>user</code></em>,
  216. <em class="parameter"><code>type</code></em>,
  217. <em class="parameter"><code>privilege</code></em>)</code>
  218. </td><td><code class="type">boolean</code></td><td>does user have privilege for type</td></tr><tr><td><code class="literal"><code class="function">has_type_privilege</code>(<em class="parameter"><code>type</code></em>,
  219. <em class="parameter"><code>privilege</code></em>)</code>
  220. </td><td><code class="type">boolean</code></td><td>does current user have privilege for type</td></tr><tr><td><code class="literal"><code class="function">pg_has_role</code>(<em class="parameter"><code>user</code></em>,
  221. <em class="parameter"><code>role</code></em>,
  222. <em class="parameter"><code>privilege</code></em>)</code>
  223. </td><td><code class="type">boolean</code></td><td>does user have privilege for role</td></tr><tr><td><code class="literal"><code class="function">pg_has_role</code>(<em class="parameter"><code>role</code></em>,
  224. <em class="parameter"><code>privilege</code></em>)</code>
  225. </td><td><code class="type">boolean</code></td><td>does current user have privilege for role</td></tr><tr><td><code class="literal"><code class="function">row_security_active</code>(<em class="parameter"><code>table</code></em>)</code>
  226. </td><td><code class="type">boolean</code></td><td>does current user have row level security active for table</td></tr></tbody></table></div></div><br class="table-break" /><a id="id-1.5.8.30.51" class="indexterm"></a><a id="id-1.5.8.30.52" class="indexterm"></a><a id="id-1.5.8.30.53" class="indexterm"></a><a id="id-1.5.8.30.54" class="indexterm"></a><a id="id-1.5.8.30.55" class="indexterm"></a><a id="id-1.5.8.30.56" class="indexterm"></a><a id="id-1.5.8.30.57" class="indexterm"></a><a id="id-1.5.8.30.58" class="indexterm"></a><a id="id-1.5.8.30.59" class="indexterm"></a><a id="id-1.5.8.30.60" class="indexterm"></a><a id="id-1.5.8.30.61" class="indexterm"></a><a id="id-1.5.8.30.62" class="indexterm"></a><a id="id-1.5.8.30.63" class="indexterm"></a><a id="id-1.5.8.30.64" class="indexterm"></a><p>
  227. <code class="function">has_table_privilege</code> checks whether a user
  228. can access a table in a particular way. The user can be
  229. specified by name, by OID (<code class="literal">pg_authid.oid</code>),
  230. <code class="literal">public</code> to indicate the PUBLIC pseudo-role, or if the argument is
  231. omitted
  232. <code class="function">current_user</code> is assumed. The table can be specified
  233. by name or by OID. (Thus, there are actually six variants of
  234. <code class="function">has_table_privilege</code>, which can be distinguished by
  235. the number and types of their arguments.) When specifying by name,
  236. the name can be schema-qualified if necessary.
  237. The desired access privilege type
  238. is specified by a text string, which must evaluate to one of the
  239. values <code class="literal">SELECT</code>, <code class="literal">INSERT</code>,
  240. <code class="literal">UPDATE</code>, <code class="literal">DELETE</code>, <code class="literal">TRUNCATE</code>,
  241. <code class="literal">REFERENCES</code>, or <code class="literal">TRIGGER</code>. Optionally,
  242. <code class="literal">WITH GRANT OPTION</code> can be added to a privilege type to test
  243. whether the privilege is held with grant option. Also, multiple privilege
  244. types can be listed separated by commas, in which case the result will
  245. be <code class="literal">true</code> if any of the listed privileges is held.
  246. (Case of the privilege string is not significant, and extra whitespace
  247. is allowed between but not within privilege names.)
  248. Some examples:
  249. </p><pre class="programlisting">
  250. SELECT has_table_privilege('myschema.mytable', 'select');
  251. SELECT has_table_privilege('joe', 'mytable', 'INSERT, SELECT WITH GRANT OPTION');
  252. </pre><p>
  253. </p><p>
  254. <code class="function">has_sequence_privilege</code> checks whether a user
  255. can access a sequence in a particular way. The possibilities for its
  256. arguments are analogous to <code class="function">has_table_privilege</code>.
  257. The desired access privilege type must evaluate to one of
  258. <code class="literal">USAGE</code>,
  259. <code class="literal">SELECT</code>, or
  260. <code class="literal">UPDATE</code>.
  261. </p><p>
  262. <code class="function">has_any_column_privilege</code> checks whether a user can
  263. access any column of a table in a particular way.
  264. Its argument possibilities
  265. are analogous to <code class="function">has_table_privilege</code>,
  266. except that the desired access privilege type must evaluate to some
  267. combination of
  268. <code class="literal">SELECT</code>,
  269. <code class="literal">INSERT</code>,
  270. <code class="literal">UPDATE</code>, or
  271. <code class="literal">REFERENCES</code>. Note that having any of these privileges
  272. at the table level implicitly grants it for each column of the table,
  273. so <code class="function">has_any_column_privilege</code> will always return
  274. <code class="literal">true</code> if <code class="function">has_table_privilege</code> does for the same
  275. arguments. But <code class="function">has_any_column_privilege</code> also succeeds if
  276. there is a column-level grant of the privilege for at least one column.
  277. </p><p>
  278. <code class="function">has_column_privilege</code> checks whether a user
  279. can access a column in a particular way.
  280. Its argument possibilities
  281. are analogous to <code class="function">has_table_privilege</code>,
  282. with the addition that the column can be specified either by name
  283. or attribute number.
  284. The desired access privilege type must evaluate to some combination of
  285. <code class="literal">SELECT</code>,
  286. <code class="literal">INSERT</code>,
  287. <code class="literal">UPDATE</code>, or
  288. <code class="literal">REFERENCES</code>. Note that having any of these privileges
  289. at the table level implicitly grants it for each column of the table.
  290. </p><p>
  291. <code class="function">has_database_privilege</code> checks whether a user
  292. can access a database in a particular way.
  293. Its argument possibilities
  294. are analogous to <code class="function">has_table_privilege</code>.
  295. The desired access privilege type must evaluate to some combination of
  296. <code class="literal">CREATE</code>,
  297. <code class="literal">CONNECT</code>,
  298. <code class="literal">TEMPORARY</code>, or
  299. <code class="literal">TEMP</code> (which is equivalent to
  300. <code class="literal">TEMPORARY</code>).
  301. </p><p>
  302. <code class="function">has_function_privilege</code> checks whether a user
  303. can access a function in a particular way.
  304. Its argument possibilities
  305. are analogous to <code class="function">has_table_privilege</code>.
  306. When specifying a function by a text string rather than by OID,
  307. the allowed input is the same as for the <code class="type">regprocedure</code> data type
  308. (see <a class="xref" href="datatype-oid.html" title="8.19. Object Identifier Types">Section 8.19</a>).
  309. The desired access privilege type must evaluate to
  310. <code class="literal">EXECUTE</code>.
  311. An example is:
  312. </p><pre class="programlisting">
  313. SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
  314. </pre><p>
  315. </p><p>
  316. <code class="function">has_foreign_data_wrapper_privilege</code> checks whether a user
  317. can access a foreign-data wrapper in a particular way.
  318. Its argument possibilities
  319. are analogous to <code class="function">has_table_privilege</code>.
  320. The desired access privilege type must evaluate to
  321. <code class="literal">USAGE</code>.
  322. </p><p>
  323. <code class="function">has_language_privilege</code> checks whether a user
  324. can access a procedural language in a particular way.
  325. Its argument possibilities
  326. are analogous to <code class="function">has_table_privilege</code>.
  327. The desired access privilege type must evaluate to
  328. <code class="literal">USAGE</code>.
  329. </p><p>
  330. <code class="function">has_schema_privilege</code> checks whether a user
  331. can access a schema in a particular way.
  332. Its argument possibilities
  333. are analogous to <code class="function">has_table_privilege</code>.
  334. The desired access privilege type must evaluate to some combination of
  335. <code class="literal">CREATE</code> or
  336. <code class="literal">USAGE</code>.
  337. </p><p>
  338. <code class="function">has_server_privilege</code> checks whether a user
  339. can access a foreign server in a particular way.
  340. Its argument possibilities
  341. are analogous to <code class="function">has_table_privilege</code>.
  342. The desired access privilege type must evaluate to
  343. <code class="literal">USAGE</code>.
  344. </p><p>
  345. <code class="function">has_tablespace_privilege</code> checks whether a user
  346. can access a tablespace in a particular way.
  347. Its argument possibilities
  348. are analogous to <code class="function">has_table_privilege</code>.
  349. The desired access privilege type must evaluate to
  350. <code class="literal">CREATE</code>.
  351. </p><p>
  352. <code class="function">has_type_privilege</code> checks whether a user
  353. can access a type in a particular way.
  354. Its argument possibilities
  355. are analogous to <code class="function">has_table_privilege</code>.
  356. When specifying a type by a text string rather than by OID,
  357. the allowed input is the same as for the <code class="type">regtype</code> data type
  358. (see <a class="xref" href="datatype-oid.html" title="8.19. Object Identifier Types">Section 8.19</a>).
  359. The desired access privilege type must evaluate to
  360. <code class="literal">USAGE</code>.
  361. </p><p>
  362. <code class="function">pg_has_role</code> checks whether a user
  363. can access a role in a particular way.
  364. Its argument possibilities
  365. are analogous to <code class="function">has_table_privilege</code>,
  366. except that <code class="literal">public</code> is not allowed as a user name.
  367. The desired access privilege type must evaluate to some combination of
  368. <code class="literal">MEMBER</code> or
  369. <code class="literal">USAGE</code>.
  370. <code class="literal">MEMBER</code> denotes direct or indirect membership in
  371. the role (that is, the right to do <code class="command">SET ROLE</code>), while
  372. <code class="literal">USAGE</code> denotes whether the privileges of the role
  373. are immediately available without doing <code class="command">SET ROLE</code>.
  374. </p><p>
  375. <code class="function">row_security_active</code> checks whether row level
  376. security is active for the specified table in the context of the
  377. <code class="function">current_user</code> and environment. The table can
  378. be specified by name or by OID.
  379. </p><p>
  380. <a class="xref" href="functions-info.html#FUNCTIONS-ACLITEM-OP-TABLE" title="Table 9.65. aclitem Operators">Table 9.65</a> shows the operators
  381. available for the <code class="type">aclitem</code> type, which is the catalog
  382. representation of access privileges. See <a class="xref" href="ddl-priv.html" title="5.7. Privileges">Section 5.7</a>
  383. for information about how to read access privilege values.
  384. </p><a id="id-1.5.8.30.80" class="indexterm"></a><a id="id-1.5.8.30.81" class="indexterm"></a><a id="id-1.5.8.30.82" class="indexterm"></a><a id="id-1.5.8.30.83" class="indexterm"></a><a id="id-1.5.8.30.84" class="indexterm"></a><div class="table" id="FUNCTIONS-ACLITEM-OP-TABLE"><p class="title"><strong>Table 9.65. <code class="type">aclitem</code> Operators</strong></p><div class="table-contents"><table class="table" summary="aclitem Operators" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th>Operator</th><th>Description</th><th>Example</th><th>Result</th></tr></thead><tbody><tr><td> <code class="literal">=</code> </td><td>equal</td><td><code class="literal">'calvin=r*w/hobbes'::aclitem = 'calvin=r*w*/hobbes'::aclitem</code></td><td><code class="literal">f</code></td></tr><tr><td> <code class="literal">@&gt;</code> </td><td>contains element</td><td><code class="literal">'{calvin=r*w/hobbes,hobbes=r*w*/postgres}'::aclitem[] @&gt; 'calvin=r*w/hobbes'::aclitem</code></td><td><code class="literal">t</code></td></tr><tr><td> <code class="literal">~</code> </td><td>contains element</td><td><code class="literal">'{calvin=r*w/hobbes,hobbes=r*w*/postgres}'::aclitem[] ~ 'calvin=r*w/hobbes'::aclitem</code></td><td><code class="literal">t</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
  385. <a class="xref" href="functions-info.html#FUNCTIONS-ACLITEM-FN-TABLE" title="Table 9.66. aclitem Functions">Table 9.66</a> shows some additional
  386. functions to manage the <code class="type">aclitem</code> type.
  387. </p><div class="table" id="FUNCTIONS-ACLITEM-FN-TABLE"><p class="title"><strong>Table 9.66. <code class="type">aclitem</code> Functions</strong></p><div class="table-contents"><table class="table" summary="aclitem Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">acldefault</code>(<em class="parameter"><code>type</code></em>,
  388. <em class="parameter"><code>ownerId</code></em>)</code></td><td><code class="type">aclitem[]</code></td><td>get the default access privileges for an object belonging to <em class="parameter"><code>ownerId</code></em></td></tr><tr><td><code class="literal"><code class="function">aclexplode</code>(<em class="parameter"><code>aclitem[]</code></em>)</code></td><td><code class="type">setof record</code></td><td>get <code class="type">aclitem</code> array as tuples</td></tr><tr><td><code class="literal"><code class="function">makeaclitem</code>(<em class="parameter"><code>grantee</code></em>, <em class="parameter"><code>grantor</code></em>, <em class="parameter"><code>privilege</code></em>, <em class="parameter"><code>grantable</code></em>)</code></td><td><code class="type">aclitem</code></td><td>build an <code class="type">aclitem</code> from input</td></tr></tbody></table></div></div><br class="table-break" /><p>
  389. <code class="function">acldefault</code> returns the built-in default access
  390. privileges for an object of type <em class="parameter"><code>type</code></em> belonging to
  391. role <em class="parameter"><code>ownerId</code></em>. These represent the access
  392. privileges that will be assumed when an object's ACL entry is null.
  393. (The default access privileges are described in <a class="xref" href="ddl-priv.html" title="5.7. Privileges">Section 5.7</a>.)
  394. The <em class="parameter"><code>type</code></em> parameter is a <code class="type">CHAR</code>: write
  395. 'c' for <code class="literal">COLUMN</code>,
  396. 'r' for <code class="literal">TABLE</code> and table-like objects,
  397. 's' for <code class="literal">SEQUENCE</code>,
  398. 'd' for <code class="literal">DATABASE</code>,
  399. 'f' for <code class="literal">FUNCTION</code> or <code class="literal">PROCEDURE</code>,
  400. 'l' for <code class="literal">LANGUAGE</code>,
  401. 'L' for <code class="literal">LARGE OBJECT</code>,
  402. 'n' for <code class="literal">SCHEMA</code>,
  403. 't' for <code class="literal">TABLESPACE</code>,
  404. 'F' for <code class="literal">FOREIGN DATA WRAPPER</code>,
  405. 'S' for <code class="literal">FOREIGN SERVER</code>,
  406. or
  407. 'T' for <code class="literal">TYPE</code> or <code class="literal">DOMAIN</code>.
  408. </p><p>
  409. <code class="function">aclexplode</code> returns an <code class="type">aclitem</code> array
  410. as a set of rows. Output columns are grantor <code class="type">oid</code>,
  411. grantee <code class="type">oid</code> (<code class="literal">0</code> for <code class="literal">PUBLIC</code>),
  412. granted privilege as <code class="type">text</code> (<code class="literal">SELECT</code>, ...)
  413. and whether the privilege is grantable as <code class="type">boolean</code>.
  414. <code class="function">makeaclitem</code> performs the inverse operation.
  415. </p><p>
  416. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-SCHEMA-TABLE" title="Table 9.67. Schema Visibility Inquiry Functions">Table 9.67</a> shows functions that
  417. determine whether a certain object is <em class="firstterm">visible</em> in the
  418. current schema search path.
  419. For example, a table is said to be visible if its
  420. containing schema is in the search path and no table of the same
  421. name appears earlier in the search path. This is equivalent to the
  422. statement that the table can be referenced by name without explicit
  423. schema qualification. To list the names of all visible tables:
  424. </p><pre class="programlisting">
  425. SELECT relname FROM pg_class WHERE pg_table_is_visible(oid);
  426. </pre><p>
  427. </p><a id="id-1.5.8.30.91" class="indexterm"></a><div class="table" id="FUNCTIONS-INFO-SCHEMA-TABLE"><p class="title"><strong>Table 9.67. Schema Visibility Inquiry Functions</strong></p><div class="table-contents"><table class="table" summary="Schema Visibility Inquiry Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">pg_collation_is_visible(<em class="parameter"><code>collation_oid</code></em>)</code></code>
  428. </td><td><code class="type">boolean</code></td><td>is collation visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_conversion_is_visible(<em class="parameter"><code>conversion_oid</code></em>)</code></code>
  429. </td><td><code class="type">boolean</code></td><td>is conversion visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_function_is_visible(<em class="parameter"><code>function_oid</code></em>)</code></code>
  430. </td><td><code class="type">boolean</code></td><td>is function visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_opclass_is_visible(<em class="parameter"><code>opclass_oid</code></em>)</code></code>
  431. </td><td><code class="type">boolean</code></td><td>is operator class visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_operator_is_visible(<em class="parameter"><code>operator_oid</code></em>)</code></code>
  432. </td><td><code class="type">boolean</code></td><td>is operator visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_opfamily_is_visible(<em class="parameter"><code>opclass_oid</code></em>)</code></code>
  433. </td><td><code class="type">boolean</code></td><td>is operator family visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_statistics_obj_is_visible(<em class="parameter"><code>stat_oid</code></em>)</code></code>
  434. </td><td><code class="type">boolean</code></td><td>is statistics object visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_table_is_visible(<em class="parameter"><code>table_oid</code></em>)</code></code>
  435. </td><td><code class="type">boolean</code></td><td>is table visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_ts_config_is_visible(<em class="parameter"><code>config_oid</code></em>)</code></code>
  436. </td><td><code class="type">boolean</code></td><td>is text search configuration visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_ts_dict_is_visible(<em class="parameter"><code>dict_oid</code></em>)</code></code>
  437. </td><td><code class="type">boolean</code></td><td>is text search dictionary visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_ts_parser_is_visible(<em class="parameter"><code>parser_oid</code></em>)</code></code>
  438. </td><td><code class="type">boolean</code></td><td>is text search parser visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_ts_template_is_visible(<em class="parameter"><code>template_oid</code></em>)</code></code>
  439. </td><td><code class="type">boolean</code></td><td>is text search template visible in search path</td></tr><tr><td><code class="literal"><code class="function">pg_type_is_visible(<em class="parameter"><code>type_oid</code></em>)</code></code>
  440. </td><td><code class="type">boolean</code></td><td>is type (or domain) visible in search path</td></tr></tbody></table></div></div><br class="table-break" /><a id="id-1.5.8.30.93" class="indexterm"></a><a id="id-1.5.8.30.94" class="indexterm"></a><a id="id-1.5.8.30.95" class="indexterm"></a><a id="id-1.5.8.30.96" class="indexterm"></a><a id="id-1.5.8.30.97" class="indexterm"></a><a id="id-1.5.8.30.98" class="indexterm"></a><a id="id-1.5.8.30.99" class="indexterm"></a><a id="id-1.5.8.30.100" class="indexterm"></a><a id="id-1.5.8.30.101" class="indexterm"></a><a id="id-1.5.8.30.102" class="indexterm"></a><a id="id-1.5.8.30.103" class="indexterm"></a><a id="id-1.5.8.30.104" class="indexterm"></a><a id="id-1.5.8.30.105" class="indexterm"></a><p>
  441. Each function performs the visibility check for one type of database
  442. object. Note that <code class="function">pg_table_is_visible</code> can also be used
  443. with views, materialized views, indexes, sequences and foreign tables;
  444. <code class="function">pg_function_is_visible</code> can also be used with
  445. procedures and aggregates;
  446. <code class="function">pg_type_is_visible</code> can also be used with domains.
  447. For functions and operators, an object in
  448. the search path is visible if there is no object of the same name
  449. <span class="emphasis"><em>and argument data type(s)</em></span> earlier in the path. For operator
  450. classes, both name and associated index access method are considered.
  451. </p><p>
  452. All these functions require object OIDs to identify the object to be
  453. checked. If you want to test an object by name, it is convenient to use
  454. the OID alias types (<code class="type">regclass</code>, <code class="type">regtype</code>,
  455. <code class="type">regprocedure</code>, <code class="type">regoperator</code>, <code class="type">regconfig</code>,
  456. or <code class="type">regdictionary</code>),
  457. for example:
  458. </p><pre class="programlisting">
  459. SELECT pg_type_is_visible('myschema.widget'::regtype);
  460. </pre><p>
  461. Note that it would not make much sense to test a non-schema-qualified
  462. type name in this way — if the name can be recognized at all, it must be visible.
  463. </p><a id="id-1.5.8.30.108" class="indexterm"></a><a id="id-1.5.8.30.109" class="indexterm"></a><a id="id-1.5.8.30.110" class="indexterm"></a><a id="id-1.5.8.30.111" class="indexterm"></a><a id="id-1.5.8.30.112" class="indexterm"></a><a id="id-1.5.8.30.113" class="indexterm"></a><a id="id-1.5.8.30.114" class="indexterm"></a><a id="id-1.5.8.30.115" class="indexterm"></a><a id="id-1.5.8.30.116" class="indexterm"></a><a id="id-1.5.8.30.117" class="indexterm"></a><a id="id-1.5.8.30.118" class="indexterm"></a><a id="id-1.5.8.30.119" class="indexterm"></a><a id="id-1.5.8.30.120" class="indexterm"></a><a id="id-1.5.8.30.121" class="indexterm"></a><a id="id-1.5.8.30.122" class="indexterm"></a><a id="id-1.5.8.30.123" class="indexterm"></a><a id="id-1.5.8.30.124" class="indexterm"></a><a id="id-1.5.8.30.125" class="indexterm"></a><a id="id-1.5.8.30.126" class="indexterm"></a><a id="id-1.5.8.30.127" class="indexterm"></a><a id="id-1.5.8.30.128" class="indexterm"></a><a id="id-1.5.8.30.129" class="indexterm"></a><a id="id-1.5.8.30.130" class="indexterm"></a><a id="id-1.5.8.30.131" class="indexterm"></a><a id="id-1.5.8.30.132" class="indexterm"></a><a id="id-1.5.8.30.133" class="indexterm"></a><a id="id-1.5.8.30.134" class="indexterm"></a><a id="id-1.5.8.30.135" class="indexterm"></a><a id="id-1.5.8.30.136" class="indexterm"></a><a id="id-1.5.8.30.137" class="indexterm"></a><a id="id-1.5.8.30.138" class="indexterm"></a><p>
  464. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE" title="Table 9.68. System Catalog Information Functions">Table 9.68</a> lists functions that
  465. extract information from the system catalogs.
  466. </p><div class="table" id="FUNCTIONS-INFO-CATALOG-TABLE"><p class="title"><strong>Table 9.68. System Catalog Information Functions</strong></p><div class="table-contents"><table class="table" summary="System Catalog Information Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">format_type(<em class="parameter"><code>type_oid</code></em>, <em class="parameter"><code>typemod</code></em>)</code></code></td><td><code class="type">text</code></td><td>get SQL name of a data type</td></tr><tr><td><code class="literal"><code class="function">pg_get_constraintdef(<em class="parameter"><code>constraint_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get definition of a constraint</td></tr><tr><td><code class="literal"><code class="function">pg_get_constraintdef(<em class="parameter"><code>constraint_oid</code></em>, <em class="parameter"><code>pretty_bool</code></em>)</code></code></td><td><code class="type">text</code></td><td>get definition of a constraint</td></tr><tr><td><code class="literal"><code class="function">pg_get_expr(<em class="parameter"><code>pg_node_tree</code></em>, <em class="parameter"><code>relation_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>decompile internal form of an expression, assuming that any Vars
  467. in it refer to the relation indicated by the second parameter</td></tr><tr><td><code class="literal"><code class="function">pg_get_expr(<em class="parameter"><code>pg_node_tree</code></em>, <em class="parameter"><code>relation_oid</code></em>, <em class="parameter"><code>pretty_bool</code></em>)</code></code></td><td><code class="type">text</code></td><td>decompile internal form of an expression, assuming that any Vars
  468. in it refer to the relation indicated by the second parameter</td></tr><tr><td><code class="literal"><code class="function">pg_get_functiondef(<em class="parameter"><code>func_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get definition of a function or procedure</td></tr><tr><td><code class="literal"><code class="function">pg_get_function_arguments(<em class="parameter"><code>func_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get argument list of function's or procedure's definition (with default values)</td></tr><tr><td><code class="literal"><code class="function">pg_get_function_identity_arguments(<em class="parameter"><code>func_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get argument list to identify a function or procedure (without default values)</td></tr><tr><td><code class="literal"><code class="function">pg_get_function_result(<em class="parameter"><code>func_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get <code class="literal">RETURNS</code> clause for function (returns null for a procedure)</td></tr><tr><td><code class="literal"><code class="function">pg_get_indexdef(<em class="parameter"><code>index_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get <code class="command">CREATE INDEX</code> command for index</td></tr><tr><td><code class="literal"><code class="function">pg_get_indexdef(<em class="parameter"><code>index_oid</code></em>, <em class="parameter"><code>column_no</code></em>, <em class="parameter"><code>pretty_bool</code></em>)</code></code></td><td><code class="type">text</code></td><td>get <code class="command">CREATE INDEX</code> command for index,
  469. or definition of just one index column when
  470. <em class="parameter"><code>column_no</code></em> is not zero</td></tr><tr><td><code class="literal"><code class="function">pg_get_keywords()</code></code></td><td><code class="type">setof record</code></td><td>get list of SQL keywords and their categories</td></tr><tr><td><code class="literal"><code class="function">pg_get_ruledef(<em class="parameter"><code>rule_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get <code class="command">CREATE RULE</code> command for rule</td></tr><tr><td><code class="literal"><code class="function">pg_get_ruledef(<em class="parameter"><code>rule_oid</code></em>, <em class="parameter"><code>pretty_bool</code></em>)</code></code></td><td><code class="type">text</code></td><td>get <code class="command">CREATE RULE</code> command for rule</td></tr><tr><td><code class="literal"><code class="function">pg_get_serial_sequence(<em class="parameter"><code>table_name</code></em>, <em class="parameter"><code>column_name</code></em>)</code></code></td><td><code class="type">text</code></td><td>get name of the sequence that a serial or identity column uses</td></tr><tr><td><code class="literal"><code class="function">pg_get_statisticsobjdef(<em class="parameter"><code>statobj_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get <code class="command">CREATE STATISTICS</code> command for extended statistics object</td></tr><tr><td><code class="function">pg_get_triggerdef</code>(<em class="parameter"><code>trigger_oid</code></em>)</td><td><code class="type">text</code></td><td>get <code class="command">CREATE [ CONSTRAINT ] TRIGGER</code> command for trigger</td></tr><tr><td><code class="function">pg_get_triggerdef</code>(<em class="parameter"><code>trigger_oid</code></em>, <em class="parameter"><code>pretty_bool</code></em>)</td><td><code class="type">text</code></td><td>get <code class="command">CREATE [ CONSTRAINT ] TRIGGER</code> command for trigger</td></tr><tr><td><code class="literal"><code class="function">pg_get_userbyid(<em class="parameter"><code>role_oid</code></em>)</code></code></td><td><code class="type">name</code></td><td>get role name with given OID</td></tr><tr><td><code class="literal"><code class="function">pg_get_viewdef(<em class="parameter"><code>view_name</code></em>)</code></code></td><td><code class="type">text</code></td><td>get underlying <code class="command">SELECT</code> command for view or materialized view (<span class="emphasis"><em>deprecated</em></span>)</td></tr><tr><td><code class="literal"><code class="function">pg_get_viewdef(<em class="parameter"><code>view_name</code></em>, <em class="parameter"><code>pretty_bool</code></em>)</code></code></td><td><code class="type">text</code></td><td>get underlying <code class="command">SELECT</code> command for view or materialized view (<span class="emphasis"><em>deprecated</em></span>)</td></tr><tr><td><code class="literal"><code class="function">pg_get_viewdef(<em class="parameter"><code>view_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get underlying <code class="command">SELECT</code> command for view or materialized view</td></tr><tr><td><code class="literal"><code class="function">pg_get_viewdef(<em class="parameter"><code>view_oid</code></em>, <em class="parameter"><code>pretty_bool</code></em>)</code></code></td><td><code class="type">text</code></td><td>get underlying <code class="command">SELECT</code> command for view or materialized view</td></tr><tr><td><code class="literal"><code class="function">pg_get_viewdef(<em class="parameter"><code>view_oid</code></em>, <em class="parameter"><code>wrap_column_int</code></em>)</code></code></td><td><code class="type">text</code></td><td>get underlying <code class="command">SELECT</code> command for view or
  471. materialized view; lines with fields are wrapped to specified
  472. number of columns, pretty-printing is implied</td></tr><tr><td><code class="literal"><code class="function">pg_index_column_has_property(<em class="parameter"><code>index_oid</code></em>, <em class="parameter"><code>column_no</code></em>, <em class="parameter"><code>prop_name</code></em>)</code></code></td><td><code class="type">boolean</code></td><td>test whether an index column has a specified property</td></tr><tr><td><code class="literal"><code class="function">pg_index_has_property(<em class="parameter"><code>index_oid</code></em>, <em class="parameter"><code>prop_name</code></em>)</code></code></td><td><code class="type">boolean</code></td><td>test whether an index has a specified property</td></tr><tr><td><code class="literal"><code class="function">pg_indexam_has_property(<em class="parameter"><code>am_oid</code></em>, <em class="parameter"><code>prop_name</code></em>)</code></code></td><td><code class="type">boolean</code></td><td>test whether an index access method has a specified property</td></tr><tr><td><code class="literal"><code class="function">pg_options_to_table(<em class="parameter"><code>reloptions</code></em>)</code></code></td><td><code class="type">setof record</code></td><td>get the set of storage option name/value pairs</td></tr><tr><td><code class="literal"><code class="function">pg_tablespace_databases(<em class="parameter"><code>tablespace_oid</code></em>)</code></code></td><td><code class="type">setof oid</code></td><td>get the set of database OIDs that have objects in the tablespace</td></tr><tr><td><code class="literal"><code class="function">pg_tablespace_location(<em class="parameter"><code>tablespace_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get the path in the file system that this tablespace is located in</td></tr><tr><td><code class="literal"><code class="function">pg_typeof(<em class="parameter"><code>any</code></em>)</code></code></td><td><code class="type">regtype</code></td><td>get the data type of any value</td></tr><tr><td><code class="literal"><code class="function">collation for (<em class="parameter"><code>any</code></em>)</code></code></td><td><code class="type">text</code></td><td>get the collation of the argument</td></tr><tr><td><code class="literal"><code class="function">to_regclass(<em class="parameter"><code>rel_name</code></em>)</code></code></td><td><code class="type">regclass</code></td><td>get the OID of the named relation</td></tr><tr><td><code class="literal"><code class="function">to_regproc(<em class="parameter"><code>func_name</code></em>)</code></code></td><td><code class="type">regproc</code></td><td>get the OID of the named function</td></tr><tr><td><code class="literal"><code class="function">to_regprocedure(<em class="parameter"><code>func_name</code></em>)</code></code></td><td><code class="type">regprocedure</code></td><td>get the OID of the named function</td></tr><tr><td><code class="literal"><code class="function">to_regoper(<em class="parameter"><code>operator_name</code></em>)</code></code></td><td><code class="type">regoper</code></td><td>get the OID of the named operator</td></tr><tr><td><code class="literal"><code class="function">to_regoperator(<em class="parameter"><code>operator_name</code></em>)</code></code></td><td><code class="type">regoperator</code></td><td>get the OID of the named operator</td></tr><tr><td><code class="literal"><code class="function">to_regtype(<em class="parameter"><code>type_name</code></em>)</code></code></td><td><code class="type">regtype</code></td><td>get the OID of the named type</td></tr><tr><td><code class="literal"><code class="function">to_regnamespace(<em class="parameter"><code>schema_name</code></em>)</code></code></td><td><code class="type">regnamespace</code></td><td>get the OID of the named schema</td></tr><tr><td><code class="literal"><code class="function">to_regrole(<em class="parameter"><code>role_name</code></em>)</code></code></td><td><code class="type">regrole</code></td><td>get the OID of the named role</td></tr></tbody></table></div></div><br class="table-break" /><p>
  473. <code class="function">format_type</code> returns the SQL name of a data type that
  474. is identified by its type OID and possibly a type modifier. Pass NULL
  475. for the type modifier if no specific modifier is known.
  476. </p><p>
  477. <code class="function">pg_get_keywords</code> returns a set of records describing
  478. the SQL keywords recognized by the server. The <code class="structfield">word</code> column
  479. contains the keyword. The <code class="structfield">catcode</code> column contains a
  480. category code: <code class="literal">U</code> for unreserved, <code class="literal">C</code> for column name,
  481. <code class="literal">T</code> for type or function name, or <code class="literal">R</code> for reserved.
  482. The <code class="structfield">catdesc</code> column contains a possibly-localized string
  483. describing the category.
  484. </p><p>
  485. <code class="function">pg_get_constraintdef</code>,
  486. <code class="function">pg_get_indexdef</code>, <code class="function">pg_get_ruledef</code>,
  487. <code class="function">pg_get_statisticsobjdef</code>, and
  488. <code class="function">pg_get_triggerdef</code>, respectively reconstruct the
  489. creating command for a constraint, index, rule, extended statistics object,
  490. or trigger. (Note that this is a decompiled reconstruction, not the
  491. original text of the command.) <code class="function">pg_get_expr</code> decompiles
  492. the internal form of an individual expression, such as the default value
  493. for a column. It can be useful when examining the contents of system
  494. catalogs. If the expression might contain Vars, specify the OID of the
  495. relation they refer to as the second parameter; if no Vars are expected,
  496. zero is sufficient. <code class="function">pg_get_viewdef</code> reconstructs the
  497. <code class="command">SELECT</code> query that defines a view. Most of these functions come
  498. in two variants, one of which can optionally <span class="quote">“<span class="quote">pretty-print</span>”</span> the
  499. result. The pretty-printed format is more readable, but the default format
  500. is more likely to be interpreted the same way by future versions of
  501. <span class="productname">PostgreSQL</span>; avoid using pretty-printed output for dump
  502. purposes. Passing <code class="literal">false</code> for the pretty-print parameter yields
  503. the same result as the variant that does not have the parameter at all.
  504. </p><p>
  505. <code class="function">pg_get_functiondef</code> returns a complete
  506. <code class="command">CREATE OR REPLACE FUNCTION</code> statement for a function.
  507. <code class="function">pg_get_function_arguments</code> returns the argument list
  508. of a function, in the form it would need to appear in within
  509. <code class="command">CREATE FUNCTION</code>.
  510. <code class="function">pg_get_function_result</code> similarly returns the
  511. appropriate <code class="literal">RETURNS</code> clause for the function.
  512. <code class="function">pg_get_function_identity_arguments</code> returns the
  513. argument list necessary to identify a function, in the form it
  514. would need to appear in within <code class="command">ALTER FUNCTION</code>, for
  515. instance. This form omits default values.
  516. </p><p>
  517. <code class="function">pg_get_serial_sequence</code> returns the name of the
  518. sequence associated with a column, or NULL if no sequence is associated
  519. with the column. If the column is an identity column, the associated
  520. sequence is the sequence internally created for the identity column. For
  521. columns created using one of the serial types
  522. (<code class="type">serial</code>, <code class="type">smallserial</code>, <code class="type">bigserial</code>), it
  523. is the sequence created for that serial column definition. In the latter
  524. case, this association can be modified or removed with <code class="command">ALTER
  525. SEQUENCE OWNED BY</code>. (The function probably should have been called
  526. <code class="function">pg_get_owned_sequence</code>; its current name reflects the
  527. fact that it has typically been used with <code class="type">serial</code>
  528. or <code class="type">bigserial</code> columns.) The first input parameter is a table name
  529. with optional schema, and the second parameter is a column name. Because
  530. the first parameter is potentially a schema and table, it is not treated as
  531. a double-quoted identifier, meaning it is lower cased by default, while the
  532. second parameter, being just a column name, is treated as double-quoted and
  533. has its case preserved. The function returns a value suitably formatted
  534. for passing to sequence functions
  535. (see <a class="xref" href="functions-sequence.html" title="9.16. Sequence Manipulation Functions">Section 9.16</a>). A typical use is in reading the
  536. current value of a sequence for an identity or serial column, for example:
  537. </p><pre class="programlisting">
  538. SELECT currval(pg_get_serial_sequence('sometable', 'id'));
  539. </pre><p>
  540. </p><p>
  541. <code class="function">pg_get_userbyid</code> extracts a role's name given
  542. its OID.
  543. </p><p>
  544. <code class="function">pg_index_column_has_property</code>,
  545. <code class="function">pg_index_has_property</code>, and
  546. <code class="function">pg_indexam_has_property</code> return whether the
  547. specified index column, index, or index access method possesses the named
  548. property. <code class="literal">NULL</code> is returned if the property name is not
  549. known or does not apply to the particular object, or if the OID or column
  550. number does not identify a valid object. Refer to
  551. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-INDEX-COLUMN-PROPS" title="Table 9.69. Index Column Properties">Table 9.69</a> for column properties,
  552. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-INDEX-PROPS" title="Table 9.70. Index Properties">Table 9.70</a> for index properties, and
  553. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-INDEXAM-PROPS" title="Table 9.71. Index Access Method Properties">Table 9.71</a> for access method properties.
  554. (Note that extension access methods can define additional property names
  555. for their indexes.)
  556. </p><div class="table" id="FUNCTIONS-INFO-INDEX-COLUMN-PROPS"><p class="title"><strong>Table 9.69. Index Column Properties</strong></p><div class="table-contents"><table class="table" summary="Index Column Properties" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">asc</code></td><td>Does the column sort in ascending order on a forward scan?
  557. </td></tr><tr><td><code class="literal">desc</code></td><td>Does the column sort in descending order on a forward scan?
  558. </td></tr><tr><td><code class="literal">nulls_first</code></td><td>Does the column sort with nulls first on a forward scan?
  559. </td></tr><tr><td><code class="literal">nulls_last</code></td><td>Does the column sort with nulls last on a forward scan?
  560. </td></tr><tr><td><code class="literal">orderable</code></td><td>Does the column possess any defined sort ordering?
  561. </td></tr><tr><td><code class="literal">distance_orderable</code></td><td>Can the column be scanned in order by a <span class="quote">“<span class="quote">distance</span>”</span>
  562. operator, for example <code class="literal">ORDER BY col &lt;-&gt; constant</code> ?
  563. </td></tr><tr><td><code class="literal">returnable</code></td><td>Can the column value be returned by an index-only scan?
  564. </td></tr><tr><td><code class="literal">search_array</code></td><td>Does the column natively support <code class="literal">col = ANY(array)</code>
  565. searches?
  566. </td></tr><tr><td><code class="literal">search_nulls</code></td><td>Does the column support <code class="literal">IS NULL</code> and
  567. <code class="literal">IS NOT NULL</code> searches?
  568. </td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="FUNCTIONS-INFO-INDEX-PROPS"><p class="title"><strong>Table 9.70. Index Properties</strong></p><div class="table-contents"><table class="table" summary="Index Properties" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">clusterable</code></td><td>Can the index be used in a <code class="literal">CLUSTER</code> command?
  569. </td></tr><tr><td><code class="literal">index_scan</code></td><td>Does the index support plain (non-bitmap) scans?
  570. </td></tr><tr><td><code class="literal">bitmap_scan</code></td><td>Does the index support bitmap scans?
  571. </td></tr><tr><td><code class="literal">backward_scan</code></td><td>Can the scan direction be changed in mid-scan (to
  572. support <code class="literal">FETCH BACKWARD</code> on a cursor without
  573. needing materialization)?
  574. </td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="FUNCTIONS-INFO-INDEXAM-PROPS"><p class="title"><strong>Table 9.71. Index Access Method Properties</strong></p><div class="table-contents"><table class="table" summary="Index Access Method Properties" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">can_order</code></td><td>Does the access method support <code class="literal">ASC</code>,
  575. <code class="literal">DESC</code> and related keywords in
  576. <code class="literal">CREATE INDEX</code>?
  577. </td></tr><tr><td><code class="literal">can_unique</code></td><td>Does the access method support unique indexes?
  578. </td></tr><tr><td><code class="literal">can_multi_col</code></td><td>Does the access method support indexes with multiple columns?
  579. </td></tr><tr><td><code class="literal">can_exclude</code></td><td>Does the access method support exclusion constraints?
  580. </td></tr><tr><td><code class="literal">can_include</code></td><td>Does the access method support the <code class="literal">INCLUDE</code>
  581. clause of <code class="literal">CREATE INDEX</code>?
  582. </td></tr></tbody></table></div></div><br class="table-break" /><p>
  583. <code class="function">pg_options_to_table</code> returns the set of storage
  584. option name/value pairs
  585. (<em class="replaceable"><code>option_name</code></em>/<em class="replaceable"><code>option_value</code></em>) when passed
  586. <code class="structname">pg_class</code>.<code class="structfield">reloptions</code> or
  587. <code class="structname">pg_attribute</code>.<code class="structfield">attoptions</code>.
  588. </p><p>
  589. <code class="function">pg_tablespace_databases</code> allows a tablespace to be
  590. examined. It returns the set of OIDs of databases that have objects stored
  591. in the tablespace. If this function returns any rows, the tablespace is not
  592. empty and cannot be dropped. To display the specific objects populating the
  593. tablespace, you will need to connect to the databases identified by
  594. <code class="function">pg_tablespace_databases</code> and query their
  595. <code class="structname">pg_class</code> catalogs.
  596. </p><p>
  597. <code class="function">pg_typeof</code> returns the OID of the data type of the
  598. value that is passed to it. This can be helpful for troubleshooting or
  599. dynamically constructing SQL queries. The function is declared as
  600. returning <code class="type">regtype</code>, which is an OID alias type (see
  601. <a class="xref" href="datatype-oid.html" title="8.19. Object Identifier Types">Section 8.19</a>); this means that it is the same as an
  602. OID for comparison purposes but displays as a type name. For example:
  603. </p><pre class="programlisting">
  604. SELECT pg_typeof(33);
  605. pg_typeof
  606. -----------
  607. integer
  608. (1 row)
  609. SELECT typlen FROM pg_type WHERE oid = pg_typeof(33);
  610. typlen
  611. --------
  612. 4
  613. (1 row)
  614. </pre><p>
  615. </p><p>
  616. The expression <code class="literal">collation for</code> returns the collation of the
  617. value that is passed to it. Example:
  618. </p><pre class="programlisting">
  619. SELECT collation for (description) FROM pg_description LIMIT 1;
  620. pg_collation_for
  621. ------------------
  622. "default"
  623. (1 row)
  624. SELECT collation for ('foo' COLLATE "de_DE");
  625. pg_collation_for
  626. ------------------
  627. "de_DE"
  628. (1 row)
  629. </pre><p>
  630. The value might be quoted and schema-qualified. If no collation is derived
  631. for the argument expression, then a null value is returned. If the argument
  632. is not of a collatable data type, then an error is raised.
  633. </p><p>
  634. The <code class="function">to_regclass</code>, <code class="function">to_regproc</code>,
  635. <code class="function">to_regprocedure</code>, <code class="function">to_regoper</code>,
  636. <code class="function">to_regoperator</code>, <code class="function">to_regtype</code>,
  637. <code class="function">to_regnamespace</code>, and <code class="function">to_regrole</code>
  638. functions translate relation, function, operator, type, schema, and role
  639. names (given as <code class="type">text</code>) to objects of
  640. type <code class="type">regclass</code>, <code class="type">regproc</code>, <code class="type">regprocedure</code>,
  641. <code class="type">regoper</code>, <code class="type">regoperator</code>, <code class="type">regtype</code>,
  642. <code class="type">regnamespace</code>, and <code class="type">regrole</code>
  643. respectively. These functions differ from a cast from
  644. text in that they don't accept a numeric OID, and that they return null
  645. rather than throwing an error if the name is not found (or, for
  646. <code class="function">to_regproc</code> and <code class="function">to_regoper</code>, if
  647. the given name matches multiple objects).
  648. </p><a id="id-1.5.8.30.156" class="indexterm"></a><a id="id-1.5.8.30.157" class="indexterm"></a><a id="id-1.5.8.30.158" class="indexterm"></a><a id="id-1.5.8.30.159" class="indexterm"></a><p>
  649. <a class="xref" href="functions-info.html#FUNCTIONS-INFO-OBJECT-TABLE" title="Table 9.72. Object Information and Addressing Functions">Table 9.72</a> lists functions related to
  650. database object identification and addressing.
  651. </p><div class="table" id="FUNCTIONS-INFO-OBJECT-TABLE"><p class="title"><strong>Table 9.72. Object Information and Addressing Functions</strong></p><div class="table-contents"><table class="table" summary="Object Information and Addressing Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">pg_describe_object(<em class="parameter"><code>classid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objsubid</code></em> <code class="type">integer</code>)</code></code></td><td><code class="type">text</code></td><td>get description of a database object</td></tr><tr><td><code class="literal"><code class="function">pg_identify_object(<em class="parameter"><code>classid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objsubid</code></em> <code class="type">integer</code>)</code></code></td><td><em class="parameter"><code>type</code></em> <code class="type">text</code>, <em class="parameter"><code>schema</code></em> <code class="type">text</code>, <em class="parameter"><code>name</code></em> <code class="type">text</code>, <em class="parameter"><code>identity</code></em> <code class="type">text</code></td><td>get identity of a database object</td></tr><tr><td><code class="literal"><code class="function">pg_identify_object_as_address(<em class="parameter"><code>classid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objsubid</code></em> <code class="type">integer</code>)</code></code></td><td><em class="parameter"><code>type</code></em> <code class="type">text</code>, <em class="parameter"><code>object_names</code></em> <code class="type">text[]</code>, <em class="parameter"><code>object_args</code></em> <code class="type">text[]</code></td><td>get external representation of a database object's address</td></tr><tr><td><code class="literal"><code class="function">pg_get_object_address(<em class="parameter"><code>type</code></em> <code class="type">text</code>, <em class="parameter"><code>object_names</code></em> <code class="type">text[]</code>, <em class="parameter"><code>object_args</code></em> <code class="type">text[]</code>)</code></code></td><td><em class="parameter"><code>classid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objid</code></em> <code class="type">oid</code>, <em class="parameter"><code>objsubid</code></em> <code class="type">integer</code></td><td>get address of a database object from its external representation</td></tr></tbody></table></div></div><br class="table-break" /><p>
  652. <code class="function">pg_describe_object</code> returns a textual description of a database
  653. object specified by catalog OID, object OID, and sub-object ID (such as
  654. a column number within a table; the sub-object ID is zero when referring
  655. to a whole object).
  656. This description is intended to be human-readable, and might be translated,
  657. depending on server configuration.
  658. This is useful to determine the identity of an object as stored in the
  659. <code class="structname">pg_depend</code> catalog.
  660. </p><p>
  661. <code class="function">pg_identify_object</code> returns a row containing enough information
  662. to uniquely identify the database object specified by catalog OID, object OID and
  663. sub-object ID. This information is intended to be machine-readable,
  664. and is never translated.
  665. <em class="parameter"><code>type</code></em> identifies the type of database object;
  666. <em class="parameter"><code>schema</code></em> is the schema name that the object belongs in, or
  667. <code class="literal">NULL</code> for object types that do not belong to schemas;
  668. <em class="parameter"><code>name</code></em> is the name of the object, quoted if necessary,
  669. if the name (along with schema name, if pertinent) is sufficient to
  670. uniquely identify the object, otherwise <code class="literal">NULL</code>;
  671. <em class="parameter"><code>identity</code></em> is the complete object identity, with the
  672. precise format depending on object type, and each name within the format
  673. being schema-qualified and quoted as necessary.
  674. </p><p>
  675. <code class="function">pg_identify_object_as_address</code> returns a row containing
  676. enough information to uniquely identify the database object specified by
  677. catalog OID, object OID and sub-object ID. The returned
  678. information is independent of the current server, that is, it could be used
  679. to identify an identically named object in another server.
  680. <em class="parameter"><code>type</code></em> identifies the type of database object;
  681. <em class="parameter"><code>object_names</code></em> and <em class="parameter"><code>object_args</code></em>
  682. are text arrays that together form a reference to the object.
  683. These three values can be passed to
  684. <code class="function">pg_get_object_address</code> to obtain the internal address
  685. of the object.
  686. This function is the inverse of <code class="function">pg_get_object_address</code>.
  687. </p><p>
  688. <code class="function">pg_get_object_address</code> returns a row containing enough
  689. information to uniquely identify the database object specified by its
  690. type and object name and argument arrays. The returned values are the
  691. ones that would be used in system catalogs such as <code class="structname">pg_depend</code>
  692. and can be passed to other system functions such as
  693. <code class="function">pg_identify_object</code> or <code class="function">pg_describe_object</code>.
  694. <em class="parameter"><code>classid</code></em> is the OID of the system catalog containing the
  695. object;
  696. <em class="parameter"><code>objid</code></em> is the OID of the object itself, and
  697. <em class="parameter"><code>objsubid</code></em> is the sub-object ID, or zero if none.
  698. This function is the inverse of <code class="function">pg_identify_object_as_address</code>.
  699. </p><a id="id-1.5.8.30.166" class="indexterm"></a><a id="id-1.5.8.30.167" class="indexterm"></a><a id="id-1.5.8.30.168" class="indexterm"></a><a id="id-1.5.8.30.169" class="indexterm"></a><p>
  700. The functions shown in <a class="xref" href="functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE" title="Table 9.73. Comment Information Functions">Table 9.73</a>
  701. extract comments previously stored with the <a class="xref" href="sql-comment.html" title="COMMENT"><span class="refentrytitle">COMMENT</span></a>
  702. command. A null value is returned if no
  703. comment could be found for the specified parameters.
  704. </p><div class="table" id="FUNCTIONS-INFO-COMMENT-TABLE"><p class="title"><strong>Table 9.73. Comment Information Functions</strong></p><div class="table-contents"><table class="table" summary="Comment Information Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">col_description(<em class="parameter"><code>table_oid</code></em>, <em class="parameter"><code>column_number</code></em>)</code></code></td><td><code class="type">text</code></td><td>get comment for a table column</td></tr><tr><td><code class="literal"><code class="function">obj_description(<em class="parameter"><code>object_oid</code></em>, <em class="parameter"><code>catalog_name</code></em>)</code></code></td><td><code class="type">text</code></td><td>get comment for a database object</td></tr><tr><td><code class="literal"><code class="function">obj_description(<em class="parameter"><code>object_oid</code></em>)</code></code></td><td><code class="type">text</code></td><td>get comment for a database object (<span class="emphasis"><em>deprecated</em></span>)</td></tr><tr><td><code class="literal"><code class="function">shobj_description(<em class="parameter"><code>object_oid</code></em>, <em class="parameter"><code>catalog_name</code></em>)</code></code></td><td><code class="type">text</code></td><td>get comment for a shared database object</td></tr></tbody></table></div></div><br class="table-break" /><p>
  705. <code class="function">col_description</code> returns the comment for a table
  706. column, which is specified by the OID of its table and its column number.
  707. (<code class="function">obj_description</code> cannot be used for table columns
  708. since columns do not have OIDs of their own.)
  709. </p><p>
  710. The two-parameter form of <code class="function">obj_description</code> returns the
  711. comment for a database object specified by its OID and the name of the
  712. containing system catalog. For example,
  713. <code class="literal">obj_description(123456,'pg_class')</code>
  714. would retrieve the comment for the table with OID 123456.
  715. The one-parameter form of <code class="function">obj_description</code> requires only
  716. the object OID. It is deprecated since there is no guarantee that
  717. OIDs are unique across different system catalogs; therefore, the wrong
  718. comment might be returned.
  719. </p><p>
  720. <code class="function">shobj_description</code> is used just like
  721. <code class="function">obj_description</code> except it is used for retrieving
  722. comments on shared objects. Some system catalogs are global to all
  723. databases within each cluster, and the descriptions for objects in them
  724. are stored globally as well.
  725. </p><a id="id-1.5.8.30.175" class="indexterm"></a><a id="id-1.5.8.30.176" class="indexterm"></a><a id="id-1.5.8.30.177" class="indexterm"></a><a id="id-1.5.8.30.178" class="indexterm"></a><a id="id-1.5.8.30.179" class="indexterm"></a><a id="id-1.5.8.30.180" class="indexterm"></a><a id="id-1.5.8.30.181" class="indexterm"></a><a id="id-1.5.8.30.182" class="indexterm"></a><p>
  726. The functions shown in <a class="xref" href="functions-info.html#FUNCTIONS-TXID-SNAPSHOT" title="Table 9.74. Transaction IDs and Snapshots">Table 9.74</a>
  727. provide server transaction information in an exportable form. The main
  728. use of these functions is to determine which transactions were committed
  729. between two snapshots.
  730. </p><div class="table" id="FUNCTIONS-TXID-SNAPSHOT"><p class="title"><strong>Table 9.74. Transaction IDs and Snapshots</strong></p><div class="table-contents"><table class="table" summary="Transaction IDs and Snapshots" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal"><code class="function">txid_current()</code></code></td><td><code class="type">bigint</code></td><td>get current transaction ID, assigning a new one if the current transaction does not have one</td></tr><tr><td><code class="literal"><code class="function">txid_current_if_assigned()</code></code></td><td><code class="type">bigint</code></td><td>same as <code class="function">txid_current()</code> but returns null instead of assigning a new transaction ID if none is already assigned</td></tr><tr><td><code class="literal"><code class="function">txid_current_snapshot()</code></code></td><td><code class="type">txid_snapshot</code></td><td>get current snapshot</td></tr><tr><td><code class="literal"><code class="function">txid_snapshot_xip(<em class="parameter"><code>txid_snapshot</code></em>)</code></code></td><td><code class="type">setof bigint</code></td><td>get in-progress transaction IDs in snapshot</td></tr><tr><td><code class="literal"><code class="function">txid_snapshot_xmax(<em class="parameter"><code>txid_snapshot</code></em>)</code></code></td><td><code class="type">bigint</code></td><td>get <code class="literal">xmax</code> of snapshot</td></tr><tr><td><code class="literal"><code class="function">txid_snapshot_xmin(<em class="parameter"><code>txid_snapshot</code></em>)</code></code></td><td><code class="type">bigint</code></td><td>get <code class="literal">xmin</code> of snapshot</td></tr><tr><td><code class="literal"><code class="function">txid_visible_in_snapshot(<em class="parameter"><code>bigint</code></em>, <em class="parameter"><code>txid_snapshot</code></em>)</code></code></td><td><code class="type">boolean</code></td><td>is transaction ID visible in snapshot? (do not use with subtransaction ids)</td></tr><tr><td><code class="literal"><code class="function">txid_status(<em class="parameter"><code>bigint</code></em>)</code></code></td><td><code class="type">text</code></td><td>report the status of the given transaction: <code class="literal">committed</code>, <code class="literal">aborted</code>, <code class="literal">in progress</code>, or null if the transaction ID is too old</td></tr></tbody></table></div></div><br class="table-break" /><p>
  731. The internal transaction ID type (<code class="type">xid</code>) is 32 bits wide and
  732. wraps around every 4 billion transactions. However, these functions
  733. export a 64-bit format that is extended with an <span class="quote">“<span class="quote">epoch</span>”</span> counter
  734. so it will not wrap around during the life of an installation.
  735. The data type used by these functions, <code class="type">txid_snapshot</code>,
  736. stores information about transaction ID
  737. visibility at a particular moment in time. Its components are
  738. described in <a class="xref" href="functions-info.html#FUNCTIONS-TXID-SNAPSHOT-PARTS" title="Table 9.75. Snapshot Components">Table 9.75</a>.
  739. </p><div class="table" id="FUNCTIONS-TXID-SNAPSHOT-PARTS"><p class="title"><strong>Table 9.75. Snapshot Components</strong></p><div class="table-contents"><table class="table" summary="Snapshot Components" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code class="type">xmin</code></td><td>
  740. Earliest transaction ID (txid) that is still active. All earlier
  741. transactions will either be committed and visible, or rolled
  742. back and dead.
  743. </td></tr><tr><td><code class="type">xmax</code></td><td>
  744. First as-yet-unassigned txid. All txids greater than or equal to this
  745. are not yet started as of the time of the snapshot, and thus invisible.
  746. </td></tr><tr><td><code class="type">xip_list</code></td><td>
  747. Active txids at the time of the snapshot. The list
  748. includes only those active txids between <code class="literal">xmin</code>
  749. and <code class="literal">xmax</code>; there might be active txids higher
  750. than <code class="literal">xmax</code>. A txid that is <code class="literal">xmin &lt;= txid &lt;
  751. xmax</code> and not in this list was already completed
  752. at the time of the snapshot, and thus either visible or
  753. dead according to its commit status. The list does not
  754. include txids of subtransactions.
  755. </td></tr></tbody></table></div></div><br class="table-break" /><p>
  756. <code class="type">txid_snapshot</code>'s textual representation is
  757. <code class="literal"><em class="replaceable"><code>xmin</code></em>:<em class="replaceable"><code>xmax</code></em>:<em class="replaceable"><code>xip_list</code></em></code>.
  758. For example <code class="literal">10:20:10,14,15</code> means
  759. <code class="literal">xmin=10, xmax=20, xip_list=10, 14, 15</code>.
  760. </p><p>
  761. <code class="function">txid_status(bigint)</code> reports the commit status of a recent
  762. transaction. Applications may use it to determine whether a transaction
  763. committed or aborted when the application and database server become
  764. disconnected while a <code class="literal">COMMIT</code> is in progress.
  765. The status of a transaction will be reported as either
  766. <code class="literal">in progress</code>,
  767. <code class="literal">committed</code>, or <code class="literal">aborted</code>, provided that the
  768. transaction is recent enough that the system retains the commit status
  769. of that transaction. If is old enough that no references to that
  770. transaction survive in the system and the commit status information has
  771. been discarded, this function will return NULL. Note that prepared
  772. transactions are reported as <code class="literal">in progress</code>; applications must
  773. check <a class="link" href="view-pg-prepared-xacts.html" title="51.78. pg_prepared_xacts"><code class="literal">pg_prepared_xacts</code></a> if they
  774. need to determine whether the txid is a prepared transaction.
  775. </p><p>
  776. The functions shown in <a class="xref" href="functions-info.html#FUNCTIONS-COMMIT-TIMESTAMP" title="Table 9.76. Committed Transaction Information">Table 9.76</a>
  777. provide information about transactions that have been already committed.
  778. These functions mainly provide information about when the transactions
  779. were committed. They only provide useful data when
  780. <a class="xref" href="runtime-config-replication.html#GUC-TRACK-COMMIT-TIMESTAMP">track_commit_timestamp</a> configuration option is enabled
  781. and only for transactions that were committed after it was enabled.
  782. </p><div class="table" id="FUNCTIONS-COMMIT-TIMESTAMP"><p class="title"><strong>Table 9.76. Committed Transaction Information</strong></p><div class="table-contents"><table class="table" summary="Committed Transaction Information" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td>
  783. <a id="id-1.5.8.30.190.2.2.1.1.1" class="indexterm"></a>
  784. <code class="literal"><code class="function">pg_xact_commit_timestamp(<em class="parameter"><code>xid</code></em>)</code></code>
  785. </td><td><code class="type">timestamp with time zone</code></td><td>get commit timestamp of a transaction</td></tr><tr><td>
  786. <a id="id-1.5.8.30.190.2.2.2.1.1" class="indexterm"></a>
  787. <code class="literal"><code class="function">pg_last_committed_xact()</code></code>
  788. </td><td><em class="parameter"><code>xid</code></em> <code class="type">xid</code>, <em class="parameter"><code>timestamp</code></em> <code class="type">timestamp with time zone</code></td><td>get transaction ID and commit timestamp of latest committed transaction</td></tr></tbody></table></div></div><br class="table-break" /><p>
  789. The functions shown in <a class="xref" href="functions-info.html#FUNCTIONS-CONTROLDATA" title="Table 9.77. Control Data Functions">Table 9.77</a>
  790. print information initialized during <code class="command">initdb</code>, such
  791. as the catalog version. They also show information about write-ahead
  792. logging and checkpoint processing. This information is cluster-wide,
  793. and not specific to any one database. They provide most of the same
  794. information, from the same source, as
  795. <a class="xref" href="app-pgcontroldata.html" title="pg_controldata"><span class="refentrytitle"><span class="application">pg_controldata</span></span></a>, although in a form better suited
  796. to <acronym class="acronym">SQL</acronym> functions.
  797. </p><div class="table" id="FUNCTIONS-CONTROLDATA"><p class="title"><strong>Table 9.77. Control Data Functions</strong></p><div class="table-contents"><table class="table" summary="Control Data Functions" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td>
  798. <a id="id-1.5.8.30.192.2.2.1.1.1" class="indexterm"></a>
  799. <code class="literal"><code class="function">pg_control_checkpoint()</code></code>
  800. </td><td><code class="type">record</code></td><td>
  801. Returns information about current checkpoint state.
  802. </td></tr><tr><td>
  803. <a id="id-1.5.8.30.192.2.2.2.1.1" class="indexterm"></a>
  804. <code class="literal"><code class="function">pg_control_system()</code></code>
  805. </td><td><code class="type">record</code></td><td>
  806. Returns information about current control file state.
  807. </td></tr><tr><td>
  808. <a id="id-1.5.8.30.192.2.2.3.1.1" class="indexterm"></a>
  809. <code class="literal"><code class="function">pg_control_init()</code></code>
  810. </td><td><code class="type">record</code></td><td>
  811. Returns information about cluster initialization state.
  812. </td></tr><tr><td>
  813. <a id="id-1.5.8.30.192.2.2.4.1.1" class="indexterm"></a>
  814. <code class="literal"><code class="function">pg_control_recovery()</code></code>
  815. </td><td><code class="type">record</code></td><td>
  816. Returns information about recovery state.
  817. </td></tr></tbody></table></div></div><br class="table-break" /><p>
  818. <code class="function">pg_control_checkpoint</code> returns a record, shown in
  819. <a class="xref" href="functions-info.html#FUNCTIONS-PG-CONTROL-CHECKPOINT" title="Table 9.78. pg_control_checkpoint Columns">Table 9.78</a>
  820. </p><div class="table" id="FUNCTIONS-PG-CONTROL-CHECKPOINT"><p class="title"><strong>Table 9.78. <code class="function">pg_control_checkpoint</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_control_checkpoint Columns" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Column Name</th><th>Data Type</th></tr></thead><tbody><tr><td><code class="literal">checkpoint_lsn</code></td><td><code class="type">pg_lsn</code></td></tr><tr><td><code class="literal">redo_lsn</code></td><td><code class="type">pg_lsn</code></td></tr><tr><td><code class="literal">redo_wal_file</code></td><td><code class="type">text</code></td></tr><tr><td><code class="literal">timeline_id</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">prev_timeline_id</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">full_page_writes</code></td><td><code class="type">boolean</code></td></tr><tr><td><code class="literal">next_xid</code></td><td><code class="type">text</code></td></tr><tr><td><code class="literal">next_oid</code></td><td><code class="type">oid</code></td></tr><tr><td><code class="literal">next_multixact_id</code></td><td><code class="type">xid</code></td></tr><tr><td><code class="literal">next_multi_offset</code></td><td><code class="type">xid</code></td></tr><tr><td><code class="literal">oldest_xid</code></td><td><code class="type">xid</code></td></tr><tr><td><code class="literal">oldest_xid_dbid</code></td><td><code class="type">oid</code></td></tr><tr><td><code class="literal">oldest_active_xid</code></td><td><code class="type">xid</code></td></tr><tr><td><code class="literal">oldest_multi_xid</code></td><td><code class="type">xid</code></td></tr><tr><td><code class="literal">oldest_multi_dbid</code></td><td><code class="type">oid</code></td></tr><tr><td><code class="literal">oldest_commit_ts_xid</code></td><td><code class="type">xid</code></td></tr><tr><td><code class="literal">newest_commit_ts_xid</code></td><td><code class="type">xid</code></td></tr><tr><td><code class="literal">checkpoint_time</code></td><td><code class="type">timestamp with time zone</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
  821. <code class="function">pg_control_system</code> returns a record, shown in
  822. <a class="xref" href="functions-info.html#FUNCTIONS-PG-CONTROL-SYSTEM" title="Table 9.79. pg_control_system Columns">Table 9.79</a>
  823. </p><div class="table" id="FUNCTIONS-PG-CONTROL-SYSTEM"><p class="title"><strong>Table 9.79. <code class="function">pg_control_system</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_control_system Columns" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Column Name</th><th>Data Type</th></tr></thead><tbody><tr><td><code class="literal">pg_control_version</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">catalog_version_no</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">system_identifier</code></td><td><code class="type">bigint</code></td></tr><tr><td><code class="literal">pg_control_last_modified</code></td><td><code class="type">timestamp with time zone</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
  824. <code class="function">pg_control_init</code> returns a record, shown in
  825. <a class="xref" href="functions-info.html#FUNCTIONS-PG-CONTROL-INIT" title="Table 9.80. pg_control_init Columns">Table 9.80</a>
  826. </p><div class="table" id="FUNCTIONS-PG-CONTROL-INIT"><p class="title"><strong>Table 9.80. <code class="function">pg_control_init</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_control_init Columns" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Column Name</th><th>Data Type</th></tr></thead><tbody><tr><td><code class="literal">max_data_alignment</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">database_block_size</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">blocks_per_segment</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">wal_block_size</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">bytes_per_wal_segment</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">max_identifier_length</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">max_index_columns</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">max_toast_chunk_size</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">large_object_chunk_size</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">float4_pass_by_value</code></td><td><code class="type">boolean</code></td></tr><tr><td><code class="literal">float8_pass_by_value</code></td><td><code class="type">boolean</code></td></tr><tr><td><code class="literal">data_page_checksum_version</code></td><td><code class="type">integer</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
  827. <code class="function">pg_control_recovery</code> returns a record, shown in
  828. <a class="xref" href="functions-info.html#FUNCTIONS-PG-CONTROL-RECOVERY" title="Table 9.81. pg_control_recovery Columns">Table 9.81</a>
  829. </p><div class="table" id="FUNCTIONS-PG-CONTROL-RECOVERY"><p class="title"><strong>Table 9.81. <code class="function">pg_control_recovery</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_control_recovery Columns" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Column Name</th><th>Data Type</th></tr></thead><tbody><tr><td><code class="literal">min_recovery_end_lsn</code></td><td><code class="type">pg_lsn</code></td></tr><tr><td><code class="literal">min_recovery_end_timeline</code></td><td><code class="type">integer</code></td></tr><tr><td><code class="literal">backup_start_lsn</code></td><td><code class="type">pg_lsn</code></td></tr><tr><td><code class="literal">backup_end_lsn</code></td><td><code class="type">pg_lsn</code></td></tr><tr><td><code class="literal">end_of_backup_record_required</code></td><td><code class="type">boolean</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="functions-srf.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="functions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="functions-admin.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.24. Set Returning Functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 9.26. System Administration Functions</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1