|
|
|
|
@ -852,7 +852,9 @@ static void |
|
|
|
|
interpret_AS_clause(Oid languageOid, const char *languageName, |
|
|
|
|
char *funcname, List *as, Node *sql_body_in, |
|
|
|
|
List *parameterTypes, List *inParameterNames, |
|
|
|
|
char **prosrc_str_p, char **probin_str_p, Node **sql_body_out) |
|
|
|
|
char **prosrc_str_p, char **probin_str_p, |
|
|
|
|
Node **sql_body_out, |
|
|
|
|
const char *queryString) |
|
|
|
|
{ |
|
|
|
|
if (!sql_body_in && !as) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
@ -929,6 +931,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName, |
|
|
|
|
Query *q; |
|
|
|
|
ParseState *pstate = make_parsestate(NULL); |
|
|
|
|
|
|
|
|
|
pstate->p_sourcetext = queryString; |
|
|
|
|
sql_fn_parser_setup(pstate, pinfo); |
|
|
|
|
q = transformStmt(pstate, stmt); |
|
|
|
|
if (q->commandType == CMD_UTILITY) |
|
|
|
|
@ -947,6 +950,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName, |
|
|
|
|
Query *q; |
|
|
|
|
ParseState *pstate = make_parsestate(NULL); |
|
|
|
|
|
|
|
|
|
pstate->p_sourcetext = queryString; |
|
|
|
|
sql_fn_parser_setup(pstate, pinfo); |
|
|
|
|
q = transformStmt(pstate, sql_body_in); |
|
|
|
|
if (q->commandType == CMD_UTILITY) |
|
|
|
|
@ -954,6 +958,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName, |
|
|
|
|
errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
|
|
|
|
errmsg("%s is not yet supported in unquoted SQL function body", |
|
|
|
|
GetCommandTagName(CreateCommandTag(q->utilityStmt)))); |
|
|
|
|
free_parsestate(pstate); |
|
|
|
|
|
|
|
|
|
*sql_body_out = (Node *) q; |
|
|
|
|
} |
|
|
|
|
@ -1220,7 +1225,8 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt) |
|
|
|
|
|
|
|
|
|
interpret_AS_clause(languageOid, language, funcname, as_clause, stmt->sql_body, |
|
|
|
|
parameterTypes_list, inParameterNames_list, |
|
|
|
|
&prosrc_str, &probin_str, &prosqlbody); |
|
|
|
|
&prosrc_str, &probin_str, &prosqlbody, |
|
|
|
|
pstate->p_sourcetext); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Set default values for COST and ROWS depending on other parameters; |
|
|
|
|
|