Replace cryptic 'Unknown kind of return type' messages with something
authorTom Lane
Sun, 15 Jun 2003 17:59:10 +0000 (17:59 +0000)
committerTom Lane
Sun, 15 Jun 2003 17:59:10 +0000 (17:59 +0000)
hopefully a little more useful.

contrib/dblink/dblink.c
contrib/tablefunc/tablefunc.c
src/backend/access/common/tupdesc.c
src/backend/catalog/pg_proc.c
src/backend/executor/nodeFunctionscan.c
src/backend/parser/parse_relation.c

index 20e7662e28029fb7627001fcb5a0344b1ec52a47..a8e9c5ab50e78c68563a24ae047a1c403c67d5bb 100644 (file)
@@ -327,10 +327,8 @@ dblink_fetch(PG_FUNCTION_ARGS)
            tupdesc = TypeGetTupleDesc(functypeid, NIL);
        else if (functyptype == 'p' && functypeid == RECORDOID)
            tupdesc = pgresultGetTupleDesc(res);
-       else if (functyptype == 'b')
-           elog(ERROR, "dblink_fetch: invalid kind of return type specified for function");
        else
-           elog(ERROR, "dblink_fetch: unknown kind of return type specified for function");
+           elog(ERROR, "dblink_fetch: return type must be a row type");
 
        /* store needed metadata for subsequent calls */
        slot = TupleDescGetSlot(tupdesc);
@@ -506,10 +504,8 @@ dblink_record(PG_FUNCTION_ARGS)
                tupdesc = TypeGetTupleDesc(functypeid, NIL);
            else if (functyptype == 'p' && functypeid == RECORDOID)
                tupdesc = pgresultGetTupleDesc(res);
-           else if (functyptype == 'b')
-               elog(ERROR, "Invalid kind of return type specified for function");
            else
-               elog(ERROR, "Unknown kind of return type specified for function");
+               elog(ERROR, "dblink: return type must be a row type");
        }
 
        /* store needed metadata for subsequent calls */
index 984f31dc2831d826607dc04e48a0ffbf33f63384..68e001fcdf010c72a021352d4e4262090b8b8aeb 100644 (file)
@@ -445,10 +445,8 @@ crosstab(PG_FUNCTION_ARGS)
                tupdesc = make_crosstab_tupledesc(spi_tupdesc, num_categories);
            }
        }
-       else if (functyptype == 'b')
-           elog(ERROR, "Invalid kind of return type specified for function");
        else
-           elog(ERROR, "Unknown kind of return type specified for function");
+           elog(ERROR, "crosstab: return type must be a row type");
 
        /*
         * Check that return tupdesc is compatible with the one we got
index b6c28675a954160d95d4c91a684cbba5d4a6ffa2..3bd15bd1fb37b9381493f93f1d16e23e2a9d05a5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.94 2002/11/13 00:39:46 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.95 2003/06/15 17:59:10 tgl Exp $
  *
  * NOTES
  *   some of the executor utility code such as "ExecTypeFromTL" should be
@@ -697,7 +697,10 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
    else if (functyptype == 'p' && typeoid == RECORDOID)
        elog(ERROR, "Unable to determine tuple description for function returning \"record\"");
    else
-       elog(ERROR, "Unknown kind of return type specified for function");
+   {
+       /* crummy error message, but parser should have caught this */
+       elog(ERROR, "function in FROM has unsupported return type");
+   }
 
    return tupdesc;
 }
index 4c9b2151d697719c1c2b5cd79dcb4f4e70460aa5..48b90e56ef1034aea86e92db9a522f4c46b0be80 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.96 2003/04/08 23:20:00 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.97 2003/06/15 17:59:10 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -483,7 +483,8 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
         */
    }
    else
-       elog(ERROR, "Unknown kind of return type specified for function");
+       elog(ERROR, "return type %s is not supported for SQL functions",
+            format_type_be(rettype));
 }
 
 
index cb30717893c78c6f9512ba58e6431f3148254916..282993ee4e90b61a2b0601ca9daf505acc4d19b7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.17 2003/01/12 22:01:38 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.18 2003/06/15 17:59:10 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -231,7 +231,10 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate)
        tupdesc = BuildDescForRelation(rte->coldeflist);
    }
    else
-       elog(ERROR, "Unknown kind of return type specified for function");
+   {
+       /* crummy error message, but parser should have caught this */
+       elog(ERROR, "function in FROM has unsupported return type");
+   }
 
    scanstate->tupdesc = tupdesc;
    ExecSetSlotDescriptor(scanstate->ss.ss_ScanTupleSlot,
index 59a362726ddc3818d443c494150e5012476661fa..6ab99356303d49e9ee467508a2a7304ce77c8e98 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.82 2003/06/11 22:13:22 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.83 2003/06/15 17:59:10 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -992,7 +992,7 @@ addRangeTableEntryForFunction(ParseState *pstate,
        }
    }
    else
-       elog(ERROR, "Unknown kind of return type specified for function %s",
+       elog(ERROR, "function %s() in FROM has unsupported return type",
             funcname);
 
    /*----------
@@ -1382,7 +1382,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
                    }
                }
                else
-                   elog(ERROR, "Unknown kind of return type specified for function");
+                   elog(ERROR, "function in FROM has unsupported return type");
            }
            break;
        case RTE_JOIN:
@@ -1636,7 +1636,7 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                    *vartypmod = -1;
                }
                else
-                   elog(ERROR, "Unknown kind of return type specified for function");
+                   elog(ERROR, "function in FROM has unsupported return type");
            }
            break;
        case RTE_JOIN: