Skip to content

Commit

Permalink
Slightly changed output:
Browse files Browse the repository at this point in the history
* no explicit error code when NOT_KNOWN_ERROR
* even for NOT_KNOWN_ERROR sqlstate is filled as this happens for custom
  sql states raised from plpgsql code
  • Loading branch information
Matěj Klonfar committed Apr 21, 2023
1 parent cd5080b commit 775a430
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions logerrors.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ put_values_to_tuple(
if (found)
long_interval_values[2] = CStringGetTextDatum(err_name->name);
else {
sprintf(err_name_str, "NOT_KNOWN_ERROR: %d", key.error_code);
sprintf(err_name_str, "NOT_KNOWN_ERROR");
long_interval_values[2] = CStringGetTextDatum(err_name_str);
}
/* Count */
Expand All @@ -575,12 +575,7 @@ put_values_to_tuple(
long_interval_values[5] = CStringGetTextDatum(db_name);

/* SQLState */
if (found) {
long_interval_values[6] = CStringGetTextDatum(unpack_sql_state(err_code.num));
}
else {
long_interval_nulls[6] = true;
}
long_interval_values[6] = CStringGetTextDatum(unpack_sql_state(err_code.num));

if (elem->counter > 0) {
tuplestore_putvalues(tupstore, tupdesc, long_interval_values, long_interval_nulls);
Expand Down

0 comments on commit 775a430

Please sign in to comment.