On Wed, Dec 11, 2019 at 05:17:00PM +0900, Koichi Suzuki wrote: > Not using this extension, sorry.
I have no idea what you are trying to do, but get_database_name() accesses the system cache, which means two things: - The access needs to be done in the context of a transaction. That's a trick we use in a couple of places in core, see for example IdentifySystem() in walsender.c which looks for the database name. In this case, you need to do the call in-between StartTransactionCommand and CommitTransactionCommand, and you should make sure that the memory context does not point to the one of the transaction to have an access to the syscache data after committing the inner transaction used for the lookup. - Your background worker needs a database access, so bgw_flags needs to be BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION, and also make sure to use BackgroundWorkerInitializeConnection at the beginning of the main loop of your worker. Hope that helps. -- Michael
signature.asc
Description: PGP signature
