From 5d2f957f3f9dcd88384780876f535b423151f9bf Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Mon, 2 Feb 2015 16:23:59 -0500 Subject: 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. --- doc/src/sgml/bgworker.sgml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'doc/src') 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 Once running, the process can connect to a database by calling - BackgroundWorkerInitializeConnection(char *dbname, char *username). + BackgroundWorkerInitializeConnection(char *dbname, char *username) or + BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid). This allows the process to run transactions and queries using the - SPI interface. If dbname is NULL, - the session is not connected to any particular database, but shared catalogs - can be accessed. If username is NULL, the process will run as - the superuser created during initdb. - BackgroundWorkerInitializeConnection can only be called once per background - process, it is not possible to switch databases. + SPI interface. If dbname is NULL or + dboid is InvalidOid, the session is not connected + to any particular database, but shared catalogs can be accessed. + If username is NULL or useroid is + InvalidOid, the process will run as the superuser created + during initdb. + A background worker can only call one of these two functions, and only + once. It is not possible to switch databases. -- cgit v1.2.3