mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
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.
This commit is contained in:
@ -2464,6 +2464,13 @@ SELECT concat_lower_or_upper('Hello', 'World', uppercase := true);
|
||||
having numerous parameters that have default values, named or mixed
|
||||
notation can save a great deal of writing and reduce chances for error.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Named and mixed call notations can currently be used only with regular
|
||||
functions, not with aggregate functions or window functions.
|
||||
</para>
|
||||
</note>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
|
@ -285,6 +285,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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user