Re: Passing current_database to BackgroundWorkerInitializeConnection - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Passing current_database to BackgroundWorkerInitializeConnection
Date
Msg-id 20180402192730.jw5qeolgecvyldwr@alap3.anarazel.de
Whole thread Raw
In response to Re: Passing current_database to BackgroundWorkerInitializeConnection  (Jeremy Finzel <finzelj@gmail.com>)
Responses Re: Passing current_database to BackgroundWorkerInitializeConnection  (Jeremy Finzel <finzelj@gmail.com>)
List pgsql-hackers
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 or such as well, but
...). Pretty fundamentally sharing data between concurrently running
processes needs a medium to share the data over. The bgw infrastructure
allocates just enough so you can put an index to it into
shmem. Allocating more would be wasteful and/or not enough for some
users.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Jeremy Finzel
Date:
Subject: Re: Passing current_database to BackgroundWorkerInitializeConnection
Next
From: Andres Freund
Date:
Subject: Re: PostgreSQL's handling of fsync() errors is unsafe and risks data loss at least on XFS