1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.84 2001/11/21 05:53:41 thomas Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.85 2001/11/21 22:33:14 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -4191,18 +4191,18 @@ SELECT NULLIF(value, '(none)') ...
4191
4191
4192
4192
<tbody>
4193
4193
<row>
4194
- <entry>current_user</>
4195
- <entry>name</>
4194
+ <entry><function> current_user</></entry >
4195
+ <entry><type> name</></entry >
4196
4196
<entry>user name of current execution context</>
4197
4197
</row>
4198
4198
<row>
4199
- <entry>session_user</>
4200
- <entry>name</>
4199
+ <entry><function> session_user</></entry >
4200
+ <entry><type> name</></entry >
4201
4201
<entry>session user name</>
4202
4202
</row>
4203
4203
<row>
4204
- <entry>user</>
4205
- <entry>name</>
4204
+ <entry><function> user</></entry >
4205
+ <entry><type> name</></entry >
4206
4206
<entry>equivalent to <function>current_user</></>
4207
4207
</row>
4208
4208
</tbody>
@@ -4216,7 +4216,7 @@ SELECT NULLIF(value, '(none)') ...
4216
4216
4217
4217
<para>
4218
4218
The <function>session_user</> is the user that initiated a database
4219
- connection and is fixed for the duration of that connection. The
4219
+ connection; it is fixed for the duration of that connection. The
4220
4220
<function>current_user</> is the user identifier that is applicable
4221
4221
for permission checking. Currently it is always equal to the session
4222
4222
user, but in the future there might be <quote>setuid</> functions and
@@ -4226,7 +4226,7 @@ SELECT NULLIF(value, '(none)') ...
4226
4226
</para>
4227
4227
4228
4228
<para>
4229
- Note that these functions have special syntactic status in <acronym>SQL</>;
4229
+ Note that these functions have special syntactic status in <acronym>SQL</>:
4230
4230
they must be called without trailing parentheses.
4231
4231
</para>
4232
4232
@@ -4238,6 +4238,32 @@ SELECT NULLIF(value, '(none)') ...
4238
4238
</para>
4239
4239
</note>
4240
4240
4241
+ <table>
4242
+ <title>System Information Functions</>
4243
+ <tgroup cols="3">
4244
+ <thead>
4245
+ <row><entry>Name</> <entry>Return Type</> <entry>Description</></row>
4246
+ </thead>
4247
+
4248
+ <tbody>
4249
+ <row>
4250
+ <entry><function>version</></entry>
4251
+ <entry><type>text</></entry>
4252
+ <entry>PostgreSQL version information</>
4253
+ </row>
4254
+ </tbody>
4255
+ </tgroup>
4256
+ </table>
4257
+
4258
+ <indexterm zone="functions-misc">
4259
+ <primary>version</primary>
4260
+ </indexterm>
4261
+
4262
+ <para>
4263
+ <function>version()</> returns a string describing the PostgreSQL
4264
+ server's version.
4265
+ </para>
4266
+
4241
4267
<table>
4242
4268
<title>Access Privilege Inquiry Functions</>
4243
4269
<tgroup cols="3">
@@ -4272,7 +4298,9 @@ SELECT NULLIF(value, '(none)') ...
4272
4298
<para>
4273
4299
<function>has_table_privilege</> determines whether a user
4274
4300
can access a table in a particular way. The user can be
4275
- specified by name or by ID (<classname>pg_user</>.<structfield>usesysid</>) or if the argument is omitted
4301
+ specified by name or by ID
4302
+ (<classname>pg_user</>.<structfield>usesysid</>), or if the argument is
4303
+ omitted
4276
4304
<function>current_user</> is assumed. The table can be specified
4277
4305
by name or by OID. (Thus, there are actually six variants of
4278
4306
<function>has_table_privilege</>, which can be distinguished by
@@ -4284,29 +4312,61 @@ SELECT NULLIF(value, '(none)') ...
4284
4312
</para>
4285
4313
4286
4314
<table>
4287
- <title>System Information Functions</>
4315
+ <title>Catalog Information Functions</>
4288
4316
<tgroup cols="3">
4289
4317
<thead>
4290
4318
<row><entry>Name</> <entry>Return Type</> <entry>Description</></row>
4291
4319
</thead>
4292
4320
4293
4321
<tbody>
4294
4322
<row>
4295
- <entry>version</>
4296
- <entry>text</>
4297
- <entry>PostgreSQL version information</>
4323
+ <entry><function>pg_get_viewdef</>(<parameter>viewname</parameter>)</entry>
4324
+ <entry><type>text</></entry>
4325
+ <entry>Get CREATE VIEW command for view</>
4326
+ </row>
4327
+ <row>
4328
+ <entry><function>pg_get_ruledef</>(<parameter>rulename</parameter>)</entry>
4329
+ <entry><type>text</></entry>
4330
+ <entry>Get CREATE RULE command for rule</>
4331
+ </row>
4332
+ <row>
4333
+ <entry><function>pg_get_indexdef</>(<parameter>indexOID</parameter>)</entry>
4334
+ <entry><type>text</></entry>
4335
+ <entry>Get CREATE INDEX command for index</>
4336
+ </row>
4337
+ <row>
4338
+ <entry><function>pg_get_userbyid</>(<parameter>userid</parameter>)</entry>
4339
+ <entry><type>name</></entry>
4340
+ <entry>Get user name given sysid</>
4298
4341
</row>
4299
4342
</tbody>
4300
4343
</tgroup>
4301
4344
</table>
4302
4345
4303
4346
<indexterm zone="functions-misc">
4304
- <primary>version</primary>
4347
+ <primary>pg_get_viewdef</primary>
4348
+ </indexterm>
4349
+
4350
+ <indexterm zone="functions-misc">
4351
+ <primary>pg_get_ruledef</primary>
4352
+ </indexterm>
4353
+
4354
+ <indexterm zone="functions-misc">
4355
+ <primary>pg_get_indexdef</primary>
4356
+ </indexterm>
4357
+
4358
+ <indexterm zone="functions-misc">
4359
+ <primary>pg_get_userbyid</primary>
4305
4360
</indexterm>
4306
4361
4307
4362
<para>
4308
- <function>version()</> returns a string describing the PostgreSQL
4309
- server's version.
4363
+ These functions extract information from the system catalogs.
4364
+ <function>pg_get_viewdef()</>, <function>pg_get_ruledef()</>, and
4365
+ <function>pg_get_indexdef()</> respectively reconstruct the creating
4366
+ command for a view, rule, or index. (Note that this is a decompiled
4367
+ reconstruction, not the verbatim text of the command.)
4368
+ <function>pg_get_userbyid()</> extracts a user's name given a
4369
+ <structfield>usesysid</> value.
4310
4370
</para>
4311
4371
4312
4372
</sect1>
0 commit comments