Re: Try catch error, return data

Поиск
Список
Период
Сортировка
От Skylar Thompson
Тема Re: Try catch error, return data
Дата
Msg-id 20220216030846.v7g4ggin5om7xwpu@hithlum
обсуждение исходный текст
Ответ на Try catch error, return data  (Shaozhong SHI <shishaozhong@gmail.com>)
Список pgsql-sql
I think you're looking for EXCEPTION:

https://www.postgresql.org/docs/14/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

At the point you've trapped the error, you can then return something based
on the error. You can find a list of exception codes in one of the
appendices:

https://www.postgresql.org/docs/14/errcodes-appendix.html

On Wed, Feb 16, 2022 at 02:13:05AM +0000, Shaozhong SHI wrote:
> In Python, one can use try statement to catch error, error can be stored as
> data.
> 
> Can plpgsql catch and return error as data or a data table?
> 
> Regards, David

-- 
-- Skylar Thompson (skylar2@u.washington.edu)
-- Genome Sciences Department (UW Medicine), System Administrator
-- Foege Building S046, (206)-685-7354
-- Pronouns: He/Him/His



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

Предыдущее
От: Shaozhong SHI
Дата:
Сообщение: Is there a way to automatically scan a table and determine the format of data
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Re: Try catch error, return data