*** pgsql/src/backend/commands/functioncmds.c 2008/12/28 18:53:55 1.104 --- pgsql/src/backend/commands/functioncmds.c 2008/12/31 02:25:03 1.105 *************** *** 10,16 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.103 2008/12/18 18:20:33 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the --- 10,16 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.104 2008/12/28 18:53:55 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the *************** static void *** 503,508 **** --- 503,509 ---- compute_attributes_sql_style(List *options, List **as, char **language, + bool *windowfunc_p, char *volatility_p, bool *strict_p, bool *security_definer, *************** compute_attributes_sql_style(List *optio *** 513,518 **** --- 514,520 ---- 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; *************** compute_attributes_sql_style(List *optio *** 540,545 **** --- 542,555 ---- 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, *************** compute_attributes_sql_style(List *optio *** 578,583 **** --- 588,595 ---- } /* 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) *************** CreateFunction(CreateFunctionStmt *stmt, *** 735,741 **** ArrayType *parameterNames; List *parameterDefaults; Oid requiredResultType; ! bool isStrict, security; char volatility; ArrayType *proconfig; --- 747,754 ---- ArrayType *parameterNames; List *parameterDefaults; Oid requiredResultType; ! bool isWindowFunc, ! isStrict, security; char volatility; ArrayType *proconfig; *************** CreateFunction(CreateFunctionStmt *stmt, *** 756,761 **** --- 769,775 ---- get_namespace_name(namespaceId)); /* default attributes */ + isWindowFunc = false; isStrict = false; security = false; volatility = PROVOLATILE_VOLATILE; *************** CreateFunction(CreateFunctionStmt *stmt, *** 766,772 **** /* override attributes from explicit list */ compute_attributes_sql_style(stmt->options, &as_clause, &language, ! &volatility, &isStrict, &security, &proconfig, &procost, &prorows); /* Convert language name to canonical case */ --- 780,787 ---- /* override attributes from explicit list */ compute_attributes_sql_style(stmt->options, &as_clause, &language, ! &isWindowFunc, &volatility, ! &isStrict, &security, &proconfig, &procost, &prorows); /* Convert language name to canonical case */ *************** CreateFunction(CreateFunctionStmt *stmt, *** 892,897 **** --- 907,913 ---- prosrc_str, /* converted to text later */ probin_str, /* converted to text later */ false, /* not an aggregate */ + isWindowFunc, security, isStrict, volatility,