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.94.2) (envelope-from ) id 1usH8u-002ayZ-Em for pgsql-general@arkaria.postgresql.org; Sat, 30 Aug 2025 08:41:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1usH8t-00Epdl-Tu for pgsql-general@arkaria.postgresql.org; Sat, 30 Aug 2025 08:41:00 +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.94.2) (envelope-from ) id 1usGFa-00EbP1-D9 for pgsql-general@lists.postgresql.org; Sat, 30 Aug 2025 07:43:51 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1usGFY-002dj5-2y for pgsql-general@postgresql.org; Sat, 30 Aug 2025 07:43:50 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-55f687fd3bdso1908207e87.1 for ; Sat, 30 Aug 2025 00:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756539827; x=1757144627; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=M/lkz93tequv+cB68HMF+wnFYrQCo1Tjtf0T5V94x3Q=; b=ZFnNKTshDGppDkOWYCVi93PTtySNo5IE6wA99Ac52kHiHfhQz7ddNd0uBpGSu8bVY5 BJkcSLcPnHxtqJRH6mIcgY67Gm0SlQ2xdYV10l8fFDcEgVCVGfHpZn/YEUgjZ5w6y4Na h9zkcSFq3HLdw7E15LoxFoQwt1W3lJLC0wsODupWueDhSrv1au8jxGwZS0SJAmh5OZJA QbLncNAdtm29cVpnXidb50yds18C8N5uWi2dECBR7t8Q3/cralc8i9PXYx6AD1qKg/k1 P9Y5rcSqseVethbeB6W/eryDKlTOBzkmJkNrZy/UY/Nacy+ebu9kkacjuuVglGAVRrWU wp8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756539827; x=1757144627; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=M/lkz93tequv+cB68HMF+wnFYrQCo1Tjtf0T5V94x3Q=; b=dOi8Q661c2S4XzKcLeS5R+LEUzmESbA0WBwTa5DFz631IwYUVz3me180xJljI6fYfU 4/RYdDZ7riWLtlCKAl8sYbB54p8ze8xRggXHOD4EWFHlxXkflTpbPgd0RmBJEX60hBNB f2+VGTGf3FR/r2l9Tv0qPcoLfRjA1RuVPpQfd0N7+TTdMYOR4UrJUFl72svH/bYzHqct 0/AgHlItdiUVRtHSNEJUktyuuHqOF3VE57udkrR76CDVuRq9kEqoj1HksK7JVcvO4eJ7 IPhZDvyT+/tPv++CaX2dJ3Nzw5RV72hvXXlZTClviU0ijSlSAtLNHqSmT2wikX0o7Lrg r+Mg== X-Gm-Message-State: AOJu0YwJsI5Qk9ilof64yIVTYAJWpJrzsyGFRR9rbolI+97ucKTNS5Y0 zWHu/6Sd0BHSNPt2Jc7X2b7cmP//bht8BMujtOmpOhoWdaadCC3rAu+5e7+mbz8+4hUya5t0ZXR 9AADVgzvDawI0SqDmMQrV/SwlHd5MwasVYbkfxEA= X-Gm-Gg: ASbGnctXaqDObQSsVFw37fpom9zOwCQxP00El+IPWgEB1DzWx/6oE+r7FAyz689R/5h xdYYWFb4lzWH2sjfDrUJYzYw2Jvu/1xBpsEdu4DBWA4BO6EpDxSinwKIC/YfjYwS01YqsbzUev3 Et/tNIguwbWYykTSaL83Xe9YGjcoYv9+d/6lSNrtj9Vkf2vhaC3iUOsF6dZyTg8WYO4azJB1dEi XqVri/MVM5j6XWD8DH7hPNHpGkoumUxz+17YF56fI/J1wNKxfbK X-Google-Smtp-Source: AGHT+IH/LrArDUwNbTO2fY5x2nRM+iXRKTkNpVLFS8bSUjBsYDVIZ8v+A9Jdswj9+BIEay4+8wzAAlgZtoc5AQp20mM= X-Received: by 2002:a05:6512:b06:b0:55f:4407:55c with SMTP id 2adb3069b0e04-55f709886ecmr419538e87.48.1756539827157; Sat, 30 Aug 2025 00:43:47 -0700 (PDT) MIME-Version: 1.0 From: Sagar Tiwari Date: Sat, 30 Aug 2025 13:13:35 +0530 X-Gm-Features: Ac12FXyTuf9yD891Mey7_Nx1iDLwkBrfZfSt3D3Z_EwIZJ1pRDyeKx0u5Ut4Z7w Message-ID: Subject: Saw some strange behavior when using `INSERT ON CONFLICT` inside a transaction. To: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="0000000000006e7d99063d904c55" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000006e7d99063d904c55 Content-Type: text/plain; charset="UTF-8" Repro steps: * I created the table: ``` create table t (col TEXT primary key); ``` * Open two database consoles and use the following queries in them: ``` 1 begin; 2 select txid_current(); 3 insert into t (col) values ('test') on conflict (col) do nothing; 4 commit; ``` I ran 1 and 2 in both. It worked for both. And then I ran query 3 in the first console. It worked. After that I ran query 3 in the second console. It got stuck! When I commit the tx in first console, the stuck query in second console finishes The transaction isolation level is 'read committed'. -- Best Regards Sagar Tiwari --0000000000006e7d99063d904c55 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Repro steps:
*=C2=A0I created the table:
```
create table=C2=A0t (col TEXT p= rimary key);
```

*=C2=A0Open two database consoles and use the follow= ing queries in them:

```
1 begin;
2 select txid_current();
3 in= sert into t (col) values ('test')=C2=A0on conflict (col) do nothi= ng;
4 commit;
```

I ran 1 and 2 in bo= th. It worked for both.
And then I ran query 3 in the first console. It= worked.
After that I ran query 3 in the second console. It got stuck!When I commit the tx in first console, the stuck query in second console = finishes
The transaction isolation level is 'read committed'.=C2= =A0

--
=
Best Regards
Sagar Tiwari
--0000000000006e7d99063d904c55--