Re: temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ?

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ?
Date: 2014-05-07 18:13:56
Message-ID: 1399486436626-5803003.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Why cannot you just:

Open Connection
Begin;
Create TEMP Tables
Do stuff with TEMP Tables
Commit;
Close Connection (auto-drops TEMP tables)

Also, figuring out if you code is broken is much easier if we can actually
see the code; describing it only in plain English doesn't usually result in
people providing useful answers. Both code and description are usually
needed.

Temporary tables are session-local and so as long as you do not actively
share a connection dropping temporary tables and these kinds of concurrency
errors should be impossible. Since you are seeing them, and you feel the
need to drop temporary tables, either you are doing things wrong or at
minimum doing unnecessary work.

Server processes (PostgreSQL is process, not thread, based) are connection
(and thus session) oriented.

Client threads/processes are whatever you tell your code to do; connections
themselves are not inherently thread-safe so if you are multi-threading and
sharing connections you are doing something highly discouraged and, given
the errors, are doing so incorrectly.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/temp-table-problem-due-to-thread-concurrency-ERROR-could-not-open-file-base-tp5802963p5803003.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ludovic POLLET 2014-05-12 09:44:48 Re: TR: [BUGS] BUG #8842: lo_open/fastpath transaction inconsistency
Previous Message Jan-Peter Seifert 2014-05-07 15:45:21 temp table problem due to thread concurrency ( ERROR: could not open file "base/ ) ?