public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jan Behrens <[email protected]>
To: [email protected]
Subject: No error message/code for commands after libpq pipeline abortion
Date: Mon, 15 Apr 2024 16:52:56 +0200
Message-ID: <[email protected]> (raw)

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






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: No error message/code for commands after libpq pipeline abortion
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox