Add some comments about why function parameter default expressions are
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 6 Jan 2009 02:01:27 +0000 (02:01 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 6 Jan 2009 02:01:27 +0000 (02:01 +0000)
restricted.

src/backend/commands/functioncmds.c

index 91a3cd8e73bf2c082fde4ec253b38ecbf9da3068..c0542ef3d6477357153ecdcbb14146c688a5d304 100644 (file)
@@ -311,7 +311,15 @@ examine_parameter_list(List *parameters, Oid languageOid,
                                                 errmsg("cannot use table references in parameter default value")));
 
                        /*
+                        * It can't return a set either --- but coerce_to_specific_type
+                        * already checked that for us.
+                        *
                         * No subplans or aggregates, either...
+                        *
+                        * Note: the point of these restrictions is to ensure that an
+                        * expression that, on its face, hasn't got subplans, aggregates,
+                        * etc cannot suddenly have them after function default arguments
+                        * are inserted.
                         */
                        if (pstate->p_hasSubLinks)
                                ereport(ERROR,