1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Make CREATE/ALTER FUNCTION support NOT LEAKPROOF.

Because it isn't good to be able to turn things on, and not off again.
This commit is contained in:
Robert Haas
2012-02-15 10:45:08 -05:00
parent d845fd684a
commit 73a4b994a6
3 changed files with 35 additions and 21 deletions

View File

@ -370,7 +370,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
%type <istmt> insert_rest
%type <vsetstmt> set_rest SetResetClause
%type <vsetstmt> set_rest set_rest_more SetResetClause FunctionSetResetClause
%type <node> TableElement TypedTableElement ConstraintElem TableFuncElement
ForeignTableElement
@ -1227,7 +1227,27 @@ VariableSetStmt:
}
;
set_rest: /* Generic SET syntaxes: */
set_rest:
TRANSACTION transaction_mode_list
{
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION";
n->args = $2;
$$ = n;
}
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
{
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_SET_MULTI;
n->name = "SESSION CHARACTERISTICS";
n->args = $5;
$$ = n;
}
| set_rest_more
;
set_rest_more: /* Generic SET syntaxes: */
var_name TO var_list
{
VariableSetStmt *n = makeNode(VariableSetStmt);
@ -1277,22 +1297,6 @@ set_rest: /* Generic SET syntaxes: */
n->kind = VAR_SET_DEFAULT;
$$ = n;
}
| TRANSACTION transaction_mode_list
{
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION";
n->args = $2;
$$ = n;
}
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
{
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_SET_MULTI;
n->name = "SESSION CHARACTERISTICS";
n->args = $5;
$$ = n;
}
| CATALOG_P Sconst
{
ereport(ERROR,
@ -1512,6 +1516,12 @@ SetResetClause:
| VariableResetStmt { $$ = (VariableSetStmt *) $1; }
;
/* SetResetClause allows SET or RESET without LOCAL */
FunctionSetResetClause:
SET set_rest_more { $$ = $2; }
| VariableResetStmt { $$ = (VariableSetStmt *) $1; }
;
VariableShowStmt:
SHOW var_name
@ -6119,6 +6129,10 @@ common_func_opt_item:
{
$$ = makeDefElem("leakproof", (Node *)makeInteger(TRUE));
}
| NOT LEAKPROOF
{
$$ = makeDefElem("leakproof", (Node *)makeInteger(FALSE));
}
| COST NumericOnly
{
$$ = makeDefElem("cost", (Node *)$2);
@ -6127,7 +6141,7 @@ common_func_opt_item:
{
$$ = makeDefElem("rows", (Node *)$2);
}
| SetResetClause
| FunctionSetResetClause
{
/* we abuse the normal content of a DefElem here */
$$ = makeDefElem("set", (Node *)$1);