From: Tom Lane Date: Wed, 6 Nov 2013 18:32:36 +0000 (-0500) Subject: Prevent creating window functions with default arguments. X-Git-Tag: REL8_4_19~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72c8a584bf7dd362227a3e0c23c39cc217f5753d;p=postgresql Prevent creating window functions with default arguments. Insertion of default arguments doesn't work for window functions, which is likely to cause a crash at runtime if the implementation code doesn't check the number of actual arguments carefully. It doesn't seem worth working harder than this for pre-9.2 branches. --- diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index 3a2c817a8b..45d224ef40 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -283,6 +283,12 @@ ProcedureCreate(const char *procedureName, } } + /* Guard against a case the planner doesn't handle yet */ + if (isWindowFunc && parameterDefaults != NIL) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("window functions cannot have default arguments"))); + /* * All seems OK; prepare the data to be inserted into pg_proc. */