public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Geoff Winkless <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: UNLOGGED table CREATEd on one connection not immediately visible to another connection
Date: Thu, 29 Jan 2026 10:41:27 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEzk6ff5yHiJWDCoLcmqwC36O=VqLEHjbU2pcpYpOvdScM3t5g@mail.gmail.com>
References: <CAEzk6ff5yHiJWDCoLcmqwC36O=VqLEHjbU2pcpYpOvdScM3t5g@mail.gmail.com>
Geoff Winkless <[email protected]> writes:
> In our application we have a situation where once a day one process
> CREATEs an UNLOGGED table and INSERTs several hundred records using
> individual queries (no explicit transactions) all of which return
> successfully. We then send the ID of the table that we have created
> over a TCP socket to a second process, which runs a query that JOINs
> against that new table.
> Unfortunately quite often the second process is getting a
> PGRES_FATAL_ERROR with
> Primary: relation "qreftmp750" does not exist
> Now (and this is very important) this appears to be a race condition,
> because when that process immediately retries the same query (which we
> do when we get FATAL_ERROR) it sometimes works on the second or third
> (or even 11th) attempt.
Perhaps the second process is querying a standby server rather than
the primary? Replication lag could explain this. I don't really
believe that it's possible within a single PG server, though.
We take very substantial pains to avoid the race condition you're
positing.
If there is anything in your client software stack capable of issuing
implicit begin/commit, that'd deserve a second/third/fourth look...
regards, tom lane
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: UNLOGGED table CREATEd on one connection not immediately visible to another connection
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox