Skip to content

Commit dd6513a

Browse files
committed
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
1 parent 7b30ed8 commit dd6513a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/backend/parser/parse_relation.c

Lines changed: 22 additions & 1 deletion
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.73 2002/08/05 02:30:50 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.74 2002/08/06 05:33:29 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -729,6 +729,27 @@ addRangeTableEntryForFunction(ParseState *pstate,
729729
*/
730730
functyptype = get_typtype(funcrettype);
731731

732+
if (coldeflist != NIL)
733+
{
734+
/*
735+
* we *only* allow a coldeflist for functions returning a
736+
* RECORD pseudo-type
737+
*/
738+
if (functyptype != 'p' || (functyptype == 'p' && funcrettype != RECORDOID))
739+
elog(ERROR, "A column definition list is only allowed for"
740+
" functions returning RECORD");
741+
}
742+
else
743+
{
744+
/*
745+
* ... and a coldeflist is *required* for functions returning a
746+
* RECORD pseudo-type
747+
*/
748+
if (functyptype == 'p' && funcrettype == RECORDOID)
749+
elog(ERROR, "A column definition list is required for functions"
750+
" returning RECORD");
751+
}
752+
732753
if (functyptype == 'c')
733754
{
734755
/*

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