Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[GENERAL] Visibility of temporary database objects

0 views
Skip to first unread message

Allan Kamau

unread,
Dec 14, 2009, 3:35:31 AM12/14/09
to
Hi all,
I have a simple question: Are the temporary database objects created
within a pgplsql function visible/available outside the function (or
implicit transaction) in any way. I am dropping and creating temporary
database objects within a function and I am calling this function in
from a threaded application which could use the same connection in
more than one thread(is this possible/or even safe). I would like to
avoid the possibility that the created temporary objects get dropped
outside the current thread that created them.


Allan.

--
Sent via pgsql-general mailing list (pgsql-...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Craig Ringer

unread,
Dec 14, 2009, 8:05:16 AM12/14/09
to
On 14/12/2009 4:35 PM, Allan Kamau wrote:

> and I am calling this function in
> from a threaded application which could use the same connection in
> more than one thread(is this possible/or even safe).

No!

Admittedly it depends on the client interface/driver, but at least for
direct psql, PgODBC and PgJDBC it is _not_ safe to use a single
PostgreSQL connection from more than one thread. Use multiple
connections, or properly control access to the connection so that only
one thread will be doing work on it at a time. Even then, you can't have
multiple queries in flight on a single connection.

--
Craig Ringer

0 new messages