* Report just the primary error; this is to avoid cluttering the output * with, for instance, a redisplay of the internally generated query */
| 5404 | * with, for instance, a redisplay of the internally generated query |
| 5405 | */ |
| 5406 | static void |
| 5407 | minimal_error_message(PGresult *res) |
| 5408 | { |
| 5409 | PQExpBuffer msg; |
| 5410 | const char *fld; |
| 5411 | |
| 5412 | msg = createPQExpBuffer(); |
| 5413 | |
| 5414 | fld = PQresultErrorField(res, PG_DIAG_SEVERITY); |
| 5415 | if (fld) |
| 5416 | printfPQExpBuffer(msg, "%s: ", fld); |
| 5417 | else |
| 5418 | printfPQExpBuffer(msg, "ERROR: "); |
| 5419 | fld = PQresultErrorField(res, PG_DIAG_MESSAGE_PRIMARY); |
| 5420 | if (fld) |
| 5421 | appendPQExpBufferStr(msg, fld); |
| 5422 | else |
| 5423 | appendPQExpBufferStr(msg, "(not available)"); |
| 5424 | appendPQExpBufferChar(msg, '\n'); |
| 5425 | |
| 5426 | pg_log_error("%s", msg->data); |
| 5427 | |
| 5428 | destroyPQExpBuffer(msg); |
| 5429 | } |
no test coverage detected