Re: Is there public API to fetch errcode?
От | Sergey Fukanchik |
---|---|
Тема | Re: Is there public API to fetch errcode? |
Дата | |
Msg-id | 9fca92c3-eb3d-46fd-ad3b-4b2d37c7d2dd@postgrespro.ru обсуждение исходный текст |
Ответ на | Re: Is there public API to fetch errcode? (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
So the difference between conn->errorMessage and conn->last_sqlstate is that erorrMessage is appended and last_sqstate is overwritten. And it seems that changing this is not easy. As to why I want this - there are several reasons for connection to be rejected, like ERRCODE_CANNOT_CONNECT_NOW, ERRCODE_TOO_MANY_CONNECTIONS, ERRCODE_INSUFFICIENT_PRIVILEGE, ERRCODE_DATA_CORRUPTED etc I would like my client to behave differently based on a particular errcode - sometimes wait and retry, sometimes choose another server, sometimes just fail. It would be perfect if I could simply configure libpq to do such reactions automatically for me, but designing this properly seems to be even harder than exposing connection sqlstate. SQLSTATE codes are locale independent and it would help a lot if I could use them instead of relying on localized messages. --- Sergey
В списке pgsql-hackers по дате отправления: