Unique namespace per session for temp tables?
Unique namespace per session for temp tables?
От:
Emmanuel Cecchet <manu@asterdata.com>
Дата:
Hi all,
Following the issue with temp tables and 2PC, we thought that each session in Postgres was supposed to generate a unique namespace for its temporary tables.
But if we execute the following scenario:
First session.
BEGIN;
CREATE TEMP TABLE foo (x int) ON COMMIT DROP;
PREPARE TRANSACTION 't1';
Disconnect.
Wait (at least until backend process for first session exits).
Reconnect new session.
CREATE TEMP TABLE foo (x int); <-- blocks until t1 commits
The issue we see is that a totally unrelated session (which should have a unique temporary schema), reuses the temporary schema that is locked away in the prepared transaction. Isn't that breaking the assumption that each session should have a unique schema for its temp tables?
Thanks in advance for your insights.
Emmanuel-- Emmanuel Cecchet Aster Data Systems Web: http://www.asterdata.com
Re: Unique namespace per session for temp tables?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Emmanuel Cecchet writes: > Following the issue with temp tables and 2PC, we thought that each > session in Postgres was supposed to generate a unique namespace for its > temporary tables. You made that up out of sheer wishful thinking. There is one pg_temp schema per backendid slot. regards, tom lane