Passing current_database to BackgroundWorkerInitializeConnection

From: Jeremy Finzel <finzelj(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Passing current_database to BackgroundWorkerInitializeConnection
Date: 2018-03-30 21:36:59
Message-ID: CAMa1XUi-c1rkCu2jv26txF31KaRU39ypUPvPe_LNEBBpsC3CEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I am having trouble figuring out the right way to do this, clearly missing
something obvious. I am simply trying to pass the current database
to BackgroundWorkerInitializeConnection, but MyDatabaseId is showing as 0,
and I am getting this error in the running of function get_database_name
here at the top:

ERROR: invalid cache ID: 21

char *database_name = get_database_name(MyDatabaseId);

/*
...
*/

/* Connect to our database */
BackgroundWorkerInitializeConnection(database_name, NULL);

Any direction would be much appreciated. I have tried to look at example
uses of MyDatabaseId and not sure what I'm missing here.

Thanks,
Jeremy

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-03-30 21:40:37 Re: Passing current_database to BackgroundWorkerInitializeConnection
Previous Message Tom Lane 2018-03-30 21:26:21 Re: Parallel safety of binary_upgrade_create_empty_extension