How to deinitialize a connection for background worker

2025-01-21 Thread ISHAN CHHANGANI .
I am working on a project which requires me to create a background worker. This worker checks some array(shared memory) every second and then connects to the database mentioned within the array. That is I want to connect to different databases using the same background worker without killing it.

Extract constants from EXECUTE queries

2024-11-12 Thread ISHAN CHHANGANI
Hi hackers, I wanted to extract constants hard coded within prepared statements. ex:- PREPARE stmt(text, int) as SELECT * FROM test_table WHERE a = $1 AND b = 99 AND c = $2; EXECUTE stmt('abc', 1); I can easily get the parameter values ('abc' and 1) from queryDesc->params, but I need to also ex

Switch background worker on/off in runtime.

2024-05-31 Thread ISHAN CHHANGANI .
Hi, Is it possible to switch on/off a background worker in runtime? worker.bgw_flags = BGWORKER_SHMEM_ACCESS; worker.bgw_start_time = BgWorkerStart_PostmasterStart; I want to switch off the worker based on some flag value, etc, either from the main process or the worker itself. Are there any al

Timeout gets unset on a syntax error.

2024-05-29 Thread ISHAN CHHANGANI .
On a particular query, I start an alarm (say for 5 sec) using RegisterTimeout , and when the alarm rings, I log something. This works fine. But if I run a query with a syntax error between the time duration, then the alarm never rings. Is there some code within Postgres that resets/removes the si