pull/1334/merge
Svyatoslav 2017-04-21 14:50:12 +00:00 committed by GitHub
commit b2ea8217b5
1 changed files with 10 additions and 7 deletions

View File

@ -435,19 +435,22 @@ static void
StoreErrorMessage(PGconn *connection, StringInfo queryResultString)
{
char *errorMessage = PQerrorMessage(connection);
char *firstNewlineIndex = strchr(errorMessage, '\n');
/* trim the error message at the line break */
if (firstNewlineIndex != NULL)
{
*firstNewlineIndex = '\0';
}
/* put a default error message if no error message is reported */
if (errorMessage == NULL)
{
errorMessage = "An error occurred while running the query";
}
else
{
char *firstNewlineIndex = strchr(errorMessage, '\n');
/* trim the error message at the line break */
if (firstNewlineIndex != NULL)
{
*firstNewlineIndex = '\0';
}
}
appendStringInfo(queryResultString, "%s", errorMessage);
}