Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaad87e3

Browse files
committed
Prevent creating window functions with default arguments.
Insertion of default arguments doesn't work for window functions, which islikely to cause a crash at runtime if the implementation code doesn't checkthe number of actual arguments carefully. It doesn't seem worth workingharder than this for pre-9.2 branches.
1 parentdb157fb commitaad87e3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎doc/src/sgml/syntax.sgml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,6 +2464,13 @@ SELECT concat_lower_or_upper('Hello', 'World', uppercase := true);
24642464
having numerous parameters that have default values, named or mixed
24652465
notation can save a great deal of writing and reduce chances for error.
24662466
</para>
2467+
2468+
<note>
2469+
<para>
2470+
Named and mixed call notations can currently be used only with regular
2471+
functions, not with aggregate functions or window functions.
2472+
</para>
2473+
</note>
24672474
</sect2>
24682475
</sect1>
24692476

‎src/backend/catalog/pg_proc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ ProcedureCreate(const char *procedureName,
285285
}
286286
}
287287

288+
/* Guard against a case the planner doesn't handle yet */
289+
if (isWindowFunc&&parameterDefaults!=NIL)
290+
ereport(ERROR,
291+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
292+
errmsg("window functions cannot have default arguments")));
293+
288294
/*
289295
* All seems OK; prepare the data to be inserted into pg_proc.
290296
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp