Search Postgresql Archives

No error message/code for commands after libpq pipeline abortion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am writing a Lua client library for PostgreSQL using libpq that
supports pipelining in an async/effect-based context.

I understand that when an error occurs, all subsequent commands also
fail (where PQgetResult returns PGRES_PIPELINE_ABORTED).

However, only the first command has an error message
via PQresultErrorMessage and an error code via
PQresultErrorField(..., PG_DIAG_SQLSTATE) set.

All other, subsequently obtained results lack an error message or an
SQLSTATE. I would expect something like "ERROR:  command failed due to
previous failure in pipeline", but I don't get anything like that.

Why is that? Is it intentional? Is it documented somewhere?

Further question: How do I deal with it with regard to the user of my
library? Should I make up my own error message? Which error code could
I set? I didn't find any appropriate error code in Appendix A of the
documentation.

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

My current approach is to just set "*" as an error code, which doesn't
feel good:

https://github.com/JanBeh/neumond/blob/9889c5fc19dbb23dff483e4a1cb2e4ef3ab74085/pgeff.c#L332-L345

Maybe I'm just overlooking something?

Kind regards,
Jan Behrens





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux