Is there public API to fetch errcode?

Поиск
Список
Период
Сортировка
От Sergey Fukanchik
Тема Is there public API to fetch errcode?
Дата
Msg-id 125437e5-25c8-49ad-99af-8de04b77daf6@postgrespro.ru
обсуждение исходный текст
Ответы Re: Is there public API to fetch errcode?
Список pgsql-hackers
Hi Postgres hackers,
ereport() can accept an error code. For example:
             ereport(FATAL,
                     (errcode(ERRCODE_TOO_MANY_CONNECTIONS),
                      errmsg("number of requested standby connections 
exceeds \"max_wal_senders\" (currently %d)",
                             max_wal_senders)));

In this case the error happens during connection initialization, outside 
of an SQL query. I.e. PGresult is not available.

I suspect that the error code is available on the client as 
PGconn->last_sqlstate however it is private and I can't find any public 
API to fetch it.

Does libpq have an API to extract this code?

---

Sergey




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