public inbox for [email protected]  
help / color / mirror / Atom feed
infinite loop in an update statement
4+ messages / 3 participants
[nested] [flat]

* infinite loop in an update statement
@ 2024-09-09 14:55  Fabrice Chapuis <[email protected]>
  0 siblings, 2 replies; 4+ messages in thread

From: Fabrice Chapuis @ 2024-09-09 14:55 UTC (permalink / raw)
  To: pgsql-general

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


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: infinite loop in an update statement
@ 2024-09-09 15:00  Tom Lane <[email protected]>
  parent: Fabrice Chapuis <[email protected]>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2024-09-09 15:00 UTC (permalink / raw)
  To: Fabrice Chapuis <[email protected]>; +Cc: pgsql-general

Fabrice Chapuis <[email protected]> writes:
> 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)

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

			regards, tom lane






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: infinite loop in an update statement
@ 2024-09-09 15:00  Adrian Klaver <[email protected]>
  parent: Fabrice Chapuis <[email protected]>
  1 sibling, 1 reply; 4+ messages in thread

From: Adrian Klaver @ 2024-09-09 15:00 UTC (permalink / raw)
  To: Fabrice Chapuis <[email protected]>; pgsql-general

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.
> 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)

Do you have an UPDATE trigger on table_a?

> 
> Regards,
> 
> Fabrice
> 
> 

-- 
Adrian Klaver
[email protected]







^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: infinite loop in an update statement
@ 2024-09-10 14:57  Adrian Klaver <[email protected]>
  parent: Adrian Klaver <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Adrian Klaver @ 2024-09-10 14:57 UTC (permalink / raw)
  To: Fabrice Chapuis <[email protected]>; +Cc: pgsql-general

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 protected] 
> <mailto:[email protected]>> wrote:
> 
>     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.
>      > 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)
> 
>     Do you have an UPDATE trigger on table_a?
> 
>      >
>      > Regards,
>      >
>      > Fabrice
>      >
>      >
> 
>     -- 
>     Adrian Klaver
>     [email protected] <mailto:[email protected]>
> 

-- 
Adrian Klaver
[email protected]







^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2024-09-10 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-09 14:55 infinite loop in an update statement Fabrice Chapuis <[email protected]>
2024-09-09 15:00 ` Tom Lane <[email protected]>
2024-09-09 15:00 ` Adrian Klaver <[email protected]>
2024-09-10 14:57   ` Adrian Klaver <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox