diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-11-06 13:32:36 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-11-06 13:32:36 -0500 |
commit | 72c8a584bf7dd362227a3e0c23c39cc217f5753d (patch) | |
tree | adc6750716e372d59704ca662cc3fec9d9d5bc09 /src | |
parent | 2268d1c14c08e3c967c9374784638139458fe49a (diff) | |
download | postgresql-72c8a584bf7dd362227a3e0c23c39cc217f5753d.tar.gz postgresql-72c8a584bf7dd362227a3e0c23c39cc217f5753d.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 3a2c817a8b3..45d224ef409 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. */ |