Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe05129

Browse files
committed
Make some sanity-check elogs more verbose
A few sanity checks in funcapi.c were not mentioning all the possibleclauses for failure, confusing developers who fat-fingered catalog dataadditions. Make the errors more detailed to avoid wasting time inpinpointing mistakes.Per complaint from Craig Ringer.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CAMsr+YH7Kd87A3cU5m_wKo46HPQ46zFv5wesFNL0YWxkGhGv3g@mail.gmail.com
1 parent68b1a48 commitfe05129

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

‎src/backend/utils/fmgr/funcapi.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ get_func_arg_info(HeapTuple procTup,
11231123
numargs<0||
11241124
ARR_HASNULL(arr)||
11251125
ARR_ELEMTYPE(arr)!=OIDOID)
1126-
elog(ERROR,"proallargtypes is not a 1-D Oid array");
1126+
elog(ERROR,"proallargtypes is not a 1-D Oid array or it contains nulls");
11271127
Assert(numargs >=procStruct->pronargs);
11281128
*p_argtypes= (Oid*)palloc(numargs*sizeof(Oid));
11291129
memcpy(*p_argtypes,ARR_DATA_PTR(arr),
@@ -1170,7 +1170,8 @@ get_func_arg_info(HeapTuple procTup,
11701170
ARR_DIMS(arr)[0]!=numargs||
11711171
ARR_HASNULL(arr)||
11721172
ARR_ELEMTYPE(arr)!=CHAROID)
1173-
elog(ERROR,"proargmodes is not a 1-D char array");
1173+
elog(ERROR,"proargmodes is not a 1-D char array of length %d or it contains nulls",
1174+
numargs);
11741175
*p_argmodes= (char*)palloc(numargs*sizeof(char));
11751176
memcpy(*p_argmodes,ARR_DATA_PTR(arr),
11761177
numargs*sizeof(char));
@@ -1210,7 +1211,7 @@ get_func_trftypes(HeapTuple procTup,
12101211
nelems<0||
12111212
ARR_HASNULL(arr)||
12121213
ARR_ELEMTYPE(arr)!=OIDOID)
1213-
elog(ERROR,"protrftypes is not a 1-D Oid array");
1214+
elog(ERROR,"protrftypes is not a 1-D Oid array or it contains nulls");
12141215
Assert(nelems >= ((Form_pg_proc)GETSTRUCT(procTup))->pronargs);
12151216
*p_trftypes= (Oid*)palloc(nelems*sizeof(Oid));
12161217
memcpy(*p_trftypes,ARR_DATA_PTR(arr),
@@ -1261,7 +1262,7 @@ get_func_input_arg_names(char prokind,
12611262
if (ARR_NDIM(arr)!=1||
12621263
ARR_HASNULL(arr)||
12631264
ARR_ELEMTYPE(arr)!=TEXTOID)
1264-
elog(ERROR,"proargnames is not a 1-D text array");
1265+
elog(ERROR,"proargnames is not a 1-D text array or it contains nulls");
12651266
deconstruct_array(arr,TEXTOID,-1, false,TYPALIGN_INT,
12661267
&argnames,NULL,&numargs);
12671268
if (proargmodes!=PointerGetDatum(NULL))
@@ -1271,7 +1272,8 @@ get_func_input_arg_names(char prokind,
12711272
ARR_DIMS(arr)[0]!=numargs||
12721273
ARR_HASNULL(arr)||
12731274
ARR_ELEMTYPE(arr)!=CHAROID)
1274-
elog(ERROR,"proargmodes is not a 1-D char array");
1275+
elog(ERROR,"proargmodes is not a 1-D char array of length %d or it contains nulls",
1276+
numargs);
12751277
argmodes= (char*)ARR_DATA_PTR(arr);
12761278
}
12771279
else
@@ -1368,14 +1370,15 @@ get_func_result_name(Oid functionId)
13681370
numargs<0||
13691371
ARR_HASNULL(arr)||
13701372
ARR_ELEMTYPE(arr)!=CHAROID)
1371-
elog(ERROR,"proargmodes is not a 1-D char array");
1373+
elog(ERROR,"proargmodes is not a 1-D char array or it contains nulls");
13721374
argmodes= (char*)ARR_DATA_PTR(arr);
13731375
arr=DatumGetArrayTypeP(proargnames);/* ensure not toasted */
13741376
if (ARR_NDIM(arr)!=1||
13751377
ARR_DIMS(arr)[0]!=numargs||
13761378
ARR_HASNULL(arr)||
13771379
ARR_ELEMTYPE(arr)!=TEXTOID)
1378-
elog(ERROR,"proargnames is not a 1-D text array");
1380+
elog(ERROR,"proargnames is not a 1-D text array of length %d or it contains nulls",
1381+
numargs);
13791382
deconstruct_array(arr,TEXTOID,-1, false,TYPALIGN_INT,
13801383
&argnames,NULL,&nargnames);
13811384
Assert(nargnames==numargs);
@@ -1506,14 +1509,15 @@ build_function_result_tupdesc_d(char prokind,
15061509
numargs<0||
15071510
ARR_HASNULL(arr)||
15081511
ARR_ELEMTYPE(arr)!=OIDOID)
1509-
elog(ERROR,"proallargtypes is not a 1-D Oid array");
1512+
elog(ERROR,"proallargtypes is not a 1-D Oid array or it contains nulls");
15101513
argtypes= (Oid*)ARR_DATA_PTR(arr);
15111514
arr=DatumGetArrayTypeP(proargmodes);/* ensure not toasted */
15121515
if (ARR_NDIM(arr)!=1||
15131516
ARR_DIMS(arr)[0]!=numargs||
15141517
ARR_HASNULL(arr)||
15151518
ARR_ELEMTYPE(arr)!=CHAROID)
1516-
elog(ERROR,"proargmodes is not a 1-D char array");
1519+
elog(ERROR,"proargmodes is not a 1-D char array of length %d or it contains nulls",
1520+
numargs);
15171521
argmodes= (char*)ARR_DATA_PTR(arr);
15181522
if (proargnames!=PointerGetDatum(NULL))
15191523
{
@@ -1522,7 +1526,8 @@ build_function_result_tupdesc_d(char prokind,
15221526
ARR_DIMS(arr)[0]!=numargs||
15231527
ARR_HASNULL(arr)||
15241528
ARR_ELEMTYPE(arr)!=TEXTOID)
1525-
elog(ERROR,"proargnames is not a 1-D text array");
1529+
elog(ERROR,"proargnames is not a 1-D text array of length %d or it contains nulls",
1530+
numargs);
15261531
deconstruct_array(arr,TEXTOID,-1, false,TYPALIGN_INT,
15271532
&argnames,NULL,&nargnames);
15281533
Assert(nargnames==numargs);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp