Skip to content

Commit 3fb6f13

Browse files
committed
Replace cryptic 'Unknown kind of return type' messages with something
hopefully a little more useful.
1 parent 996fdb9 commit 3fb6f13

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

contrib/dblink/dblink.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,8 @@ dblink_fetch(PG_FUNCTION_ARGS)
327327
tupdesc = TypeGetTupleDesc(functypeid, NIL);
328328
else if (functyptype == 'p' && functypeid == RECORDOID)
329329
tupdesc = pgresultGetTupleDesc(res);
330-
else if (functyptype == 'b')
331-
elog(ERROR, "dblink_fetch: invalid kind of return type specified for function");
332330
else
333-
elog(ERROR, "dblink_fetch: unknown kind of return type specified for function");
331+
elog(ERROR, "dblink_fetch: return type must be a row type");
334332

335333
/* store needed metadata for subsequent calls */
336334
slot = TupleDescGetSlot(tupdesc);
@@ -506,10 +504,8 @@ dblink_record(PG_FUNCTION_ARGS)
506504
tupdesc = TypeGetTupleDesc(functypeid, NIL);
507505
else if (functyptype == 'p' && functypeid == RECORDOID)
508506
tupdesc = pgresultGetTupleDesc(res);
509-
else if (functyptype == 'b')
510-
elog(ERROR, "Invalid kind of return type specified for function");
511507
else
512-
elog(ERROR, "Unknown kind of return type specified for function");
508+
elog(ERROR, "dblink: return type must be a row type");
513509
}
514510

515511
/* store needed metadata for subsequent calls */

contrib/tablefunc/tablefunc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,8 @@ crosstab(PG_FUNCTION_ARGS)
445445
tupdesc = make_crosstab_tupledesc(spi_tupdesc, num_categories);
446446
}
447447
}
448-
else if (functyptype == 'b')
449-
elog(ERROR, "Invalid kind of return type specified for function");
450448
else
451-
elog(ERROR, "Unknown kind of return type specified for function");
449+
elog(ERROR, "crosstab: return type must be a row type");
452450

453451
/*
454452
* Check that return tupdesc is compatible with the one we got

src/backend/access/common/tupdesc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.94 2002/11/13 00:39:46 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.95 2003/06/15 17:59:10 tgl Exp $
1212
*
1313
* NOTES
1414
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -697,7 +697,10 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
697697
else if (functyptype == 'p' && typeoid == RECORDOID)
698698
elog(ERROR, "Unable to determine tuple description for function returning \"record\"");
699699
else
700-
elog(ERROR, "Unknown kind of return type specified for function");
700+
{
701+
/* crummy error message, but parser should have caught this */
702+
elog(ERROR, "function in FROM has unsupported return type");
703+
}
701704

702705
return tupdesc;
703706
}

src/backend/catalog/pg_proc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.96 2003/04/08 23:20:00 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.97 2003/06/15 17:59:10 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -483,7 +483,8 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
483483
*/
484484
}
485485
else
486-
elog(ERROR, "Unknown kind of return type specified for function");
486+
elog(ERROR, "return type %s is not supported for SQL functions",
487+
format_type_be(rettype));
487488
}
488489

489490

src/backend/executor/nodeFunctionscan.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.17 2003/01/12 22:01:38 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.18 2003/06/15 17:59:10 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -231,7 +231,10 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate)
231231
tupdesc = BuildDescForRelation(rte->coldeflist);
232232
}
233233
else
234-
elog(ERROR, "Unknown kind of return type specified for function");
234+
{
235+
/* crummy error message, but parser should have caught this */
236+
elog(ERROR, "function in FROM has unsupported return type");
237+
}
235238

236239
scanstate->tupdesc = tupdesc;
237240
ExecSetSlotDescriptor(scanstate->ss.ss_ScanTupleSlot,

src/backend/parser/parse_relation.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.82 2003/06/11 22:13:22 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.83 2003/06/15 17:59:10 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -992,7 +992,7 @@ addRangeTableEntryForFunction(ParseState *pstate,
992992
}
993993
}
994994
else
995-
elog(ERROR, "Unknown kind of return type specified for function %s",
995+
elog(ERROR, "function %s() in FROM has unsupported return type",
996996
funcname);
997997

998998
/*----------
@@ -1382,7 +1382,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
13821382
}
13831383
}
13841384
else
1385-
elog(ERROR, "Unknown kind of return type specified for function");
1385+
elog(ERROR, "function in FROM has unsupported return type");
13861386
}
13871387
break;
13881388
case RTE_JOIN:
@@ -1636,7 +1636,7 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
16361636
*vartypmod = -1;
16371637
}
16381638
else
1639-
elog(ERROR, "Unknown kind of return type specified for function");
1639+
elog(ERROR, "function in FROM has unsupported return type");
16401640
}
16411641
break;
16421642
case RTE_JOIN:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy