|From:||Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>|
|To:||Peter Eisentraut <peter_e(at)gmx(dot)net>|
|Cc:||PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||Re: Can the backend return more than one error message per PQexec?|
|Views:||Raw Message | Whole Thread | Download mbox|
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> In PQexec() and also in parseInput() (both fe-exec.c) there is a provision
> for, if more than one result set is returned, to concatenate the error
> messages (while only returning the last result set). My question is how a
> backend can return more than one error message per query string?
That concatenation hack was added to deal with an actual case where
information was getting dropped, but I am not sure that it was something
that would arise in the normal protocol. IIRC it was something like
1. backend sends error in response to bogus user query;
2. backend encounters fatal problem during error cleanup (or gets
shutdown signal from postmaster), and sends another error message
to indicate this before it closes up shop.
I think there may also be cases where we need to stuff both
backend-generated messages and libpq-generated messages into the
error result. That doesn't directly affect the protocol however.
Since there will always be asynchronous conditions to deal with, it'd
be pretty foolish to design a protocol that assumes that exactly one
'E' message will arrive during a PQexec cycle.
> I am currently looking into extending the protocol so that more fields can
> be in an ErrorResponse (e.g., error codes). If this were to happen then
> we'd need a smarter way of handling more than one error message per cycle.
Only if you want to overload ErrorResponse so that successive 'E'
messages mean different things. I do not think that would be a good
design. It'd be better to allow ErrorResponse to carry multiple fields.
This'd imply a protocol version bump, but so what? Changing the
semantics of ErrorResponse probably ought to require that anyway.
(I have some other ideas that would require a protocol version bump too,
like fixing the broken COPY and FastPath parts of the protocol...)
regards, tom lane
|Next Message||Mauricio Breternitz||2001-06-05 22:00:02||Re: database synchronization|
|Previous Message||Thomas Swan||2001-06-05 21:31:05||BLOBs|