mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Document and use SPI_result_code_string()
A lot of semi-internal code just prints out numeric SPI error codes, which is not very helpful. We already have an API function to convert the codes to a string, so let's make more use of that. Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
@ -182,7 +182,7 @@ check_primary_key(PG_FUNCTION_ARGS)
|
||||
pplan = SPI_prepare(sql, nkeys, argtypes);
|
||||
if (pplan == NULL)
|
||||
/* internal error */
|
||||
elog(ERROR, "check_primary_key: SPI_prepare returned %d", SPI_result);
|
||||
elog(ERROR, "check_primary_key: SPI_prepare returned %s", SPI_result_code_string(SPI_result));
|
||||
|
||||
/*
|
||||
* Remember that SPI_prepare places plan in current memory context -
|
||||
@ -395,7 +395,7 @@ check_foreign_key(PG_FUNCTION_ARGS)
|
||||
/* this shouldn't happen! SPI_ERROR_NOOUTFUNC ? */
|
||||
if (oldval == NULL)
|
||||
/* internal error */
|
||||
elog(ERROR, "check_foreign_key: SPI_getvalue returned %d", SPI_result);
|
||||
elog(ERROR, "check_foreign_key: SPI_getvalue returned %s", SPI_result_code_string(SPI_result));
|
||||
newval = SPI_getvalue(newtuple, tupdesc, fnumber);
|
||||
if (newval == NULL || strcmp(oldval, newval) != 0)
|
||||
isequal = false;
|
||||
@ -529,7 +529,7 @@ check_foreign_key(PG_FUNCTION_ARGS)
|
||||
pplan = SPI_prepare(sql, nkeys, argtypes);
|
||||
if (pplan == NULL)
|
||||
/* internal error */
|
||||
elog(ERROR, "check_foreign_key: SPI_prepare returned %d", SPI_result);
|
||||
elog(ERROR, "check_foreign_key: SPI_prepare returned %s", SPI_result_code_string(SPI_result));
|
||||
|
||||
/*
|
||||
* Remember that SPI_prepare places plan in current memory context
|
||||
|
Reference in New Issue
Block a user