diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/functioncmds.c | 22 | ||||
-rw-r--r-- | src/backend/commands/proclang.c | 4 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 8963f981178..13f1debf669 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.104 2008/12/28 18:53:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.105 2008/12/31 02:25:03 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -503,6 +503,7 @@ static void compute_attributes_sql_style(List *options, List **as, char **language, + bool *windowfunc_p, char *volatility_p, bool *strict_p, bool *security_definer, @@ -513,6 +514,7 @@ compute_attributes_sql_style(List *options, ListCell *option; DefElem *as_item = NULL; DefElem *language_item = NULL; + DefElem *windowfunc_item = NULL; DefElem *volatility_item = NULL; DefElem *strict_item = NULL; DefElem *security_item = NULL; @@ -540,6 +542,14 @@ compute_attributes_sql_style(List *options, errmsg("conflicting or redundant options"))); language_item = defel; } + else if (strcmp(defel->defname, "window") == 0) + { + if (windowfunc_item) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("conflicting or redundant options"))); + windowfunc_item = defel; + } else if (compute_common_attribute(defel, &volatility_item, &strict_item, @@ -578,6 +588,8 @@ compute_attributes_sql_style(List *options, } /* process optional items */ + if (windowfunc_item) + *windowfunc_p = intVal(windowfunc_item->arg); if (volatility_item) *volatility_p = interpret_func_volatility(volatility_item); if (strict_item) @@ -735,7 +747,8 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString) ArrayType *parameterNames; List *parameterDefaults; Oid requiredResultType; - bool isStrict, + bool isWindowFunc, + isStrict, security; char volatility; ArrayType *proconfig; @@ -756,6 +769,7 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString) get_namespace_name(namespaceId)); /* default attributes */ + isWindowFunc = false; isStrict = false; security = false; volatility = PROVOLATILE_VOLATILE; @@ -766,7 +780,8 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString) /* override attributes from explicit list */ compute_attributes_sql_style(stmt->options, &as_clause, &language, - &volatility, &isStrict, &security, + &isWindowFunc, &volatility, + &isStrict, &security, &proconfig, &procost, &prorows); /* Convert language name to canonical case */ @@ -892,6 +907,7 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString) prosrc_str, /* converted to text later */ probin_str, /* converted to text later */ false, /* not an aggregate */ + isWindowFunc, security, isStrict, volatility, diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index 3188156c4d1..ea37352b419 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.82 2008/12/18 18:20:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.83 2008/12/31 02:25:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -140,6 +140,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) pltemplate->tmplhandler, pltemplate->tmpllibrary, false, /* isAgg */ + false, /* isWindowFunc */ false, /* security_definer */ false, /* isStrict */ PROVOLATILE_VOLATILE, @@ -174,6 +175,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) pltemplate->tmplvalidator, pltemplate->tmpllibrary, false, /* isAgg */ + false, /* isWindowFunc */ false, /* security_definer */ false, /* isStrict */ PROVOLATILE_VOLATILE, |