Subject: infinite loop in an update statement

From: Fabrice Chapuis <[email-masked]>
Date: Mon, 9 Sep 2024 16:55:01 +0200

Hi,

table a and b are empty, this query does not return. It seems we enter in
infinite loop.
why this update does not return instantly?

UPDATE table_a a
 SET col1 = (SELECT MIN(b.col1)
                    FROM table_b b
                    WHERE b.col2 = a.col2)

Regards,

Fabrice

---

From: Tom Lane <[email-masked]>
Date: Mon, 09 Sep 2024 11:00:12 -0400

>  SET col1 = (SELECT MIN(b.col1)

Maybe query is waiting for a lock on one of those tables?

			regards, tom lane

---

From: Adrian Klaver <[email-masked]>
Date: Mon, 9 Sep 2024 08:00:19 -0700

On 9/9/24 07:55, Fabrice Chapuis wrote:
> Hi,
> 
> table a and b are empty, this query does not return. It seems we enter 
> in infinite loop.

Do you have an UPDATE trigger on table_a?

-- 
Adrian Klaver
[email-masked]

---

From: Adrian Klaver <[email-masked]>
Date: Tue, 10 Sep 2024 07:57:40 -0700

On 9/10/24 07:47, Fabrice Chapuis wrote:
Reply to list also
Ccing list

> no trigger on theses tables

> 
> On Mon, Sep 9, 2024 at 5:00 PM Adrian Klaver <[email-masked] 
> <mailto:[email-masked]>> wrote:
> 
>     [email-masked] <mailto:[email-masked]>
>