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

Commit352ab59

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 parent3dd1310 commit352ab59

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
@@ -2373,6 +2373,13 @@ SELECT concat_lower_or_upper('Hello', 'World', uppercase := true);
23732373
having numerous parameters that have default values, named or mixed
23742374
notation can save a great deal of writing and reduce chances for error.
23752375
</para>
2376+
2377+
<note>
2378+
<para>
2379+
Named and mixed call notations can currently be used only with regular
2380+
functions, not with aggregate functions or window functions.
2381+
</para>
2382+
</note>
23762383
</sect2>
23772384
</sect1>
23782385

‎src/backend/catalog/pg_proc.c

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp