Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73a4b99

Browse files
committed
Make CREATE/ALTER FUNCTION support NOT LEAKPROOF.
Because it isn't good to be able to turn things on, and not off again.
1 parentd845fd6 commit73a4b99

File tree

3 files changed

+35
-21
lines changed

3 files changed

+35
-21
lines changed

‎doc/src/sgml/ref/alter_function.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="paramet
3333
<phrase>where <replaceable class="PARAMETER">action</replaceable> is one of:</phrase>
3434

3535
CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
36-
IMMUTABLE | STABLE | VOLATILE | LEAKPROOF
36+
IMMUTABLE | STABLE | VOLATILE |[ NOT ]LEAKPROOF
3737
[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
3838
COST <replaceable class="parameter">execution_cost</replaceable>
3939
ROWS <replaceable class="parameter">result_rows</replaceable>

‎doc/src/sgml/ref/create_function.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CREATE [ OR REPLACE ] FUNCTION
2626
| RETURNS TABLE ( <replaceable class="parameter">column_name</replaceable> <replaceable class="parameter">column_type</replaceable> [, ...] ) ]
2727
{ LANGUAGE <replaceable class="parameter">lang_name</replaceable>
2828
| WINDOW
29-
| IMMUTABLE | STABLE | VOLATILE | LEAKPROOF
29+
| IMMUTABLE | STABLE | VOLATILE |[ NOT ]LEAKPROOF
3030
| CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
3131
| [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
3232
| COST <replaceable class="parameter">execution_cost</replaceable>

‎src/backend/parser/gram.y

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
370370

371371
%type<istmt>insert_rest
372372

373-
%type<vsetstmt>set_restSetResetClause
373+
%type<vsetstmt>set_restset_rest_moreSetResetClauseFunctionSetResetClause
374374

375375
%type<node>TableElementTypedTableElementConstraintElemTableFuncElement
376376
ForeignTableElement
@@ -1227,7 +1227,27 @@ VariableSetStmt:
12271227
}
12281228
;
12291229

1230-
set_rest:/* Generic SET syntaxes:*/
1230+
set_rest:
1231+
TRANSACTIONtransaction_mode_list
1232+
{
1233+
VariableSetStmt *n = makeNode(VariableSetStmt);
1234+
n->kind = VAR_SET_MULTI;
1235+
n->name ="TRANSACTION";
1236+
n->args =$2;
1237+
$$ = n;
1238+
}
1239+
|SESSIONCHARACTERISTICSASTRANSACTIONtransaction_mode_list
1240+
{
1241+
VariableSetStmt *n = makeNode(VariableSetStmt);
1242+
n->kind = VAR_SET_MULTI;
1243+
n->name ="SESSION CHARACTERISTICS";
1244+
n->args =$5;
1245+
$$ = n;
1246+
}
1247+
|set_rest_more
1248+
;
1249+
1250+
set_rest_more:/* Generic SET syntaxes:*/
12311251
var_nameTOvar_list
12321252
{
12331253
VariableSetStmt *n = makeNode(VariableSetStmt);
@@ -1277,22 +1297,6 @@ set_rest:/* Generic SET syntaxes: */
12771297
n->kind = VAR_SET_DEFAULT;
12781298
$$ = n;
12791299
}
1280-
|TRANSACTIONtransaction_mode_list
1281-
{
1282-
VariableSetStmt *n = makeNode(VariableSetStmt);
1283-
n->kind = VAR_SET_MULTI;
1284-
n->name ="TRANSACTION";
1285-
n->args =$2;
1286-
$$ = n;
1287-
}
1288-
|SESSIONCHARACTERISTICSASTRANSACTIONtransaction_mode_list
1289-
{
1290-
VariableSetStmt *n = makeNode(VariableSetStmt);
1291-
n->kind = VAR_SET_MULTI;
1292-
n->name ="SESSION CHARACTERISTICS";
1293-
n->args =$5;
1294-
$$ = n;
1295-
}
12961300
|CATALOG_PSconst
12971301
{
12981302
ereport(ERROR,
@@ -1512,6 +1516,12 @@ SetResetClause:
15121516
|VariableResetStmt{$$ = (VariableSetStmt *)$1; }
15131517
;
15141518

1519+
/* SetResetClause allows SET or RESET without LOCAL*/
1520+
FunctionSetResetClause:
1521+
SETset_rest_more{$$ =$2; }
1522+
|VariableResetStmt{$$ = (VariableSetStmt *)$1; }
1523+
;
1524+
15151525

15161526
VariableShowStmt:
15171527
SHOWvar_name
@@ -6119,6 +6129,10 @@ common_func_opt_item:
61196129
{
61206130
$$ = makeDefElem("leakproof", (Node *)makeInteger(TRUE));
61216131
}
6132+
|NOTLEAKPROOF
6133+
{
6134+
$$ = makeDefElem("leakproof", (Node *)makeInteger(FALSE));
6135+
}
61226136
|COSTNumericOnly
61236137
{
61246138
$$ = makeDefElem("cost", (Node *)$2);
@@ -6127,7 +6141,7 @@ common_func_opt_item:
61276141
{
61286142
$$ = makeDefElem("rows", (Node *)$2);
61296143
}
6130-
|SetResetClause
6144+
|FunctionSetResetClause
61316145
{
61326146
/* we abuse the normal content of a DefElem here*/
61336147
$$ = makeDefElem("set", (Node *)$1);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp