"ISHAN CHHANGANI ." <f202002...@alumni.bits-pilani.ac.in> writes: > 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.
You can't really. There is no part of our catalog-access infrastructure that is designed to support this, and there are bits of cached state all over the system that will misbehave if you try. You found some of it, but there is plenty more. I'd suggest letting the worker process die and spawning a new one if you need to redirect its efforts to a new database. If that seems too expensive, rethink the design that requires you to do it. regards, tom lane