codekingpro/portable-devtools
115k
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.26. 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 Vsnapshot" /><link rel="prev" href="functions-srf.html" title="9.25. Set Returning Functions" /><link rel="next" href="functions-admin.html" title="9.27. System Administration Functions" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">9.26. System Information Functions and Operators</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="functions-srf.html" title="9.25. 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 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="functions-admin.html" title="9.27. System Administration Functions">Next</a></td></tr></table><hr /></div><div class="sect1" id="FUNCTIONS-INFO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">9.26. System Information Functions and Operators <a href="#FUNCTIONS-INFO" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-SESSION">9.26.1. Session Information Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-ACCESS">9.26.2. Access Privilege Inquiry Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-SCHEMA">9.26.3. Schema Visibility Inquiry Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-CATALOG">9.26.4. System Catalog Information Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-OBJECT">9.26.5. Object Information and Addressing Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-COMMENT">9.26.6. Comment Information Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-VALIDITY">9.26.7. Data Validity Checking Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-SNAPSHOT">9.26.8. Transaction ID and Snapshot Information Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-COMMIT-TIMESTAMP">9.26.9. Committed Transaction Information Functions</a></span></dt><dt><span class="sect2"><a href="functions-info.html#FUNCTIONS-INFO-CONTROLDATA">9.26.10. Control Data Functions</a></span></dt></dl></div><p>3 The functions described in this section are used to obtain various4 information about a <span class="productname">PostgreSQL</span> installation.5 </p><div class="sect2" id="FUNCTIONS-INFO-SESSION"><div class="titlepage"><div><div><h3 class="title">9.26.1. Session Information Functions <a href="#FUNCTIONS-INFO-SESSION" class="id_link">#</a></h3></div></div></div><p>6 <a class="xref" href="functions-info.html#FUNCTIONS-INFO-SESSION-TABLE" title="Table 9.67. Session Information Functions">Table 9.67</a> shows several7 functions that extract session and system information.8 </p><p>9 In addition to the functions listed in this section, there are a number of10 functions related to the statistics system that also provide system11 information. See <a class="xref" href="monitoring-stats.html#MONITORING-STATS-FUNCTIONS" title="28.2.25. Statistics Functions">Section 28.2.25</a> for more12 information.13 </p><div class="table" id="FUNCTIONS-INFO-SESSION-TABLE"><p class="title"><strong>Table 9.67. Session Information Functions</strong></p><div class="table-contents"><table class="table" summary="Session Information Functions" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">14 Function15 </p>16 <p>17 Description18 </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">19 <a id="id-1.5.8.32.3.4.2.2.1.1.1.1" class="indexterm"></a>20 <code class="function">current_catalog</code>21 → <code class="returnvalue">name</code>22 </p>23 <p class="func_signature">24 <a id="id-1.5.8.32.3.4.2.2.1.1.2.1" class="indexterm"></a>25 <code class="function">current_database</code> ()26 → <code class="returnvalue">name</code>27 </p>28 <p>29 Returns the name of the current database. (Databases are30 called <span class="quote">“<span class="quote">catalogs</span>”</span> in the SQL standard,31 so <code class="function">current_catalog</code> is the standard's32 spelling.)33 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">34 <a id="id-1.5.8.32.3.4.2.2.2.1.1.1" class="indexterm"></a>35 <code class="function">current_query</code> ()36 → <code class="returnvalue">text</code>37 </p>38 <p>39 Returns the text of the currently executing query, as submitted40 by the client (which might contain more than one statement).41 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">42 <a id="id-1.5.8.32.3.4.2.2.3.1.1.1" class="indexterm"></a>43 <code class="function">current_role</code>44 → <code class="returnvalue">name</code>45 </p>46 <p>47 This is equivalent to <code class="function">current_user</code>.48 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">49 <a id="id-1.5.8.32.3.4.2.2.4.1.1.1" class="indexterm"></a>50 <a id="id-1.5.8.32.3.4.2.2.4.1.1.2" class="indexterm"></a>51 <code class="function">current_schema</code>52 → <code class="returnvalue">name</code>53 </p>54 <p class="func_signature">55 <code class="function">current_schema</code> ()56 → <code class="returnvalue">name</code>57 </p>58 <p>59 Returns the name of the schema that is first in the search path (or a60 null value if the search path is empty). This is the schema that will61 be used for any tables or other named objects that are created without62 specifying a target schema.63 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">64 <a id="id-1.5.8.32.3.4.2.2.5.1.1.1" class="indexterm"></a>65 <a id="id-1.5.8.32.3.4.2.2.5.1.1.2" class="indexterm"></a>66 <code class="function">current_schemas</code> ( <em class="parameter"><code>include_implicit</code></em> <code class="type">boolean</code> )67 → <code class="returnvalue">name[]</code>68 </p>69 <p>70 Returns an array of the names of all schemas presently in the71 effective search path, in their priority order. (Items in the current72 <a class="xref" href="runtime-config-client.html#GUC-SEARCH-PATH">search_path</a> setting that do not correspond to73 existing, searchable schemas are omitted.) If the Boolean argument74 is <code class="literal">true</code>, then implicitly-searched system schemas75 such as <code class="literal">pg_catalog</code> are included in the result.76 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">77 <a id="id-1.5.8.32.3.4.2.2.6.1.1.1" class="indexterm"></a>78 <a id="id-1.5.8.32.3.4.2.2.6.1.1.2" class="indexterm"></a>79 <code class="function">current_user</code>80 → <code class="returnvalue">name</code>81 </p>82 <p>83 Returns the user name of the current execution context.84 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">85 <a id="id-1.5.8.32.3.4.2.2.7.1.1.1" class="indexterm"></a>86 <code class="function">inet_client_addr</code> ()87 → <code class="returnvalue">inet</code>88 </p>89 <p>90 Returns the IP address of the current client,91 or <code class="literal">NULL</code> if the current connection is via a92 Unix-domain socket.93 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">94 <a id="id-1.5.8.32.3.4.2.2.8.1.1.1" class="indexterm"></a>95 <code class="function">inet_client_port</code> ()96 → <code class="returnvalue">integer</code>97 </p>98 <p>99 Returns the IP port number of the current client,100 or <code class="literal">NULL</code> if the current connection is via a101 Unix-domain socket.102 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">103 <a id="id-1.5.8.32.3.4.2.2.9.1.1.1" class="indexterm"></a>104 <code class="function">inet_server_addr</code> ()105 → <code class="returnvalue">inet</code>106 </p>107 <p>108 Returns the IP address on which the server accepted the current109 connection,110 or <code class="literal">NULL</code> if the current connection is via a111 Unix-domain socket.112 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">113 <a id="id-1.5.8.32.3.4.2.2.10.1.1.1" class="indexterm"></a>114 <code class="function">inet_server_port</code> ()115 → <code class="returnvalue">integer</code>116 </p>117 <p>118 Returns the IP port number on which the server accepted the current119 connection,120 or <code class="literal">NULL</code> if the current connection is via a121 Unix-domain socket.122 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">123 <a id="id-1.5.8.32.3.4.2.2.11.1.1.1" class="indexterm"></a>124 <code class="function">pg_backend_pid</code> ()125 → <code class="returnvalue">integer</code>126 </p>127 <p>128 Returns the process ID of the server process attached to the current129 session.130 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">131 <a id="id-1.5.8.32.3.4.2.2.12.1.1.1" class="indexterm"></a>132 <code class="function">pg_blocking_pids</code> ( <code class="type">integer</code> )133 → <code class="returnvalue">integer[]</code>134 </p>135 <p>136 Returns an array of the process ID(s) of the sessions that are137 blocking the server process with the specified process ID from138 acquiring a lock, or an empty array if there is no such server process139 or it is not blocked.140 </p>141 <p>142 One server process blocks another if it either holds a lock that143 conflicts with the blocked process's lock request (hard block), or is144 waiting for a lock that would conflict with the blocked process's lock145 request and is ahead of it in the wait queue (soft block). When using146 parallel queries the result always lists client-visible process IDs147 (that is, <code class="function">pg_backend_pid</code> results) even if the148 actual lock is held or awaited by a child worker process. As a result149 of that, there may be duplicated PIDs in the result. Also note that150 when a prepared transaction holds a conflicting lock, it will be151 represented by a zero process ID.152 </p>153 <p>154 Frequent calls to this function could have some impact on database155 performance, because it needs exclusive access to the lock manager's156 shared state for a short time.157 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">158 <a id="id-1.5.8.32.3.4.2.2.13.1.1.1" class="indexterm"></a>159 <code class="function">pg_conf_load_time</code> ()160 → <code class="returnvalue">timestamp with time zone</code>161 </p>162 <p>163 Returns the time when the server configuration files were last loaded.164 If the current session was alive at the time, this will be the time165 when the session itself re-read the configuration files (so the166 reading will vary a little in different sessions). Otherwise it is167 the time when the postmaster process re-read the configuration files.168 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">169 <a id="id-1.5.8.32.3.4.2.2.14.1.1.1" class="indexterm"></a>170 <a id="id-1.5.8.32.3.4.2.2.14.1.1.2" class="indexterm"></a>171 <a id="id-1.5.8.32.3.4.2.2.14.1.1.3" class="indexterm"></a>172 <a id="id-1.5.8.32.3.4.2.2.14.1.1.4" class="indexterm"></a>173 <code class="function">pg_current_logfile</code> ( [<span class="optional"> <code class="type">text</code> </span>] )174 → <code class="returnvalue">text</code>175 </p>176 <p>177 Returns the path name of the log file currently in use by the logging178 collector. The path includes the <a class="xref" href="runtime-config-logging.html#GUC-LOG-DIRECTORY">log_directory</a>179 directory and the individual log file name. The result180 is <code class="literal">NULL</code> if the logging collector is disabled.181 When multiple log files exist, each in a different182 format, <code class="function">pg_current_logfile</code> without an argument183 returns the path of the file having the first format found in the184 ordered list: <code class="literal">stderr</code>,185 <code class="literal">csvlog</code>, <code class="literal">jsonlog</code>.186 <code class="literal">NULL</code> is returned if no log file has any of these187 formats.188 To request information about a specific log file format, supply189 either <code class="literal">csvlog</code>, <code class="literal">jsonlog</code> or190 <code class="literal">stderr</code> as the191 value of the optional parameter. The result is <code class="literal">NULL</code>192 if the log format requested is not configured in193 <a class="xref" href="runtime-config-logging.html#GUC-LOG-DESTINATION">log_destination</a>.194 The result reflects the contents of195 the <code class="filename">current_logfiles</code> file.196 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">197 <a id="id-1.5.8.32.3.4.2.2.15.1.1.1" class="indexterm"></a>198 <code class="function">pg_my_temp_schema</code> ()199 → <code class="returnvalue">oid</code>200 </p>201 <p>202 Returns the OID of the current session's temporary schema, or zero if203 it has none (because it has not created any temporary tables).204 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">205 <a id="id-1.5.8.32.3.4.2.2.16.1.1.1" class="indexterm"></a>206 <code class="function">pg_is_other_temp_schema</code> ( <code class="type">oid</code> )207 → <code class="returnvalue">boolean</code>208 </p>209 <p>210 Returns true if the given OID is the OID of another session's211 temporary schema. (This can be useful, for example, to exclude other212 sessions' temporary tables from a catalog display.)213 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">214 <a id="id-1.5.8.32.3.4.2.2.17.1.1.1" class="indexterm"></a>215 <code class="function">pg_jit_available</code> ()216 → <code class="returnvalue">boolean</code>217 </p>218 <p>219 Returns true if a <acronym class="acronym">JIT</acronym> compiler extension is220 available (see <a class="xref" href="jit.html" title="Chapter 32. Just-in-Time Compilation (JIT)">Chapter 32</a>) and the221 <a class="xref" href="runtime-config-query.html#GUC-JIT">jit</a> configuration parameter is set to222 <code class="literal">on</code>.223 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">224 <a id="id-1.5.8.32.3.4.2.2.18.1.1.1" class="indexterm"></a>225 <code class="function">pg_listening_channels</code> ()226 → <code class="returnvalue">setof text</code>227 </p>228 <p>229 Returns the set of names of asynchronous notification channels that230 the current session is listening to.231 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">232 <a id="id-1.5.8.32.3.4.2.2.19.1.1.1" class="indexterm"></a>233 <code class="function">pg_notification_queue_usage</code> ()234 → <code class="returnvalue">double precision</code>235 </p>236 <p>237 Returns the fraction (0–1) of the asynchronous notification238 queue's maximum size that is currently occupied by notifications that239 are waiting to be processed.240 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>241 for more information.242 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">243 <a id="id-1.5.8.32.3.4.2.2.20.1.1.1" class="indexterm"></a>244 <code class="function">pg_postmaster_start_time</code> ()245 → <code class="returnvalue">timestamp with time zone</code>246 </p>247 <p>248 Returns the time when the server started.249 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">250 <a id="id-1.5.8.32.3.4.2.2.21.1.1.1" class="indexterm"></a>251 <code class="function">pg_safe_snapshot_blocking_pids</code> ( <code class="type">integer</code> )252 → <code class="returnvalue">integer[]</code>253 </p>254 <p>255 Returns an array of the process ID(s) of the sessions that are blocking256 the server process with the specified process ID from acquiring a safe257 snapshot, or an empty array if there is no such server process or it258 is not blocked.259 </p>260 <p>261 A session running a <code class="literal">SERIALIZABLE</code> transaction blocks262 a <code class="literal">SERIALIZABLE READ ONLY DEFERRABLE</code> transaction263 from acquiring a snapshot until the latter determines that it is safe264 to avoid taking any predicate locks. See265 <a class="xref" href="transaction-iso.html#XACT-SERIALIZABLE" title="13.2.3. Serializable Isolation Level">Section 13.2.3</a> for more information about266 serializable and deferrable transactions.267 </p>268 <p>269 Frequent calls to this function could have some impact on database270 performance, because it needs access to the predicate lock manager's271 shared state for a short time.272 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">273 <a id="id-1.5.8.32.3.4.2.2.22.1.1.1" class="indexterm"></a>274 <code class="function">pg_trigger_depth</code> ()275 → <code class="returnvalue">integer</code>276 </p>277 <p>278 Returns the current nesting level279 of <span class="productname">PostgreSQL</span> triggers (0 if not called,280 directly or indirectly, from inside a trigger).281 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">282 <a id="id-1.5.8.32.3.4.2.2.23.1.1.1" class="indexterm"></a>283 <code class="function">session_user</code>284 → <code class="returnvalue">name</code>285 </p>286 <p>287 Returns the session user's name.288 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">289 <a id="id-1.5.8.32.3.4.2.2.24.1.1.1" class="indexterm"></a>290 <code class="function">system_user</code>291 → <code class="returnvalue">text</code>292 </p>293 <p>294 Returns the authentication method and the identity (if any) that the295 user presented during the authentication cycle before they were296 assigned a database role. It is represented as297 <code class="literal">auth_method:identity</code> or298 <code class="literal">NULL</code> if the user has not been authenticated (for299 example if <a class="link" href="auth-trust.html" title="21.4. Trust Authentication">Trust authentication</a> has300 been used).301 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">302 <a id="id-1.5.8.32.3.4.2.2.25.1.1.1" class="indexterm"></a>303 <code class="function">user</code>304 → <code class="returnvalue">name</code>305 </p>306 <p>307 This is equivalent to <code class="function">current_user</code>.308 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">309 <a id="id-1.5.8.32.3.4.2.2.26.1.1.1" class="indexterm"></a>310 <code class="function">version</code> ()311 → <code class="returnvalue">text</code>312 </p>313 <p>314 Returns a string describing the <span class="productname">PostgreSQL</span>315 server's version. You can also get this information from316 <a class="xref" href="runtime-config-preset.html#GUC-SERVER-VERSION">server_version</a>, or for a machine-readable317 version use <a class="xref" href="runtime-config-preset.html#GUC-SERVER-VERSION-NUM">server_version_num</a>. Software318 developers should use <code class="varname">server_version_num</code> (available319 since 8.2) or <a class="xref" href="libpq-status.html#LIBPQ-PQSERVERVERSION"><code class="function">PQserverVersion</code></a> instead of320 parsing the text version.321 </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="note"><h3 class="title">Note</h3><p>322 <code class="function">current_catalog</code>,323 <code class="function">current_role</code>,324 <code class="function">current_schema</code>,325 <code class="function">current_user</code>,326 <code class="function">session_user</code>,327 and <code class="function">user</code> have special syntactic status328 in <acronym class="acronym">SQL</acronym>: they must be called without trailing329 parentheses. In PostgreSQL, parentheses can optionally be used with330 <code class="function">current_schema</code>, but not with the others.331 </p></div><p>332 The <code class="function">session_user</code> is normally the user who initiated333 the current database connection; but superusers can change this setting334 with <a class="xref" href="sql-set-session-authorization.html" title="SET SESSION AUTHORIZATION"><span class="refentrytitle">SET SESSION AUTHORIZATION</span></a>.335 The <code class="function">current_user</code> is the user identifier336 that is applicable for permission checking. Normally it is equal337 to the session user, but it can be changed with338 <a class="xref" href="sql-set-role.html" title="SET ROLE"><span class="refentrytitle">SET ROLE</span></a>.339 It also changes during the execution of340 functions with the attribute <code class="literal">SECURITY DEFINER</code>.341 In Unix parlance, the session user is the <span class="quote">“<span class="quote">real user</span>”</span> and342 the current user is the <span class="quote">“<span class="quote">effective user</span>”</span>.343 <code class="function">current_role</code> and <code class="function">user</code> are344 synonyms for <code class="function">current_user</code>. (The SQL standard draws345 a distinction between <code class="function">current_role</code>346 and <code class="function">current_user</code>, but <span class="productname">PostgreSQL</span>347 does not, since it unifies users and roles into a single kind of entity.)348 </p></div><div class="sect2" id="FUNCTIONS-INFO-ACCESS"><div class="titlepage"><div><div><h3 class="title">9.26.2. Access Privilege Inquiry Functions <a href="#FUNCTIONS-INFO-ACCESS" class="id_link">#</a></h3></div></div></div><a id="id-1.5.8.32.4.2" class="indexterm"></a><p>349 <a class="xref" href="functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE" title="Table 9.68. Access Privilege Inquiry Functions">Table 9.68</a> lists functions that350 allow querying object access privileges programmatically.351 (See <a class="xref" href="ddl-priv.html" title="5.7. Privileges">Section 5.7</a> for more information about352 privileges.)353 In these functions, the user whose privileges are being inquired about354 can be specified by name or by OID355 (<code class="structname">pg_authid</code>.<code class="structfield">oid</code>), or if356 the name is given as <code class="literal">public</code> then the privileges of the357 PUBLIC pseudo-role are checked. Also, the <em class="parameter"><code>user</code></em>358 argument can be omitted entirely, in which case359 the <code class="function">current_user</code> is assumed.360 The object that is being inquired about can be specified either by name or361 by OID, too. When specifying by name, a schema name can be included if362 relevant.363 The access privilege of interest is specified by a text string, which must364 evaluate to one of the appropriate privilege keywords for the object's type365 (e.g., <code class="literal">SELECT</code>). Optionally, <code class="literal">WITH GRANT366 OPTION</code> can be added to a privilege type to test whether the367 privilege is held with grant option. Also, multiple privilege types can be368 listed separated by commas, in which case the result will be true if any of369 the listed privileges is held. (Case of the privilege string is not370 significant, and extra whitespace is allowed between but not within371 privilege names.)372 Some examples:373</p><pre class="programlisting">374SELECT has_table_privilege('myschema.mytable', 'select');375SELECT has_table_privilege('joe', 'mytable', 'INSERT, SELECT WITH GRANT OPTION');376</pre><p>377 </p><div class="table" id="FUNCTIONS-INFO-ACCESS-TABLE"><p class="title"><strong>Table 9.68. Access Privilege Inquiry Functions</strong></p><div class="table-contents"><table class="table" summary="Access Privilege Inquiry Functions" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">378 Function379 </p>380 <p>381 Description382 </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">383 <a id="id-1.5.8.32.4.4.2.2.1.1.1.1" class="indexterm"></a>384 <code class="function">has_any_column_privilege</code> (385 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]386 <em class="parameter"><code>table</code></em> <code class="type">text</code> or <code class="type">oid</code>,387 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )388 → <code class="returnvalue">boolean</code>389 </p>390 <p>391 Does user have privilege for any column of table?392 This succeeds either if the privilege is held for the whole table, or393 if there is a column-level grant of the privilege for at least one394 column.395 Allowable privilege types are396 <code class="literal">SELECT</code>, <code class="literal">INSERT</code>,397 <code class="literal">UPDATE</code>, and <code class="literal">REFERENCES</code>.398 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">399 <a id="id-1.5.8.32.4.4.2.2.2.1.1.1" class="indexterm"></a>400 <code class="function">has_column_privilege</code> (401 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]402 <em class="parameter"><code>table</code></em> <code class="type">text</code> or <code class="type">oid</code>,403 <em class="parameter"><code>column</code></em> <code class="type">text</code> or <code class="type">smallint</code>,404 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )405 → <code class="returnvalue">boolean</code>406 </p>407 <p>408 Does user have privilege for the specified table column?409 This succeeds either if the privilege is held for the whole table, or410 if there is a column-level grant of the privilege for the column.411 The column can be specified by name or by attribute number412 (<code class="structname">pg_attribute</code>.<code class="structfield">attnum</code>).413 Allowable privilege types are414 <code class="literal">SELECT</code>, <code class="literal">INSERT</code>,415 <code class="literal">UPDATE</code>, and <code class="literal">REFERENCES</code>.416 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">417 <a id="id-1.5.8.32.4.4.2.2.3.1.1.1" class="indexterm"></a>418 <code class="function">has_database_privilege</code> (419 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]420 <em class="parameter"><code>database</code></em> <code class="type">text</code> or <code class="type">oid</code>,421 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )422 → <code class="returnvalue">boolean</code>423 </p>424 <p>425 Does user have privilege for database?426 Allowable privilege types are427 <code class="literal">CREATE</code>,428 <code class="literal">CONNECT</code>,429 <code class="literal">TEMPORARY</code>, and430 <code class="literal">TEMP</code> (which is equivalent to431 <code class="literal">TEMPORARY</code>).432 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">433 <a id="id-1.5.8.32.4.4.2.2.4.1.1.1" class="indexterm"></a>434 <code class="function">has_foreign_data_wrapper_privilege</code> (435 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]436 <em class="parameter"><code>fdw</code></em> <code class="type">text</code> or <code class="type">oid</code>,437 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )438 → <code class="returnvalue">boolean</code>439 </p>440 <p>441 Does user have privilege for foreign-data wrapper?442 The only allowable privilege type is <code class="literal">USAGE</code>.443 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">444 <a id="id-1.5.8.32.4.4.2.2.5.1.1.1" class="indexterm"></a>445 <code class="function">has_function_privilege</code> (446 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]447 <em class="parameter"><code>function</code></em> <code class="type">text</code> or <code class="type">oid</code>,448 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )449 → <code class="returnvalue">boolean</code>450 </p>451 <p>452 Does user have privilege for function?453 The only allowable privilege type is <code class="literal">EXECUTE</code>.454 </p>455 <p>456 When specifying a function by name rather than by OID, the allowed457 input is the same as for the <code class="type">regprocedure</code> data type (see458 <a class="xref" href="datatype-oid.html" title="8.19. Object Identifier Types">Section 8.19</a>).459 An example is:460</p><pre class="programlisting">461SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');462</pre><p>463 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">464 <a id="id-1.5.8.32.4.4.2.2.6.1.1.1" class="indexterm"></a>465 <code class="function">has_language_privilege</code> (466 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]467 <em class="parameter"><code>language</code></em> <code class="type">text</code> or <code class="type">oid</code>,468 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )469 → <code class="returnvalue">boolean</code>470 </p>471 <p>472 Does user have privilege for language?473 The only allowable privilege type is <code class="literal">USAGE</code>.474 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">475 <a id="id-1.5.8.32.4.4.2.2.7.1.1.1" class="indexterm"></a>476 <code class="function">has_parameter_privilege</code> (477 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]478 <em class="parameter"><code>parameter</code></em> <code class="type">text</code>,479 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )480 → <code class="returnvalue">boolean</code>481 </p>482 <p>483 Does user have privilege for configuration parameter?484 The parameter name is case-insensitive.485 Allowable privilege types are <code class="literal">SET</code>486 and <code class="literal">ALTER SYSTEM</code>.487 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">488 <a id="id-1.5.8.32.4.4.2.2.8.1.1.1" class="indexterm"></a>489 <code class="function">has_schema_privilege</code> (490 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]491 <em class="parameter"><code>schema</code></em> <code class="type">text</code> or <code class="type">oid</code>,492 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )493 → <code class="returnvalue">boolean</code>494 </p>495 <p>496 Does user have privilege for schema?497 Allowable privilege types are498 <code class="literal">CREATE</code> and499 <code class="literal">USAGE</code>.500 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">501 <a id="id-1.5.8.32.4.4.2.2.9.1.1.1" class="indexterm"></a>502 <code class="function">has_sequence_privilege</code> (503 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]504 <em class="parameter"><code>sequence</code></em> <code class="type">text</code> or <code class="type">oid</code>,505 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )506 → <code class="returnvalue">boolean</code>507 </p>508 <p>509 Does user have privilege for sequence?510 Allowable privilege types are511 <code class="literal">USAGE</code>,512 <code class="literal">SELECT</code>, and513 <code class="literal">UPDATE</code>.514 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">515 <a id="id-1.5.8.32.4.4.2.2.10.1.1.1" class="indexterm"></a>516 <code class="function">has_server_privilege</code> (517 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]518 <em class="parameter"><code>server</code></em> <code class="type">text</code> or <code class="type">oid</code>,519 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )520 → <code class="returnvalue">boolean</code>521 </p>522 <p>523 Does user have privilege for foreign server?524 The only allowable privilege type is <code class="literal">USAGE</code>.525 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">526 <a id="id-1.5.8.32.4.4.2.2.11.1.1.1" class="indexterm"></a>527 <code class="function">has_table_privilege</code> (528 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]529 <em class="parameter"><code>table</code></em> <code class="type">text</code> or <code class="type">oid</code>,530 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )531 → <code class="returnvalue">boolean</code>532 </p>533 <p>534 Does user have privilege for table?535 Allowable privilege types536 are <code class="literal">SELECT</code>, <code class="literal">INSERT</code>,537 <code class="literal">UPDATE</code>, <code class="literal">DELETE</code>,538 <code class="literal">TRUNCATE</code>, <code class="literal">REFERENCES</code>,539 and <code class="literal">TRIGGER</code>.540 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">541 <a id="id-1.5.8.32.4.4.2.2.12.1.1.1" class="indexterm"></a>542 <code class="function">has_tablespace_privilege</code> (543 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]544 <em class="parameter"><code>tablespace</code></em> <code class="type">text</code> or <code class="type">oid</code>,545 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )546 → <code class="returnvalue">boolean</code>547 </p>548 <p>549 Does user have privilege for tablespace?550 The only allowable privilege type is <code class="literal">CREATE</code>.551 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">552 <a id="id-1.5.8.32.4.4.2.2.13.1.1.1" class="indexterm"></a>553 <code class="function">has_type_privilege</code> (554 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]555 <em class="parameter"><code>type</code></em> <code class="type">text</code> or <code class="type">oid</code>,556 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )557 → <code class="returnvalue">boolean</code>558 </p>559 <p>560 Does user have privilege for data type?561 The only allowable privilege type is <code class="literal">USAGE</code>.562 When specifying a type by name rather than by OID, the allowed input563 is the same as for the <code class="type">regtype</code> data type (see564 <a class="xref" href="datatype-oid.html" title="8.19. Object Identifier Types">Section 8.19</a>).565 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">566 <a id="id-1.5.8.32.4.4.2.2.14.1.1.1" class="indexterm"></a>567 <code class="function">pg_has_role</code> (568 [<span class="optional"> <em class="parameter"><code>user</code></em> <code class="type">name</code> or <code class="type">oid</code>, </span>]569 <em class="parameter"><code>role</code></em> <code class="type">text</code> or <code class="type">oid</code>,570 <em class="parameter"><code>privilege</code></em> <code class="type">text</code> )571 → <code class="returnvalue">boolean</code>572 </p>573 <p>574 Does user have privilege for role?575 Allowable privilege types are576 <code class="literal">MEMBER</code>, <code class="literal">USAGE</code>,577 and <code class="literal">SET</code>.578 <code class="literal">MEMBER</code> denotes direct or indirect membership in579 the role without regard to what specific privileges may be conferred.580 <code class="literal">USAGE</code> denotes whether the privileges of the role581 are immediately available without doing <code class="command">SET ROLE</code>,582 while <code class="literal">SET</code> denotes whether it is possible to change583 to the role using the <code class="literal">SET ROLE</code> command.584 This function does not allow the special case of585 setting <em class="parameter"><code>user</code></em> to <code class="literal">public</code>,586 because the PUBLIC pseudo-role can never be a member of real roles.587 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">588 <a id="id-1.5.8.32.4.4.2.2.15.1.1.1" class="indexterm"></a>589 <code class="function">row_security_active</code> (590 <em class="parameter"><code>table</code></em> <code class="type">text</code> or <code class="type">oid</code> )591 → <code class="returnvalue">boolean</code>592 </p>593 <p>594 Is row-level security active for the specified table in the context of595 the current user and current environment?596 </p></td></tr></tbody></table></div></div><br class="table-break" /><p>597 <a class="xref" href="functions-info.html#FUNCTIONS-ACLITEM-OP-TABLE" title="Table 9.69. aclitem Operators">Table 9.69</a> shows the operators598 available for the <code class="type">aclitem</code> type, which is the catalog599 representation of access privileges. See <a class="xref" href="ddl-priv.html" title="5.7. Privileges">Section 5.7</a>600 for information about how to read access privilege values.601 </p><div class="table" id="FUNCTIONS-ACLITEM-OP-TABLE"><p class="title"><strong>Table 9.69. <code class="type">aclitem</code> Operators</strong></p><div class="table-contents"><table class="table" summary="aclitem Operators" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">602 Operator603 </p>604 <p>605 Description606 </p>607 <p>608 Example(s)609 </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">610 <a id="id-1.5.8.32.4.6.2.2.1.1.1.1" class="indexterm"></a>611 <code class="type">aclitem</code> <code class="literal">=</code> <code class="type">aclitem</code>612 → <code class="returnvalue">boolean</code>613 </p>614 <p>615 Are <code class="type">aclitem</code>s equal? (Notice that616 type <code class="type">aclitem</code> lacks the usual set of comparison617 operators; it has only equality. In turn, <code class="type">aclitem</code>618 arrays can only be compared for equality.)619 </p>620 <p>621 <code class="literal">'calvin=r*w/hobbes'::aclitem = 'calvin=r*w*/hobbes'::aclitem</code>622 → <code class="returnvalue">f</code>623 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">624 <a id="id-1.5.8.32.4.6.2.2.2.1.1.1" class="indexterm"></a>625 <code class="type">aclitem[]</code> <code class="literal">@></code> <code class="type">aclitem</code>626 → <code class="returnvalue">boolean</code>627 </p>628 <p>629 Does array contain the specified privileges? (This is true if there630 is an array entry that matches the <code class="type">aclitem</code>'s grantee and631 grantor, and has at least the specified set of privileges.)632 </p>633 <p>634 <code class="literal">'{calvin=r*w/hobbes,hobbes=r*w*/postgres}'::aclitem[] @> 'calvin=r*/hobbes'::aclitem</code>635 → <code class="returnvalue">t</code>636 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">637 <code class="type">aclitem[]</code> <code class="literal">~</code> <code class="type">aclitem</code>638 → <code class="returnvalue">boolean</code>639 </p>640 <p>641 This is a deprecated alias for <code class="literal">@></code>.642 </p>643 <p>644 <code class="literal">'{calvin=r*w/hobbes,hobbes=r*w*/postgres}'::aclitem[] ~ 'calvin=r*/hobbes'::aclitem</code>645 → <code class="returnvalue">t</code>646 </p></td></tr></tbody></table></div></div><br class="table-break" /><p>647 <a class="xref" href="functions-info.html#FUNCTIONS-ACLITEM-FN-TABLE" title="Table 9.70. aclitem Functions">Table 9.70</a> shows some additional648 functions to manage the <code class="type">aclitem</code> type.649 </p><div class="table" id="FUNCTIONS-ACLITEM-FN-TABLE"><p class="title"><strong>Table 9.70. <code class="type">aclitem</code> Functions</strong></p><div class="table-contents"><table class="table" summary="aclitem Functions" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">650 Function651 </p>652 <p>653 Description654 </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">655 <a id="id-1.5.8.32.4.8.2.2.1.1.1.1" class="indexterm"></a>656 <code class="function">acldefault</code> (657 <em class="parameter"><code>type</code></em> <code class="type">"char"</code>,658 <em class="parameter"><code>ownerId</code></em> <code class="type">oid</code> )659 → <code class="returnvalue">aclitem[]</code>660 </p>661 <p>662 Constructs an <code class="type">aclitem</code> array holding the default access663 privileges for an object of type <em class="parameter"><code>type</code></em> belonging664 to the role with OID <em class="parameter"><code>ownerId</code></em>. This represents665 the access privileges that will be assumed when an object's ACL entry666 is null. (The default access privileges are described in667 <a class="xref" href="ddl-priv.html" title="5.7. Privileges">Section 5.7</a>.)668 The <em class="parameter"><code>type</code></em> parameter must be one of669 'c' for <code class="literal">COLUMN</code>,670 'r' for <code class="literal">TABLE</code> and table-like objects,671 's' for <code class="literal">SEQUENCE</code>,672 'd' for <code class="literal">DATABASE</code>,673 'f' for <code class="literal">FUNCTION</code> or <code class="literal">PROCEDURE</code>,674 'l' for <code class="literal">LANGUAGE</code>,675 'L' for <code class="literal">LARGE OBJECT</code>,676 'n' for <code class="literal">SCHEMA</code>,677 'p' for <code class="literal">PARAMETER</code>,678 't' for <code class="literal">TABLESPACE</code>,679 'F' for <code class="literal">FOREIGN DATA WRAPPER</code>,680 'S' for <code class="literal">FOREIGN SERVER</code>,681 or682 'T' for <code class="literal">TYPE</code> or <code class="literal">DOMAIN</code>.683 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">684 <a id="id-1.5.8.32.4.8.2.2.2.1.1.1" class="indexterm"></a>685 <code class="function">aclexplode</code> ( <code class="type">aclitem[]</code> )686 → <code class="returnvalue">setof record</code>687 ( <em class="parameter"><code>grantor</code></em> <code class="type">oid</code>,688 <em class="parameter"><code>grantee</code></em> <code class="type">oid</code>,689 <em class="parameter"><code>privilege_type</code></em> <code class="type">text</code>,690 <em class="parameter"><code>is_grantable</code></em> <code class="type">boolean</code> )691 </p>692 <p>693 Returns the <code class="type">aclitem</code> array as a set of rows.694 If the grantee is the pseudo-role PUBLIC, it is represented by zero in695 the <em class="parameter"><code>grantee</code></em> column. Each granted privilege is696 represented as <code class="literal">SELECT</code>, <code class="literal">INSERT</code>,697 etc (see <a class="xref" href="ddl-priv.html#PRIVILEGE-ABBREVS-TABLE" title="Table 5.1. ACL Privilege Abbreviations">Table 5.1</a> for a full list).698 Note that each privilege is broken out as a separate row, so699 only one keyword appears in the <em class="parameter"><code>privilege_type</code></em>700 column.701 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">702 <a id="id-1.5.8.32.4.8.2.2.3.1.1.1" class="indexterm"></a>703 <code class="function">makeaclitem</code> (704 <em class="parameter"><code>grantee</code></em> <code class="type">oid</code>,705 <em class="parameter"><code>grantor</code></em> <code class="type">oid</code>,706 <em class="parameter"><code>privileges</code></em> <code class="type">text</code>,707 <em class="parameter"><code>is_grantable</code></em> <code class="type">boolean</code> )708 → <code class="returnvalue">aclitem</code>709 </p>710 <p>711 Constructs an <code class="type">aclitem</code> with the given properties.712 <em class="parameter"><code>privileges</code></em> is a comma-separated list of713 privilege names such as <code class="literal">SELECT</code>,714 <code class="literal">INSERT</code>, etc, all of which are set in the715 result. (Case of the privilege string is not significant, and716 extra whitespace is allowed between but not within privilege717 names.)718 </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="FUNCTIONS-INFO-SCHEMA"><div class="titlepage"><div><div><h3 class="title">9.26.3. Schema Visibility Inquiry Functions <a href="#FUNCTIONS-INFO-SCHEMA" class="id_link">#</a></h3></div></div></div><p>719 <a class="xref" href="functions-info.html#FUNCTIONS-INFO-SCHEMA-TABLE" title="Table 9.71. Schema Visibility Inquiry Functions">Table 9.71</a> shows functions that720 determine whether a certain object is <em class="firstterm">visible</em> in the721 current schema search path.722 For example, a table is said to be visible if its723 containing schema is in the search path and no table of the same724 name appears earlier in the search path. This is equivalent to the725 statement that the table can be referenced by name without explicit726 schema qualification. Thus, to list the names of all visible tables:727</p><pre class="programlisting">728SELECT relname FROM pg_class WHERE pg_table_is_visible(oid);729</pre><p>730 For functions and operators, an object in the search path is said to be731 visible if there is no object of the same name <span class="emphasis"><em>and argument data732 type(s)</em></span> earlier in the path. For operator classes and families,733 both the name and the associated index access method are considered.734 </p><a id="id-1.5.8.32.5.3" class="indexterm"></a><div class="table" id="FUNCTIONS-INFO-SCHEMA-TABLE"><p class="title"><strong>Table 9.71. Schema Visibility Inquiry Functions</strong></p><div class="table-contents"><table class="table" summary="Schema Visibility Inquiry Functions" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">735 Function736 </p>737 <p>738 Description739 </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">740 <a id="id-1.5.8.32.5.4.2.2.1.1.1.1" class="indexterm"></a>741 <code class="function">pg_collation_is_visible</code> ( <em class="parameter"><code>collation</code></em> <code class="type">oid</code> )742 → <code class="returnvalue">boolean</code>743 </p>744 <p>745 Is collation visible in search path?746 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">747 <a id="id-1.5.8.32.5.4.2.2.2.1.1.1" class="indexterm"></a>748 <code class="function">pg_conversion_is_visible</code> ( <em class="parameter"><code>conversion</code></em> <code class="type">oid</code> )749 → <code class="returnvalue">boolean</code>750 </p>751 <p>752 Is conversion visible in search path?753 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">754 <a id="id-1.5.8.32.5.4.2.2.3.1.1.1" class="indexterm"></a>755 <code class="function">pg_function_is_visible</code> ( <em class="parameter"><code>function</code></em> <code class="type">oid</code> )756 → <code class="returnvalue">boolean</code>757 </p>758 <p>759 Is function visible in search path?760 (This also works for procedures and aggregates.)761 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">762 <a id="id-1.5.8.32.5.4.2.2.4.1.1.1" class="indexterm"></a>763 <code class="function">pg_opclass_is_visible</code> ( <em class="parameter"><code>opclass</code></em> <code class="type">oid</code> )764 → <code class="returnvalue">boolean</code>765 </p>766 <p>767 Is operator class visible in search path?768 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">769 <a id="id-1.5.8.32.5.4.2.2.5.1.1.1" class="indexterm"></a>770 <code class="function">pg_operator_is_visible</code> ( <em class="parameter"><code>operator</code></em> <code class="type">oid</code> )771 → <code class="returnvalue">boolean</code>772 </p>773 <p>774 Is operator visible in search path?775 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">776 <a id="id-1.5.8.32.5.4.2.2.6.1.1.1" class="indexterm"></a>777 <code class="function">pg_opfamily_is_visible</code> ( <em class="parameter"><code>opclass</code></em> <code class="type">oid</code> )778 → <code class="returnvalue">boolean</code>779 </p>780 <p>781 Is operator family visible in search path?782 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">783 <a id="id-1.5.8.32.5.4.2.2.7.1.1.1" class="indexterm"></a>784 <code class="function">pg_statistics_obj_is_visible</code> ( <em class="parameter"><code>stat</code></em> <code class="type">oid</code> )785 → <code class="returnvalue">boolean</code>786 </p>787 <p>788 Is statistics object visible in search path?789 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">790 <a id="id-1.5.8.32.5.4.2.2.8.1.1.1" class="indexterm"></a>791 <code class="function">pg_table_is_visible</code> ( <em class="parameter"><code>table</code></em> <code class="type">oid</code> )792 → <code class="returnvalue">boolean</code>793 </p>794 <p>795 Is table visible in search path?796 (This works for all types of relations, including views, materialized797 views, indexes, sequences and foreign tables.)798 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">799 <a id="id-1.5.8.32.5.4.2.2.9.1.1.1" class="indexterm"></a>800 <code class="function">pg_ts_config_is_visible</code> ( <em class="parameter"><code>config</code></em> <code class="type">oid</code> )801 → <code class="returnvalue">boolean</code>802 </p>803 <p>804 Is text search configuration visible in search path?805 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">806 <a id="id-1.5.8.32.5.4.2.2.10.1.1.1" class="indexterm"></a>807 <code class="function">pg_ts_dict_is_visible</code> ( <em class="parameter"><code>dict</code></em> <code class="type">oid</code> )808 → <code class="returnvalue">boolean</code>809 </p>810 <p>811 Is text search dictionary visible in search path?812 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">813 <a id="id-1.5.8.32.5.4.2.2.11.1.1.1" class="indexterm"></a>814 <code class="function">pg_ts_parser_is_visible</code> ( <em class="parameter"><code>parser</code></em> <code class="type">oid</code> )815 → <code class="returnvalue">boolean</code>816 </p>817 <p>818 Is text search parser visible in search path?819 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">820 <a id="id-1.5.8.32.5.4.2.2.12.1.1.1" class="indexterm"></a>821 <code class="function">pg_ts_template_is_visible</code> ( <em class="parameter"><code>template</code></em> <code class="type">oid</code> )822 → <code class="returnvalue">boolean</code>823 </p>824 <p>825 Is text search template visible in search path?826 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">827 <a id="id-1.5.8.32.5.4.2.2.13.1.1.1" class="indexterm"></a>828 <code class="function">pg_type_is_visible</code> ( <em class="parameter"><code>type</code></em> <code class="type">oid</code> )829 → <code class="returnvalue">boolean</code>830 </p>831 <p>832 Is type (or domain) visible in search path?833 </p></td></tr></tbody></table></div></div><br class="table-break" /><p>834 All these functions require object OIDs to identify the object to be835 checked. If you want to test an object by name, it is convenient to use836 the OID alias types (<code class="type">regclass</code>, <code class="type">regtype</code>,837 <code class="type">regprocedure</code>, <code class="type">regoperator</code>, <code class="type">regconfig</code>,838 or <code class="type">regdictionary</code>),839 for example:840</p><pre class="programlisting">841SELECT pg_type_is_visible('myschema.widget'::regtype);842</pre><p>843 Note that it would not make much sense to test a non-schema-qualified844 type name in this way — if the name can be recognized at all, it must be visible.845 </p></div><div class="sect2" id="FUNCTIONS-INFO-CATALOG"><div class="titlepage"><div><div><h3 class="title">9.26.4. System Catalog Information Functions <a href="#FUNCTIONS-INFO-CATALOG" class="id_link">#</a></h3></div></div></div><p>846 <a class="xref" href="functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE" title="Table 9.72. System Catalog Information Functions">Table 9.72</a> lists functions that847 extract information from the system catalogs.848 </p><div class="table" id="FUNCTIONS-INFO-CATALOG-TABLE"><p class="title"><strong>Table 9.72. System Catalog Information Functions</strong></p><div class="table-contents"><table class="table" summary="System Catalog Information Functions" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">849 Function850 </p>851 <p>852 Description853 </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">854 <a id="id-1.5.8.32.6.3.2.2.1.1.1.1" class="indexterm"></a>855 <code class="function">format_type</code> ( <em class="parameter"><code>type</code></em> <code class="type">oid</code>, <em class="parameter"><code>typemod</code></em> <code class="type">integer</code> )856 → <code class="returnvalue">text</code>857 </p>858 <p>859 Returns the SQL name for a data type that is identified by its type860 OID and possibly a type modifier. Pass NULL for the type modifier if861 no specific modifier is known.862 </p></td></tr><tr><td id="PG-CHAR-TO-ENCODING" class="func_table_entry"><p class="func_signature">863 <a id="id-1.5.8.32.6.3.2.2.2.1.1.1" class="indexterm"></a>864 <code class="function">pg_char_to_encoding</code> ( <em class="parameter"><code>encoding</code></em> <code class="type">name</code> )865 → <code class="returnvalue">integer</code>866 </p>867 <p>868 Converts the supplied encoding name into an integer representing the869 internal identifier used in some system catalog tables.870 Returns <code class="literal">-1</code> if an unknown encoding name is provided.871 </p></td></tr><tr><td id="PG-ENCODING-TO-CHAR" class="func_table_entry"><p class="func_signature">872 <a id="id-1.5.8.32.6.3.2.2.3.1.1.1" class="indexterm"></a>873 <code class="function">pg_encoding_to_char</code> ( <em class="parameter"><code>encoding</code></em> <code class="type">integer</code> )874 → <code class="returnvalue">name</code>875 </p>876 <p>877 Converts the integer used as the internal identifier of an encoding in some878 system catalog tables into a human-readable string.879 Returns an empty string if an invalid encoding number is provided.880 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">881 <a id="id-1.5.8.32.6.3.2.2.4.1.1.1" class="indexterm"></a>882 <code class="function">pg_get_catalog_foreign_keys</code> ()883 → <code class="returnvalue">setof record</code>884 ( <em class="parameter"><code>fktable</code></em> <code class="type">regclass</code>,885 <em class="parameter"><code>fkcols</code></em> <code class="type">text[]</code>,886 <em class="parameter"><code>pktable</code></em> <code class="type">regclass</code>,887 <em class="parameter"><code>pkcols</code></em> <code class="type">text[]</code>,888 <em class="parameter"><code>is_array</code></em> <code class="type">boolean</code>,889 <em class="parameter"><code>is_opt</code></em> <code class="type">boolean</code> )890 </p>891 <p>892 Returns a set of records describing the foreign key relationships893 that exist within the <span class="productname">PostgreSQL</span> system894 catalogs.895 The <em class="parameter"><code>fktable</code></em> column contains the name of the896 referencing catalog, and the <em class="parameter"><code>fkcols</code></em> column897 contains the name(s) of the referencing column(s). Similarly,898 the <em class="parameter"><code>pktable</code></em> column contains the name of the899 referenced catalog, and the <em class="parameter"><code>pkcols</code></em> column900 contains the name(s) of the referenced column(s).901 If <em class="parameter"><code>is_array</code></em> is true, the last referencing902 column is an array, each of whose elements should match some entry903 in the referenced catalog.904 If <em class="parameter"><code>is_opt</code></em> is true, the referencing column(s)905 are allowed to contain zeroes instead of a valid reference.906 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">907 <a id="id-1.5.8.32.6.3.2.2.5.1.1.1" class="indexterm"></a>908 <code class="function">pg_get_constraintdef</code> ( <em class="parameter"><code>constraint</code></em> <code class="type">oid</code> [<span class="optional">, <em class="parameter"><code>pretty</code></em> <code class="type">boolean</code> </span>] )909 → <code class="returnvalue">text</code>910 </p>911 <p>912 Reconstructs the creating command for a constraint.913 (This is a decompiled reconstruction, not the original text914 of the command.)915 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">916 <a id="id-1.5.8.32.6.3.2.2.6.1.1.1" class="indexterm"></a>917 <code class="function">pg_get_expr</code> ( <em class="parameter"><code>expr</code></em> <code class="type">pg_node_tree</code>, <em class="parameter"><code>relation</code></em> <code class="type">oid</code> [<span class="optional">, <em class="parameter"><code>pretty</code></em> <code class="type">boolean</code> </span>] )918 → <code class="returnvalue">text</code>919 </p>920 <p>921 Decompiles the internal form of an expression stored in the system922 catalogs, such as the default value for a column. If the expression923 might contain Vars, specify the OID of the relation they refer to as924 the second parameter; if no Vars are expected, passing zero is925 sufficient.926 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">927 <a id="id-1.5.8.32.6.3.2.2.7.1.1.1" class="indexterm"></a>928 <code class="function">pg_get_functiondef</code> ( <em class="parameter"><code>func</code></em> <code class="type">oid</code> )929 → <code class="returnvalue">text</code>930 </p>931 <p>932 Reconstructs the creating command for a function or procedure.933 (This is a decompiled reconstruction, not the original text934 of the command.)935 The result is a complete <code class="command">CREATE OR REPLACE FUNCTION</code>936 or <code class="command">CREATE OR REPLACE PROCEDURE</code> statement.937 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">938 <a id="id-1.5.8.32.6.3.2.2.8.1.1.1" class="indexterm"></a>939 <code class="function">pg_get_function_arguments</code> ( <em class="parameter"><code>func</code></em> <code class="type">oid</code> )940 → <code class="returnvalue">text</code>941 </p>942 <p>943 Reconstructs the argument list of a function or procedure, in the form944 it would need to appear in within <code class="command">CREATE FUNCTION</code>945 (including default values).946 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">947 <a id="id-1.5.8.32.6.3.2.2.9.1.1.1" class="indexterm"></a>948 <code class="function">pg_get_function_identity_arguments</code> ( <em class="parameter"><code>func</code></em> <code class="type">oid</code> )949 → <code class="returnvalue">text</code>950 </p>951 <p>952 Reconstructs the argument list necessary to identify a function or953 procedure, in the form it would need to appear in within commands such954 as <code class="command">ALTER FUNCTION</code>. This form omits default values.955 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">956 <a id="id-1.5.8.32.6.3.2.2.10.1.1.1" class="indexterm"></a>957 <code class="function">pg_get_function_result</code> ( <em class="parameter"><code>func</code></em> <code class="type">oid</code> )958 → <code class="returnvalue">text</code>959 </p>960 <p>961 Reconstructs the <code class="literal">RETURNS</code> clause of a function, in962 the form it would need to appear in within <code class="command">CREATE963 FUNCTION</code>. Returns <code class="literal">NULL</code> for a procedure.964 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">965 <a id="id-1.5.8.32.6.3.2.2.11.1.1.1" class="indexterm"></a>966 <code class="function">pg_get_indexdef</code> ( <em class="parameter"><code>index</code></em> <code class="type">oid</code> [<span class="optional">, <em class="parameter"><code>column</code></em> <code class="type">integer</code>, <em class="parameter"><code>pretty</code></em> <code class="type">boolean</code> </span>] )967 → <code class="returnvalue">text</code>968 </p>969 <p>970 Reconstructs the creating command for an index.971 (This is a decompiled reconstruction, not the original text972 of the command.) If <em class="parameter"><code>column</code></em> is supplied and is973 not zero, only the definition of that column is reconstructed.974 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">975 <a id="id-1.5.8.32.6.3.2.2.12.1.1.1" class="indexterm"></a>976 <code class="function">pg_get_keywords</code> ()977 → <code class="returnvalue">setof record</code>978 ( <em class="parameter"><code>word</code></em> <code class="type">text</code>,979 <em class="parameter"><code>catcode</code></em> <code class="type">"char"</code>,980 <em class="parameter"><code>barelabel</code></em> <code class="type">boolean</code>,981 <em class="parameter"><code>catdesc</code></em> <code class="type">text</code>,982 <em class="parameter"><code>baredesc</code></em> <code class="type">text</code> )983 </p>984 <p>985 Returns a set of records describing the SQL keywords recognized by the986 server. The <em class="parameter"><code>word</code></em> column contains the987 keyword. The <em class="parameter"><code>catcode</code></em> column contains a988 category code: <code class="literal">U</code> for an unreserved989 keyword, <code class="literal">C</code> for a keyword that can be a column990 name, <code class="literal">T</code> for a keyword that can be a type or991 function name, or <code class="literal">R</code> for a fully reserved keyword.992 The <em class="parameter"><code>barelabel</code></em> column993 contains <code class="literal">true</code> if the keyword can be used as994 a <span class="quote">“<span class="quote">bare</span>”</span> column label in <code class="command">SELECT</code> lists,995 or <code class="literal">false</code> if it can only be used996 after <code class="literal">AS</code>.997 The <em class="parameter"><code>catdesc</code></em> column contains a998 possibly-localized string describing the keyword's category.999 The <em class="parameter"><code>baredesc</code></em> column contains a1000 possibly-localized string describing the keyword's column label status.1001 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1002 <a id="id-1.5.8.32.6.3.2.2.13.1.1.1" class="indexterm"></a>1003 <code class="function">pg_get_partkeydef</code> ( <em class="parameter"><code>table</code></em> <code class="type">oid</code> )1004 → <code class="returnvalue">text</code>1005 </p>1006 <p>1007 Reconstructs the definition of a partitioned table's partition1008 key, in the form it would have in the <code class="literal">PARTITION1009 BY</code> clause of <code class="command">CREATE TABLE</code>.1010 (This is a decompiled reconstruction, not the original text1011 of the command.)1012 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1013 <a id="id-1.5.8.32.6.3.2.2.14.1.1.1" class="indexterm"></a>1014 <code class="function">pg_get_ruledef</code> ( <em class="parameter"><code>rule</code></em> <code class="type">oid</code> [<span class="optional">, <em class="parameter"><code>pretty</code></em> <code class="type">boolean</code> </span>] )1015 → <code class="returnvalue">text</code>1016 </p>1017 <p>1018 Reconstructs the creating command for a rule.1019 (This is a decompiled reconstruction, not the original text1020 of the command.)1021 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1022 <a id="id-1.5.8.32.6.3.2.2.15.1.1.1" class="indexterm"></a>1023 <code class="function">pg_get_serial_sequence</code> ( <em class="parameter"><code>table</code></em> <code class="type">text</code>, <em class="parameter"><code>column</code></em> <code class="type">text</code> )1024 → <code class="returnvalue">text</code>1025 </p>1026 <p>1027 Returns the name of the sequence associated with a column,1028 or NULL if no sequence is associated with the column.1029 If the column is an identity column, the associated sequence is the1030 sequence internally created for that column.1031 For columns created using one of the serial types1032 (<code class="type">serial</code>, <code class="type">smallserial</code>, <code class="type">bigserial</code>),1033 it is the sequence created for that serial column definition.1034 In the latter case, the association can be modified or removed1035 with <code class="command">ALTER SEQUENCE OWNED BY</code>.1036 (This function probably should have been1037 called <code class="function">pg_get_owned_sequence</code>; its current name1038 reflects the fact that it has historically been used with serial-type1039 columns.) The first parameter is a table name with optional1040 schema, and the second parameter is a column name. Because the first1041 parameter potentially contains both schema and table names, it is1042 parsed per usual SQL rules, meaning it is lower-cased by default.1043 The second parameter, being just a column name, is treated literally1044 and so has its case preserved. The result is suitably formatted1045 for passing to the sequence functions (see1046 <a class="xref" href="functions-sequence.html" title="9.17. Sequence Manipulation Functions">Section 9.17</a>).1047 </p>1048 <p>1049 A typical use is in reading the current value of the sequence for an1050 identity or serial column, for example:1051</p><pre class="programlisting">1052SELECT currval(pg_get_serial_sequence('sometable', 'id'));1053</pre><p>1054 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1055 <a id="id-1.5.8.32.6.3.2.2.16.1.1.1" class="indexterm"></a>1056 <code class="function">pg_get_statisticsobjdef</code> ( <em class="parameter"><code>statobj</code></em> <code class="type">oid</code> )1057 → <code class="returnvalue">text</code>1058 </p>1059 <p>1060 Reconstructs the creating command for an extended statistics object.1061 (This is a decompiled reconstruction, not the original text1062 of the command.)1063 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1064 <a id="id-1.5.8.32.6.3.2.2.17.1.1.1" class="indexterm"></a>1065<code class="function">pg_get_triggerdef</code> ( <em class="parameter"><code>trigger</code></em> <code class="type">oid</code> [<span class="optional">, <em class="parameter"><code>pretty</code></em> <code class="type">boolean</code> </span>] )1066 → <code class="returnvalue">text</code>1067 </p>1068 <p>1069 Reconstructs the creating command for a trigger.1070 (This is a decompiled reconstruction, not the original text1071 of the command.)1072 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1073 <a id="id-1.5.8.32.6.3.2.2.18.1.1.1" class="indexterm"></a>1074 <code class="function">pg_get_userbyid</code> ( <em class="parameter"><code>role</code></em> <code class="type">oid</code> )1075 → <code class="returnvalue">name</code>1076 </p>1077 <p>1078 Returns a role's name given its OID.1079 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1080 <a id="id-1.5.8.32.6.3.2.2.19.1.1.1" class="indexterm"></a>1081 <code class="function">pg_get_viewdef</code> ( <em class="parameter"><code>view</code></em> <code class="type">oid</code> [<span class="optional">, <em class="parameter"><code>pretty</code></em> <code class="type">boolean</code> </span>] )1082 → <code class="returnvalue">text</code>1083 </p>1084 <p>1085 Reconstructs the underlying <code class="command">SELECT</code> command for a1086 view or materialized view. (This is a decompiled reconstruction, not1087 the original text of the command.)1088 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1089 <code class="function">pg_get_viewdef</code> ( <em class="parameter"><code>view</code></em> <code class="type">oid</code>, <em class="parameter"><code>wrap_column</code></em> <code class="type">integer</code> )1090 → <code class="returnvalue">text</code>1091 </p>1092 <p>1093 Reconstructs the underlying <code class="command">SELECT</code> command for a1094 view or materialized view. (This is a decompiled reconstruction, not1095 the original text of the command.) In this form of the function,1096 pretty-printing is always enabled, and long lines are wrapped to try1097 to keep them shorter than the specified number of columns.1098 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1099 <code class="function">pg_get_viewdef</code> ( <em class="parameter"><code>view</code></em> <code class="type">text</code> [<span class="optional">, <em class="parameter"><code>pretty</code></em> <code class="type">boolean</code> </span>] )1100 → <code class="returnvalue">text</code>1101 </p>1102 <p>1103 Reconstructs the underlying <code class="command">SELECT</code> command for a1104 view or materialized view, working from a textual name for the view1105 rather than its OID. (This is deprecated; use the OID variant1106 instead.)1107 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1108 <a id="id-1.5.8.32.6.3.2.2.22.1.1.1" class="indexterm"></a>1109 <code class="function">pg_index_column_has_property</code> ( <em class="parameter"><code>index</code></em> <code class="type">regclass</code>, <em class="parameter"><code>column</code></em> <code class="type">integer</code>, <em class="parameter"><code>property</code></em> <code class="type">text</code> )1110 → <code class="returnvalue">boolean</code>1111 </p>1112 <p>1113 Tests whether an index column has the named property.1114 Common index column properties are listed in1115 <a class="xref" href="functions-info.html#FUNCTIONS-INFO-INDEX-COLUMN-PROPS" title="Table 9.73. Index Column Properties">Table 9.73</a>.1116 (Note that extension access methods can define additional property1117 names for their indexes.)1118 <code class="literal">NULL</code> is returned if the property name is not known1119 or does not apply to the particular object, or if the OID or column1120 number does not identify a valid object.1121 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1122 <a id="id-1.5.8.32.6.3.2.2.23.1.1.1" class="indexterm"></a>1123 <code class="function">pg_index_has_property</code> ( <em class="parameter"><code>index</code></em> <code class="type">regclass</code>, <em class="parameter"><code>property</code></em> <code class="type">text</code> )1124 → <code class="returnvalue">boolean</code>1125 </p>1126 <p>1127 Tests whether an index has the named property.1128 Common index properties are listed in1129 <a class="xref" href="functions-info.html#FUNCTIONS-INFO-INDEX-PROPS" title="Table 9.74. Index Properties">Table 9.74</a>.1130 (Note that extension access methods can define additional property1131 names for their indexes.)1132 <code class="literal">NULL</code> is returned if the property name is not known1133 or does not apply to the particular object, or if the OID does not1134 identify a valid object.1135 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1136 <a id="id-1.5.8.32.6.3.2.2.24.1.1.1" class="indexterm"></a>1137 <code class="function">pg_indexam_has_property</code> ( <em class="parameter"><code>am</code></em> <code class="type">oid</code>, <em class="parameter"><code>property</code></em> <code class="type">text</code> )1138 → <code class="returnvalue">boolean</code>1139 </p>1140 <p>1141 Tests whether an index access method has the named property.1142 Access method properties are listed in1143 <a class="xref" href="functions-info.html#FUNCTIONS-INFO-INDEXAM-PROPS" title="Table 9.75. Index Access Method Properties">Table 9.75</a>.1144 <code class="literal">NULL</code> is returned if the property name is not known1145 or does not apply to the particular object, or if the OID does not1146 identify a valid object.1147 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1148 <a id="id-1.5.8.32.6.3.2.2.25.1.1.1" class="indexterm"></a>1149 <code class="function">pg_options_to_table</code> ( <em class="parameter"><code>options_array</code></em> <code class="type">text[]</code> )1150 → <code class="returnvalue">setof record</code>1151 ( <em class="parameter"><code>option_name</code></em> <code class="type">text</code>,1152 <em class="parameter"><code>option_value</code></em> <code class="type">text</code> )1153 </p>1154 <p>1155 Returns the set of storage options represented by a value from1156 <code class="structname">pg_class</code>.<code class="structfield">reloptions</code> or1157 <code class="structname">pg_attribute</code>.<code class="structfield">attoptions</code>.1158 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1159 <a id="id-1.5.8.32.6.3.2.2.26.1.1.1" class="indexterm"></a>1160 <code class="function">pg_settings_get_flags</code> ( <em class="parameter"><code>guc</code></em> <code class="type">text</code> )1161 → <code class="returnvalue">text[]</code>1162 </p>1163 <p>1164 Returns an array of the flags associated with the given GUC, or1165 <code class="literal">NULL</code> if it does not exist. The result is1166 an empty array if the GUC exists but there are no flags to show.1167 Only the most useful flags listed in1168 <a class="xref" href="functions-info.html#FUNCTIONS-PG-SETTINGS-FLAGS" title="Table 9.76. GUC Flags">Table 9.76</a> are exposed.1169 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1170 <a id="id-1.5.8.32.6.3.2.2.27.1.1.1" class="indexterm"></a>1171 <code class="function">pg_tablespace_databases</code> ( <em class="parameter"><code>tablespace</code></em> <code class="type">oid</code> )1172 → <code class="returnvalue">setof oid</code>1173 </p>1174 <p>1175 Returns the set of OIDs of databases that have objects stored in the1176 specified tablespace. If this function returns any rows, the1177 tablespace is not empty and cannot be dropped. To identify the specific1178 objects populating the tablespace, you will need to connect to the1179 database(s) identified by <code class="function">pg_tablespace_databases</code>1180 and query their <code class="structname">pg_class</code> catalogs.1181 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1182 <a id="id-1.5.8.32.6.3.2.2.28.1.1.1" class="indexterm"></a>1183 <code class="function">pg_tablespace_location</code> ( <em class="parameter"><code>tablespace</code></em> <code class="type">oid</code> )1184 → <code class="returnvalue">text</code>1185 </p>1186 <p>1187 Returns the file system path that this tablespace is located in.1188 </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">1189 <a id="id-1.5.8.32.6.3.2.2.29.1.1.1" class="indexterm"></a>1190 <code class="function">pg_typeof</code> ( <code class="type">"any"</code> )1191 → <code class="returnvalue">regtype</code>1192 </p>1193 <p>1194 Returns the OID of the data type of the value that is passed to it.1195 This can be helpful for troubleshooting or dynamically constructing1196 SQL queries. The function is declared as1197 returning <code class="type">regtype</code>, which is an OID alias type (see1198 <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 an1199 OID for comparison purposes but displays as a type name.1200 </p>