Thread: Unique namespace per session for temp tables?
Hi all,<br /><br /> Following the issue with temp tables and 2PC, we thought that each session in Postgres was supposedto generate a unique namespace for its temporary tables.<br /> But if we execute the following scenario:<br /><strong><br/> First session</strong>. <br /> BEGIN; <br /> CREATE TEMP TABLE foo (x int) ON COMMIT DROP; <br /> PREPARETRANSACTION 't1'; <br /><strong>Disconnect</strong>. <br /><strong>Wait</strong> (at least until backend process forfirst session exits). <br /><strong>Reconnect new session</strong>. <br /> CREATE TEMP TABLE foo (x int); <-- blocksuntil t1 commits <br /><br /> The issue we see is that a totally unrelated session (which should have a unique temporaryschema), reuses the temporary schema that is locked away in the prepared transaction. Isn't that breaking the assumptionthat each session should have a unique schema for its temp tables?<br /><br /> Thanks in advance for your insights.<br/> Emmanuel<br /><pre class="moz-signature" cols="72">-- Emmanuel Cecchet Aster Data Systems Web: <a class="moz-txt-link-freetext" href="http://www.asterdata.com">http://www.asterdata.com</a> </pre>
Emmanuel Cecchet <manu@asterdata.com> 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