delete inside for plpgsql loop on same relation?

Поиск
Список
Период
Сортировка
От Rob Nikander
Тема delete inside for plpgsql loop on same relation?
Дата
Msg-id C12E9EA5-5B1A-44C7-9A4D-F01F12261A07@gmail.com
обсуждение исходный текст
Ответы Re: delete inside for plpgsql loop on same relation?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

Are there guarantees about how this plpgsql behaves? It’s deleting from a table while it loops over it. So far it seems
likethe delete is logically after the select, as I hoped, and doesn’t interfere.  

    for row in select * from some_stuff loop
        delete from some_stuff where …
        ...
    end loop;

I’m using a temporary table of “things to process” and looping over it, deleting the ones as I go.

I don’t see anything mentioned here:
https://www.postgresql.org/docs/11/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING

Rob


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Is array_append O(n)?
Следующее
От: Michael Curry
Дата:
Сообщение: Re: perf tuning for 28 cores and 252GB RAM