On Sat, Feb 25, 2023 at 08:58:17PM -0800, Nathan Bossart wrote: > pg_input_error_info() seems more descriptive to me. I changed the name to > that in v4.
error_info() is fine by me. My recent history is poor lately when it comes to name new things. + values[0] = CStringGetTextDatum(escontext.error_data->message); + + if (escontext.error_data->detail != NULL) + values[1] = CStringGetTextDatum(escontext.error_data->detail); + else + isnull[1] = true; + + if (escontext.error_data->hint != NULL) + values[2] = CStringGetTextDatum(escontext.error_data->hint); + else + isnull[2] = true; + + values[3] = CStringGetTextDatum( + unpack_sql_state(escontext.error_data->sqlerrcode)); I am OK with this data set as well. If somebody makes a case about more fields in ErrorData, we could always consider these separately. FWIW, I would like to change some of the regression tests as we are bikeshedding the whole. +SELECT pg_input_error_info(repeat('too_long', 32), 'rainbow'); For example, we could use the expanded display for this case in enum.sql. -- test non-error-throwing API SELECT str as jsonpath, pg_input_is_valid(str,'jsonpath') as ok, - pg_input_error_message(str,'jsonpath') as errmsg + pg_input_error_info(str,'jsonpath') as errmsg This case in jsonpath.sql is actually wrong, because we have more than just the error message. For the others, I would make the choice of expanding the calls of pg_input_error_info() rather than just showing row outputs, though I agree that this part is minor. -- Michael
signature.asc
Description: PGP signature