From: | Jan Behrens <jbe-mlist(at)magnetkern(dot)de> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | No error message/code for commands after libpq pipeline abortion |
Date: | 2024-04-15 14:52:56 |
Message-ID: | 20240415165256.0ec1eab71c6425bca52ce3b4@magnetkern.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2024-04-15 14:55:43 | Re: (When) can a single SQL statement return multiple result sets? |
Previous Message | jack | 2024-04-15 14:45:49 | re: constant crashing hardware issue and thank you |