diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-11-06 13:32:26 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-11-06 13:32:26 -0500 |
commit | aad87e3f25ad751a3d021c139fd3adbbe1d19fce (patch) | |
tree | 91731d8feeed6fcb3dcca3257d93763b09c1af31 /src | |
parent | db157fb141df983f6d66209182ef4ac7997588d4 (diff) | |
download | postgresql-aad87e3f25ad751a3d021c139fd3adbbe1d19fce.tar.gz postgresql-aad87e3f25ad751a3d021c139fd3adbbe1d19fce.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/catalog/pg_proc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index ca21faf7b43..9d5f1a6cbc2 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -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. */ |