Re: pg_proc.dat "proargmodes is not a 1-D char array"

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pg_proc.dat "proargmodes is not a 1-D char array"
Дата
Msg-id 20201117130201.GA31272@alvherre.pgsql
обсуждение исходный текст
Ответ на pg_proc.dat "proargmodes is not a 1-D char array"  (Craig Ringer <craig@2ndquadrant.com>)
Ответы Re: pg_proc.dat "proargmodes is not a 1-D char array"
Список pgsql-hackers
On 2020-Sep-30, Craig Ringer wrote:

> Hi all
> 
> Random tip for future searchers. If you've modified pg_proc.dat and  initdb
> fails with "proargmodes is not a 1-D char array" - it could well actually
> be that the length of proargmodes does not match the length of
> proallargtypes given the test
> 
>                         ARR_DIMS(arr)[0] != numargs ||
> 
> in funcapi.c.

Perhaps we can improve these error messages like below.  (Or maybe just
keep it one message "proargmodes is not a 1-D char array of %d
elements"?)  There are about 5 places to change I think.

diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c
index b9efa77291..c76c16f799 100644
--- a/src/backend/utils/fmgr/funcapi.c
+++ b/src/backend/utils/fmgr/funcapi.c
@@ -1167,10 +1167,11 @@ get_func_arg_info(HeapTuple procTup,
     {
         arr = DatumGetArrayTypeP(proargmodes);    /* ensure not toasted */
         if (ARR_NDIM(arr) != 1 ||
-            ARR_DIMS(arr)[0] != numargs ||
             ARR_HASNULL(arr) ||
             ARR_ELEMTYPE(arr) != CHAROID)
             elog(ERROR, "proargmodes is not a 1-D char array");
+        if (ARR_DIMS(arr)[0] != numargs)
+            elog(ERROR, "proargmodes is not %d elements long", numargs);
         *p_argmodes = (char *) palloc(numargs * sizeof(char));
         memcpy(*p_argmodes, ARR_DATA_PTR(arr),
                numargs * sizeof(char));



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Use standard SIGHUP and SIGTERM handlers in autoprewarm module
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [patch] [doc] Clarify that signal functions have no feedback