Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlTZy-00Clm3-1V for pgsql-general@arkaria.postgresql.org; Thu, 29 Jan 2026 15:05:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlTZw-009nW0-0g for pgsql-general@arkaria.postgresql.org; Thu, 29 Jan 2026 15:05:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlTZv-009nVk-2k for pgsql-general@lists.postgresql.org; Thu, 29 Jan 2026 15:05:04 +0000 Received: from crumpet.qq2.net ([80.247.17.44]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vlTZs-000000001Dw-2j66 for pgsql-general@lists.postgresql.org; Thu, 29 Jan 2026 15:05:03 +0000 Received: from by crumpet.qq2.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.94.2) (envelope-from ) id 1vlTZq-005f26-0m for pgsql-general@lists.postgresql.org ; Thu, 29 Jan 2026 15:04:58 +0000 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-47edd9024b1so9184985e9.3 for ; Thu, 29 Jan 2026 07:04:58 -0800 (PST) X-Gm-Message-State: AOJu0Yw0smvaBcLkLGXoRqkEXVVNNmr4GpGzlX7GokxQ+4Z99KYHzxwb e1FJEArh4Zs6CFodfk+MoOCOiP+pZHNtlut+f1V1OIU8vKMNbiUPeBK1bxnehY8XYzwB+gIJ7AQ tIyuTHhTIWc5qr2U9t/ALmLbraW5PlQ== X-Received: by 2002:a05:600c:4e15:b0:477:97c7:9be7 with SMTP id 5b1f17b1804b1-48069c2c146mr116748625e9.1.1769699097642; Thu, 29 Jan 2026 07:04:57 -0800 (PST) MIME-Version: 1.0 From: Geoff Winkless Date: Thu, 29 Jan 2026 15:04:43 +0000 X-Gmail-Original-Message-ID: X-Gm-Features: AZwV_QjUjDEFiBzuYhkOP5JeW5UJeIDM8eU8ZjrtoMXrGc7pM5WdZdDi8jM53f0 Message-ID: To: "pgsql-generallists.postgresql.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on crumpet.qq2.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 Subject: UNLOGGED table CREATEd on one connection not immediately visible to another connection X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi 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. If we were somehow failing to create the table then the retries would never work, and we absolutely don't send the qreftmp ID to the second process until we've successfully INSERTed all of the records, so the race isn't on the application side. There's no explicit transactions in either process involved, they all just use implicit autocommit, so I don't see that this can be a DDL versioning issue. I'm loathe to point the finger at PG because I'm sure that if this were a real issue it would have been flagged up well before now, but I've been staring at our code for days and I'm stumped. Any suggestions? Thanks Geoff