aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-08-06 05:33:29 +0000
committerBruce Momjian <bruce@momjian.us>2002-08-06 05:33:29 +0000
commitdd6513a5b662e0a3e0de378f616741b7d77f3d32 (patch)
treeb928423c6776a32e451747bf2631a506792d1bb8 /src
parent7b30ed8fa41492a0184b20191ed202999759e374 (diff)
downloadpostgresql-dd6513a5b662e0a3e0de378f616741b7d77f3d32.tar.gz
postgresql-dd6513a5b662e0a3e0de378f616741b7d77f3d32.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/parser/parse_relation.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 872c03ca9f5..6732dc54b53 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -8,7 +8,7 @@
*
*
* 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,
*/
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')
{
/*