Re: Is there public API to fetch errcode?

From: Sergey Fukanchik <s(dot)fukanchik(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Is there public API to fetch errcode?
Date: 2025-10-12 19:41:58
Message-ID: f0fa1acc-b994-4d16-8955-8ef8dffe9fb9@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

sqlstate is saved into conn->last_sqlstate along with the error message
in pqGetErrorNotice3:

        if (id == PG_DIAG_SQLSTATE)
            strlcpy(conn->last_sqlstate, workBuf.data,
                    sizeof(conn->last_sqlstate));

is this usable? Can it be extracted somehow?

---

Sergey

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-10-12 20:09:19 Re: Is there public API to fetch errcode?
Previous Message Michael Banck 2025-10-12 19:24:20 Re: GNU/Hurd portability patches