Re: [HACKERS] psql - add special variable to reflect the last querystatus
От | Fabien COELHO |
---|---|
Тема | Re: [HACKERS] psql - add special variable to reflect the last querystatus |
Дата | |
Msg-id | alpine.DEB.2.20.1709121909060.30961@lancre обсуждение исходный текст |
Ответ на | Re: [HACKERS] psql - add special variable to reflect the last querystatus (Fabien COELHO <coelho@cri.ensmp.fr>) |
Ответы |
Re: [HACKERS] psql - add special variable to reflect the last query status
|
Список | pgsql-hackers |
Hello Tom, >>> Yep, I thought I was optimistic:-) Can I add a special SQLSTATE for that >>> situation where libpq did not report an error? >> >> Meh. If we're going to do that I think it might be better to hack >> libpq itself to do so, ie, force PQresultErrorField(..., PG_DIAG_SQLSTATE) >> to always return something. But it seems like a hack either way. > > I would not have took the liberty to hack into libpq internals for such a > small front-end feature. However I agree that having libpq always return some > diagnostic, even if it means "something unclear happened, sorry not to be > very precise", would be better. Here is an attempt at implementing your suggestions. I added two error codes, which is debatable. One is used hardcoded by libpq if no diagnostic is found, and the other by psql if libpq returned something empty, which might happen if psql is linked with an older libpq, maybe. I do not know how to trigger such errors anyway, so this is rather academic. I put back SetResultVariables function which is called twice, for SQL queries and the new descriptions. It worked out of the box with DECLARE which is just another SQL statement, so maybe I did not understood the cursor issue you were signaling... -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Вложения
В списке pgsql-hackers по дате отправления: