Re: How to tell why an insert failed?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to tell why an insert failed?
Дата
Msg-id 11327.1025043821@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How to tell why an insert failed?  (Jeremy Cowgar <develop@cowgar.com>)
Список pgsql-general
Jeremy Cowgar <develop@cowgar.com> writes:
> In C I would like to tell if an insert failed and why. In particular if
> it failed because of a duplicate value in a field marked unique.

Right now, the only way to tell this is to look at the error message
(PQerrorMessage), which will say something like

ERROR:  Cannot insert a duplicate key into unique index foo_f1_key

This is pretty grotty, but until we get around to supporting proper
error codes, it's the only way ...

            regards, tom lane



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

Предыдущее
От: Elaine Lindelef
Дата:
Сообщение: What is a tuple?
Следующее
От: "Jeff MacDonald"
Дата:
Сообщение: Re: Advocacy Idea.