summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-11-06 13:32:30 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-11-06 13:32:30 -0500
commit352ab596fa5a8a4ceec6d308ebae34176cc09c13 (patch)
tree1d0eb4b2a89ed3d3922f15ac6e7ec77deab24718 /src/backend
parent3dd13108ac5f16723d87288c8633f8d347823304 (diff)
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/backend')
-rw-r--r--src/backend/catalog/pg_proc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index ccec1102d0b..b985d63d77b 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -284,6 +284,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.
*/