aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pl/plpgsql/src/expected/plpgsql_transaction.out2
-rw-r--r--src/pl/plpgsql/src/pl_exec.c37
-rw-r--r--src/pl/plpgsql/src/pl_funcs.c23
-rw-r--r--src/pl/plpgsql/src/pl_gram.y36
-rw-r--r--src/pl/plpgsql/src/pl_unreserved_kwlist.h2
-rw-r--r--src/pl/plpgsql/src/plpgsql.h14
6 files changed, 3 insertions, 111 deletions
diff --git a/src/pl/plpgsql/src/expected/plpgsql_transaction.out b/src/pl/plpgsql/src/expected/plpgsql_transaction.out
index e205a1e0022..8fceb88c9bb 100644
--- a/src/pl/plpgsql/src/expected/plpgsql_transaction.out
+++ b/src/pl/plpgsql/src/expected/plpgsql_transaction.out
@@ -497,7 +497,7 @@ END;
$$;
ERROR: SET TRANSACTION ISOLATION LEVEL must be called before any query
CONTEXT: SQL statement "SET TRANSACTION ISOLATION LEVEL REPEATABLE READ"
-PL/pgSQL function inline_code_block line 3 at SET
+PL/pgSQL function inline_code_block line 3 at SQL statement
DO LANGUAGE plpgsql $$
BEGIN
SAVEPOINT foo;
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 4e705c162ac..78b593d12c7 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -317,8 +317,6 @@ static int exec_stmt_commit(PLpgSQL_execstate *estate,
PLpgSQL_stmt_commit *stmt);
static int exec_stmt_rollback(PLpgSQL_execstate *estate,
PLpgSQL_stmt_rollback *stmt);
-static int exec_stmt_set(PLpgSQL_execstate *estate,
- PLpgSQL_stmt_set *stmt);
static void plpgsql_estate_setup(PLpgSQL_execstate *estate,
PLpgSQL_function *func,
@@ -2088,10 +2086,6 @@ exec_stmts(PLpgSQL_execstate *estate, List *stmts)
rc = exec_stmt_rollback(estate, (PLpgSQL_stmt_rollback *) stmt);
break;
- case PLPGSQL_STMT_SET:
- rc = exec_stmt_set(estate, (PLpgSQL_stmt_set *) stmt);
- break;
-
default:
/* point err_stmt to parent, since this one seems corrupt */
estate->err_stmt = save_estmt;
@@ -4926,37 +4920,6 @@ exec_stmt_rollback(PLpgSQL_execstate *estate, PLpgSQL_stmt_rollback *stmt)
return PLPGSQL_RC_OK;
}
-/*
- * exec_stmt_set
- *
- * Execute SET/RESET statement.
- *
- * We just parse and execute the statement normally, but we have to do it
- * without setting a snapshot, for things like SET TRANSACTION.
- * XXX spi.c now handles this correctly, so we no longer need a special case.
- */
-static int
-exec_stmt_set(PLpgSQL_execstate *estate, PLpgSQL_stmt_set *stmt)
-{
- PLpgSQL_expr *expr = stmt->expr;
- SPIExecuteOptions options;
- int rc;
-
- if (expr->plan == NULL)
- exec_prepare_plan(estate, expr, 0);
-
- memset(&options, 0, sizeof(options));
- options.read_only = estate->readonly_func;
-
- rc = SPI_execute_plan_extended(expr->plan, &options);
-
- if (rc != SPI_OK_UTILITY)
- elog(ERROR, "SPI_execute_plan_extended failed executing query \"%s\": %s",
- expr->query, SPI_result_code_string(rc));
-
- return PLPGSQL_RC_OK;
-}
-
/* ----------
* exec_assign_expr Put an expression's result into a variable.
* ----------
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c
index 919b968826c..e0863acb3d1 100644
--- a/src/pl/plpgsql/src/pl_funcs.c
+++ b/src/pl/plpgsql/src/pl_funcs.c
@@ -288,8 +288,6 @@ plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
return "COMMIT";
case PLPGSQL_STMT_ROLLBACK:
return "ROLLBACK";
- case PLPGSQL_STMT_SET:
- return "SET";
}
return "unknown";
@@ -370,7 +368,6 @@ static void free_perform(PLpgSQL_stmt_perform *stmt);
static void free_call(PLpgSQL_stmt_call *stmt);
static void free_commit(PLpgSQL_stmt_commit *stmt);
static void free_rollback(PLpgSQL_stmt_rollback *stmt);
-static void free_set(PLpgSQL_stmt_set *stmt);
static void free_expr(PLpgSQL_expr *expr);
@@ -460,9 +457,6 @@ free_stmt(PLpgSQL_stmt *stmt)
case PLPGSQL_STMT_ROLLBACK:
free_rollback((PLpgSQL_stmt_rollback *) stmt);
break;
- case PLPGSQL_STMT_SET:
- free_set((PLpgSQL_stmt_set *) stmt);
- break;
default:
elog(ERROR, "unrecognized cmd_type: %d", stmt->cmd_type);
break;
@@ -627,12 +621,6 @@ free_rollback(PLpgSQL_stmt_rollback *stmt)
}
static void
-free_set(PLpgSQL_stmt_set *stmt)
-{
- free_expr(stmt->expr);
-}
-
-static void
free_exit(PLpgSQL_stmt_exit *stmt)
{
free_expr(stmt->cond);
@@ -825,7 +813,6 @@ static void dump_perform(PLpgSQL_stmt_perform *stmt);
static void dump_call(PLpgSQL_stmt_call *stmt);
static void dump_commit(PLpgSQL_stmt_commit *stmt);
static void dump_rollback(PLpgSQL_stmt_rollback *stmt);
-static void dump_set(PLpgSQL_stmt_set *stmt);
static void dump_expr(PLpgSQL_expr *expr);
@@ -925,9 +912,6 @@ dump_stmt(PLpgSQL_stmt *stmt)
case PLPGSQL_STMT_ROLLBACK:
dump_rollback((PLpgSQL_stmt_rollback *) stmt);
break;
- case PLPGSQL_STMT_SET:
- dump_set((PLpgSQL_stmt_set *) stmt);
- break;
default:
elog(ERROR, "unrecognized cmd_type: %d", stmt->cmd_type);
break;
@@ -1330,13 +1314,6 @@ dump_rollback(PLpgSQL_stmt_rollback *stmt)
}
static void
-dump_set(PLpgSQL_stmt_set *stmt)
-{
- dump_ind();
- printf("%s\n", stmt->expr->query);
-}
-
-static void
dump_exit(PLpgSQL_stmt_exit *stmt)
{
dump_ind();
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
index 34e0520719f..3fcca43b904 100644
--- a/src/pl/plpgsql/src/pl_gram.y
+++ b/src/pl/plpgsql/src/pl_gram.y
@@ -197,7 +197,7 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
%type <stmt> stmt_return stmt_raise stmt_assert stmt_execsql
%type <stmt> stmt_dynexecute stmt_for stmt_perform stmt_call stmt_getdiag
%type <stmt> stmt_open stmt_fetch stmt_move stmt_close stmt_null
-%type <stmt> stmt_commit stmt_rollback stmt_set
+%type <stmt> stmt_commit stmt_rollback
%type <stmt> stmt_case stmt_foreach_a
%type <list> proc_exceptions
@@ -328,7 +328,6 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
%token <keyword> K_QUERY
%token <keyword> K_RAISE
%token <keyword> K_RELATIVE
-%token <keyword> K_RESET
%token <keyword> K_RETURN
%token <keyword> K_RETURNED_SQLSTATE
%token <keyword> K_REVERSE
@@ -338,7 +337,6 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
%token <keyword> K_SCHEMA
%token <keyword> K_SCHEMA_NAME
%token <keyword> K_SCROLL
-%token <keyword> K_SET
%token <keyword> K_SLICE
%token <keyword> K_SQLSTATE
%token <keyword> K_STACKED
@@ -899,8 +897,6 @@ proc_stmt : pl_block ';'
{ $$ = $1; }
| stmt_rollback
{ $$ = $1; }
- | stmt_set
- { $$ = $1; }
;
stmt_perform : K_PERFORM
@@ -2273,34 +2269,6 @@ opt_transaction_chain:
| /* EMPTY */ { $$ = false; }
;
-stmt_set : K_SET
- {
- PLpgSQL_stmt_set *new;
-
- new = palloc0(sizeof(PLpgSQL_stmt_set));
- new->cmd_type = PLPGSQL_STMT_SET;
- new->lineno = plpgsql_location_to_lineno(@1);
- new->stmtid = ++plpgsql_curr_compile->nstatements;
- plpgsql_push_back_token(K_SET);
- new->expr = read_sql_stmt();
-
- $$ = (PLpgSQL_stmt *)new;
- }
- | K_RESET
- {
- PLpgSQL_stmt_set *new;
-
- new = palloc0(sizeof(PLpgSQL_stmt_set));
- new->cmd_type = PLPGSQL_STMT_SET;
- new->lineno = plpgsql_location_to_lineno(@1);
- new->stmtid = ++plpgsql_curr_compile->nstatements;
- plpgsql_push_back_token(K_RESET);
- new->expr = read_sql_stmt();
-
- $$ = (PLpgSQL_stmt *)new;
- }
- ;
-
cursor_variable : T_DATUM
{
@@ -2588,7 +2556,6 @@ unreserved_keyword :
| K_QUERY
| K_RAISE
| K_RELATIVE
- | K_RESET
| K_RETURN
| K_RETURNED_SQLSTATE
| K_REVERSE
@@ -2598,7 +2565,6 @@ unreserved_keyword :
| K_SCHEMA
| K_SCHEMA_NAME
| K_SCROLL
- | K_SET
| K_SLICE
| K_SQLSTATE
| K_STACKED
diff --git a/src/pl/plpgsql/src/pl_unreserved_kwlist.h b/src/pl/plpgsql/src/pl_unreserved_kwlist.h
index 44c8b68bfbc..fcb34f7c7fb 100644
--- a/src/pl/plpgsql/src/pl_unreserved_kwlist.h
+++ b/src/pl/plpgsql/src/pl_unreserved_kwlist.h
@@ -89,7 +89,6 @@ PG_KEYWORD("prior", K_PRIOR)
PG_KEYWORD("query", K_QUERY)
PG_KEYWORD("raise", K_RAISE)
PG_KEYWORD("relative", K_RELATIVE)
-PG_KEYWORD("reset", K_RESET)
PG_KEYWORD("return", K_RETURN)
PG_KEYWORD("returned_sqlstate", K_RETURNED_SQLSTATE)
PG_KEYWORD("reverse", K_REVERSE)
@@ -99,7 +98,6 @@ PG_KEYWORD("rowtype", K_ROWTYPE)
PG_KEYWORD("schema", K_SCHEMA)
PG_KEYWORD("schema_name", K_SCHEMA_NAME)
PG_KEYWORD("scroll", K_SCROLL)
-PG_KEYWORD("set", K_SET)
PG_KEYWORD("slice", K_SLICE)
PG_KEYWORD("sqlstate", K_SQLSTATE)
PG_KEYWORD("stacked", K_STACKED)
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index d5010862a50..fcbfcd678b1 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -127,8 +127,7 @@ typedef enum PLpgSQL_stmt_type
PLPGSQL_STMT_PERFORM,
PLPGSQL_STMT_CALL,
PLPGSQL_STMT_COMMIT,
- PLPGSQL_STMT_ROLLBACK,
- PLPGSQL_STMT_SET
+ PLPGSQL_STMT_ROLLBACK
} PLpgSQL_stmt_type;
/*
@@ -567,17 +566,6 @@ typedef struct PLpgSQL_stmt_rollback
} PLpgSQL_stmt_rollback;
/*
- * SET statement
- */
-typedef struct PLpgSQL_stmt_set
-{
- PLpgSQL_stmt_type cmd_type;
- int lineno;
- unsigned int stmtid;
- PLpgSQL_expr *expr;
-} PLpgSQL_stmt_set;
-
-/*
* GET DIAGNOSTICS item
*/
typedef struct PLpgSQL_diag_item