Commit dd6513a5 authored by Bruce Momjian's avatar Bruce Momjian

The attached patch disallows the use of coldeflists for functions that

don't return type RECORD. It also catches a core dump condition when a
function returning RECORD had an alias list instead of a coldeflist.

Now both conditions throw an ERROR.

Joe Conway
parent 7b30ed8f
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.73 2002/08/05 02:30:50 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.74 2002/08/06 05:33:29 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -729,6 +729,27 @@ addRangeTableEntryForFunction(ParseState *pstate, ...@@ -729,6 +729,27 @@ addRangeTableEntryForFunction(ParseState *pstate,
*/ */
functyptype = get_typtype(funcrettype); functyptype = get_typtype(funcrettype);
if (coldeflist != NIL)
{
/*
* we *only* allow a coldeflist for functions returning a
* RECORD pseudo-type
*/
if (functyptype != 'p' || (functyptype == 'p' && funcrettype != RECORDOID))
elog(ERROR, "A column definition list is only allowed for"
" functions returning RECORD");
}
else
{
/*
* ... and a coldeflist is *required* for functions returning a
* RECORD pseudo-type
*/
if (functyptype == 'p' && funcrettype == RECORDOID)
elog(ERROR, "A column definition list is required for functions"
" returning RECORD");
}
if (functyptype == 'c') if (functyptype == 'c')
{ {
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment