v3-0001-worker-spi-database-fix.patch
text/x-diff
Filename: v3-0001-worker-spi-database-fix.patch
Type: text/x-diff
Part: 0
Message:
Re: coverage increase for worker_spi
Patch
Format: unified
Series: patch v3-0001
| File | + | − |
|---|---|---|
| src/test/modules/worker_spi/worker_spi.c | 11 | 1 |
diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c
index c1878dd694..bc9ef64a50 100644
--- a/src/test/modules/worker_spi/worker_spi.c
+++ b/src/test/modules/worker_spi/worker_spi.c
@@ -55,6 +55,7 @@ static volatile sig_atomic_t got_sigterm = false;
/* GUC variables */
static int worker_spi_naptime = 10;
static int worker_spi_total_workers = 2;
+static char *worker_spi_database = NULL;
typedef struct worktable
@@ -179,7 +180,7 @@ worker_spi_main(Datum main_arg)
BackgroundWorkerUnblockSignals();
/* Connect to our database */
- BackgroundWorkerInitializeConnection("postgres", NULL, 0);
+ BackgroundWorkerInitializeConnection(worker_spi_database, NULL, 0);
elog(LOG, "%s initialized with %s.%s",
MyBgworkerEntry->bgw_name, table->schema, table->name);
@@ -339,6 +340,15 @@ _PG_init(void)
NULL,
NULL);
+ DefineCustomStringVariable("worker_spi.database",
+ "Database to connect to.",
+ NULL,
+ &worker_spi_database,
+ "postgres",
+ PGC_POSTMASTER,
+ 0,
+ NULL, NULL, NULL);
+
/* set up common data for all our workers */
memset(&worker, 0, sizeof(worker));
worker.bgw_flags = BGWORKER_SHMEM_ACCESS |
--
2.17.1