summaryrefslogtreecommitdiff
path: root/doc/src/sgml/bgworker.sgml
diff options
context:
space:
mode:
authorRobert Haas2015-02-02 21:23:59 +0000
committerRobert Haas2015-02-02 21:23:59 +0000
commit5d2f957f3f9dcd88384780876f535b423151f9bf (patch)
treea857f045f8bc849ef6cb3aca570e7252e74a324b /doc/src/sgml/bgworker.sgml
parent2488eff889f83d7d6411be9a6172ff69df3f0085 (diff)
Add new function BackgroundWorkerInitializeConnectionByOid.
Sometimes it's useful for a background worker to be able to initialize its database connection by OID rather than by name, so provide a way to do that.
Diffstat (limited to 'doc/src/sgml/bgworker.sgml')
-rw-r--r--doc/src/sgml/bgworker.sgml17
1 files changed, 10 insertions, 7 deletions
diff --git a/doc/src/sgml/bgworker.sgml b/doc/src/sgml/bgworker.sgml
index 8e218ac0406..ef28f725114 100644
--- a/doc/src/sgml/bgworker.sgml
+++ b/doc/src/sgml/bgworker.sgml
@@ -146,14 +146,17 @@ typedef struct BackgroundWorker
</para>
<para>Once running, the process can connect to a database by calling
- <function>BackgroundWorkerInitializeConnection(<parameter>char *dbname</parameter>, <parameter>char *username</parameter>)</function>.
+ <function>BackgroundWorkerInitializeConnection(<parameter>char *dbname</parameter>, <parameter>char *username</parameter>)</function> or
+ <function>BackgroundWorkerInitializeConnectionByOid(<parameter>Oid dboid</parameter>, <parameter>Oid useroid</parameter>)</function>.
This allows the process to run transactions and queries using the
- <literal>SPI</literal> interface. If <varname>dbname</> is NULL,
- the session is not connected to any particular database, but shared catalogs
- can be accessed. If <varname>username</> is NULL, the process will run as
- the superuser created during <command>initdb</>.
- BackgroundWorkerInitializeConnection can only be called once per background
- process, it is not possible to switch databases.
+ <literal>SPI</literal> interface. If <varname>dbname</> is NULL or
+ <varname>dboid</> is <literal>InvalidOid</>, the session is not connected
+ to any particular database, but shared catalogs can be accessed.
+ If <varname>username</> is NULL or <varname>useroid</> is
+ <literal>InvalidOid</>, the process will run as the superuser created
+ during <command>initdb</>.
+ A background worker can only call one of these two functions, and only
+ once. It is not possible to switch databases.
</para>
<para>