Re: Passing current_database to BackgroundWorkerInitializeConnection

2018-04-02 Thread Andres Freund
Hi, On 2018-04-02 14:33:54 -0500, Jeremy Finzel wrote: > Hmmm... not sure if I follow. My goal is to run a SQL statement every 10 > seconds (or what value is chosen) in a particular database, using a > background worker. Those are the two arguments. Am I missing some way to > implement this apa

Re: Passing current_database to BackgroundWorkerInitializeConnection

2018-04-02 Thread Jeremy Finzel
On Mon, Apr 2, 2018 at 2:27 PM, Andres Freund wrote: > Hi, > > On 2018-04-02 14:24:53 -0500, Jeremy Finzel wrote: > > Thank you, this makes sense. However, how can this be done since I can > > only pass one argument to bgw_main? Is there any way to do this without > > having to store the value

Re: Passing current_database to BackgroundWorkerInitializeConnection

2018-04-02 Thread Andres Freund
Hi, On 2018-04-02 14:24:53 -0500, Jeremy Finzel wrote: > Thank you, this makes sense. However, how can this be done since I can > only pass one argument to bgw_main? Is there any way to do this without > having to store the value in shared memory? No (I mean you can store it in the filesystem o

Re: Passing current_database to BackgroundWorkerInitializeConnection

2018-04-02 Thread Jeremy Finzel
On Fri, Mar 30, 2018 at 5:37 PM, Andres Freund wrote: > > > On March 30, 2018 3:16:31 PM PDT, Jeremy Finzel wrote: > >> What do you mean with "current database"? Before you > >> BackgroundWorkerInitializeConnection() there is no such thing? > > > > > >My module is based directly off the worker_s

Re: Passing current_database to BackgroundWorkerInitializeConnection

2018-03-30 Thread Andres Freund
On March 30, 2018 3:16:31 PM PDT, Jeremy Finzel wrote: >> What do you mean with "current database"? Before you >> BackgroundWorkerInitializeConnection() there is no such thing? > > >My module is based directly off the worker_spi example. The worker is >dynamically launched via SQL command. But i

Re: Passing current_database to BackgroundWorkerInitializeConnection

2018-03-30 Thread Jeremy Finzel
> What do you mean with "current database"? Before you > BackgroundWorkerInitializeConnection() there is no such thing? My module is based directly off the worker_spi example. The worker is dynamically launched via SQL command. But in the worker_spi example, the database postgres is just hardcode

Re: Passing current_database to BackgroundWorkerInitializeConnection

2018-03-30 Thread Andres Freund
On 2018-03-30 16:36:59 -0500, Jeremy Finzel wrote: > 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

Passing current_database to BackgroundWorkerInitializeConnection

2018-03-30 Thread Jeremy Finzel
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