Re: How do Exception, do nothing and carry on

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: How do Exception, do nothing and carry on
Дата
Msg-id CAKFQuwaaStSXsa0ZbBAxUujY02iUgCTJF=X3m0kCbPq=Lk+gLw@mail.gmail.com
обсуждение исходный текст
Ответ на How do Exception, do nothing and carry on  (Shaozhong SHI <shishaozhong@gmail.com>)
Список pgsql-sql


On Thursday, July 6, 2023, Shaozhong SHI <shishaozhong@gmail.com> wrote:
The function in the following block code may fail.

How to make it to carry on by ignoring exception?

Something like Python's try catch.

for i in (select distinct id from id_table) 
  loop
         raise notice '%', i;
           insert into my_table(id, last, arr, count) SELECT i, * from my_function(i) f(last int, arr int[], count int);
           commit;

  end loop;

Create a new function that traps [1] the failure and throws it away, then call that function instead.


David J.

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

Предыдущее
От: Shaozhong SHI
Дата:
Сообщение: How do Exception, do nothing and carry on
Следующее
От: Shaozhong SHI
Дата:
Сообщение: How to remove duplicates in an array and maintain the order?