Fix crash on Windows where there is no detail

pull/2102/head
Brian Cloutier 2018-03-29 23:38:31 +00:00 committed by Brian Cloutier
parent f54ed5d3b0
commit 42ddfa176d
2 changed files with 2 additions and 3 deletions

View File

@ -1233,9 +1233,10 @@ ReportCopyError(MultiConnection *connection, PGresult *result)
{ {
/* probably a constraint violation, show remote message and detail */ /* probably a constraint violation, show remote message and detail */
char *remoteDetail = PQresultErrorField(result, PG_DIAG_MESSAGE_DETAIL); char *remoteDetail = PQresultErrorField(result, PG_DIAG_MESSAGE_DETAIL);
bool haveDetail = remoteDetail != NULL;
ereport(ERROR, (errmsg("%s", remoteMessage), ereport(ERROR, (errmsg("%s", remoteMessage),
errdetail("%s", remoteDetail))); haveDetail ? errdetail("%s", remoteDetail) : 0));
} }
else else
{ {

View File

@ -2618,7 +2618,6 @@ FROM (
) AS ftop ) AS ftop
LIMIT 5; LIMIT 5;
ERROR: value too long for type character(1) ERROR: value too long for type character(1)
DETAIL: (null)
SELECT * FROM coerce_agg; SELECT * FROM coerce_agg;
user_id | value_1_agg user_id | value_1_agg
---------+------------- ---------+-------------
@ -2637,7 +2636,6 @@ FROM (
) AS ftop ) AS ftop
LIMIT 5; LIMIT 5;
ERROR: value too long for type character(1) ERROR: value too long for type character(1)
DETAIL: (null)
-- char(1) -> char(5) -- char(1) -> char(5)
ALTER TABLE coerce_events ALTER COLUMN value_1 TYPE char(1) USING value_1::char(1); ALTER TABLE coerce_events ALTER COLUMN value_1 TYPE char(1) USING value_1::char(1);
ALTER TABLE coerce_agg ALTER COLUMN value_1_agg TYPE char(5); ALTER TABLE coerce_agg ALTER COLUMN value_1_agg TYPE char(5);