Re: Can the backend return more than one error message per PQexec?
От | Tom Lane |
---|---|
Тема | Re: Can the backend return more than one error message per PQexec? |
Дата | |
Msg-id | 21003.991778070@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Can the backend return more than one error message per PQexec? (Peter Eisentraut <peter_e@gmx.net>) |
Ответы |
Re: Can the backend return more than one error message
per PQexec?
|
Список | pgsql-hackers |
Peter Eisentraut <peter_e@gmx.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 errormessage 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
В списке pgsql-hackers по дате отправления: