diff options
Diffstat (limited to 'src/pl')
-rw-r--r-- | src/pl/plperl/plperl.c | 2 | ||||
-rw-r--r-- | src/pl/plpgsql/src/pl_comp.c | 4 | ||||
-rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 10 | ||||
-rw-r--r-- | src/pl/plpgsql/src/pl_funcs.c | 2 | ||||
-rw-r--r-- | src/pl/plpgsql/src/pl_gram.y | 6 | ||||
-rw-r--r-- | src/pl/plpgsql/src/pl_scanner.c | 1 | ||||
-rw-r--r-- | src/pl/plpgsql/src/plpgsql.h | 2 | ||||
-rw-r--r-- | src/pl/tcl/expected/pltcl_queries.out | 15 | ||||
-rw-r--r-- | src/pl/tcl/expected/pltcl_setup.out | 4 | ||||
-rw-r--r-- | src/pl/tcl/pltcl.c | 26 | ||||
-rw-r--r-- | src/pl/tcl/sql/pltcl_queries.sql | 6 | ||||
-rw-r--r-- | src/pl/tcl/sql/pltcl_setup.sql | 5 |
12 files changed, 3 insertions, 80 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 4cfc506253..fe54b20903 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -2825,7 +2825,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger) elog(ERROR, "cache lookup failed for language %u", procStruct->prolang); langStruct = (Form_pg_language) GETSTRUCT(langTup); - prodesc->lang_oid = HeapTupleGetOid(langTup); + prodesc->lang_oid = langStruct->oid; prodesc->lanpltrusted = langStruct->lanpltrusted; ReleaseSysCache(langTup); diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index 59460d2643..8bacc74cce 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -1898,7 +1898,7 @@ build_row_from_vars(PLpgSQL_variable **vars, int numvars) row->dtype = PLPGSQL_DTYPE_ROW; row->refname = "(unnamed row)"; row->lineno = -1; - row->rowtupdesc = CreateTemplateTupleDesc(numvars, false); + row->rowtupdesc = CreateTemplateTupleDesc(numvars); row->nfields = numvars; row->fieldnames = palloc(numvars * sizeof(char *)); row->varnos = palloc(numvars * sizeof(int)); @@ -2031,7 +2031,7 @@ build_datatype(HeapTuple typeTup, int32 typmod, Oid collation) typ = (PLpgSQL_type *) palloc(sizeof(PLpgSQL_type)); typ->typname = pstrdup(NameStr(typeStruct->typname)); - typ->typoid = HeapTupleGetOid(typeTup); + typ->typoid = typeStruct->oid; switch (typeStruct->typtype) { case TYPTYPE_BASE: diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index d5694d3d08..39ea925820 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -2332,12 +2332,6 @@ exec_stmt_getdiag(PLpgSQL_execstate *estate, PLpgSQL_stmt_getdiag *stmt) false, INT8OID, -1); break; - case PLPGSQL_GETDIAG_RESULT_OID: - exec_assign_value(estate, var, - ObjectIdGetDatum(estate->eval_lastoid), - false, OIDOID, -1); - break; - case PLPGSQL_GETDIAG_ERROR_CONTEXT: exec_assign_c_string(estate, var, estate->cur_error->context); @@ -3936,7 +3930,6 @@ plpgsql_estate_setup(PLpgSQL_execstate *estate, estate->eval_tuptable = NULL; estate->eval_processed = 0; - estate->eval_lastoid = InvalidOid; estate->eval_econtext = NULL; estate->err_stmt = NULL; @@ -4180,7 +4173,6 @@ exec_stmt_execsql(PLpgSQL_execstate *estate, /* All variants should save result info for GET DIAGNOSTICS */ estate->eval_processed = SPI_processed; - estate->eval_lastoid = SPI_lastoid; /* Process INTO if present */ if (stmt->into) @@ -4371,7 +4363,6 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate, /* Save result info for GET DIAGNOSTICS */ estate->eval_processed = SPI_processed; - estate->eval_lastoid = SPI_lastoid; /* Process INTO if present */ if (stmt->into) @@ -5841,7 +5832,6 @@ exec_run_select(PLpgSQL_execstate *estate, Assert(estate->eval_tuptable == NULL); estate->eval_tuptable = SPI_tuptable; estate->eval_processed = SPI_processed; - estate->eval_lastoid = SPI_lastoid; return rc; } diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index b93f866223..4266e6cee7 100644 --- a/src/pl/plpgsql/src/pl_funcs.c +++ b/src/pl/plpgsql/src/pl_funcs.c @@ -307,8 +307,6 @@ plpgsql_getdiag_kindname(PLpgSQL_getdiag_kind kind) { case PLPGSQL_GETDIAG_ROW_COUNT: return "ROW_COUNT"; - case PLPGSQL_GETDIAG_RESULT_OID: - return "RESULT_OID"; case PLPGSQL_GETDIAG_CONTEXT: return "PG_CONTEXT"; case PLPGSQL_GETDIAG_ERROR_CONTEXT: diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y index 68e399f9cf..a979a5109d 100644 --- a/src/pl/plpgsql/src/pl_gram.y +++ b/src/pl/plpgsql/src/pl_gram.y @@ -327,7 +327,6 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt); %token <keyword> K_RAISE %token <keyword> K_RELATIVE %token <keyword> K_RESET -%token <keyword> K_RESULT_OID %token <keyword> K_RETURN %token <keyword> K_RETURNED_SQLSTATE %token <keyword> K_REVERSE @@ -977,7 +976,6 @@ stmt_getdiag : K_GET getdiag_area_opt K_DIAGNOSTICS getdiag_list ';' { /* these fields are disallowed in stacked case */ case PLPGSQL_GETDIAG_ROW_COUNT: - case PLPGSQL_GETDIAG_RESULT_OID: if (new->is_stacked) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), @@ -1061,9 +1059,6 @@ getdiag_item : K_ROW_COUNT, "row_count")) $$ = PLPGSQL_GETDIAG_ROW_COUNT; else if (tok_is_keyword(tok, &yylval, - K_RESULT_OID, "result_oid")) - $$ = PLPGSQL_GETDIAG_RESULT_OID; - else if (tok_is_keyword(tok, &yylval, K_PG_CONTEXT, "pg_context")) $$ = PLPGSQL_GETDIAG_CONTEXT; else if (tok_is_keyword(tok, &yylval, @@ -2518,7 +2513,6 @@ unreserved_keyword : | K_RAISE | K_RELATIVE | K_RESET - | K_RESULT_OID | K_RETURN | K_RETURNED_SQLSTATE | K_REVERSE diff --git a/src/pl/plpgsql/src/pl_scanner.c b/src/pl/plpgsql/src/pl_scanner.c index fc4ba3054a..ab18946847 100644 --- a/src/pl/plpgsql/src/pl_scanner.c +++ b/src/pl/plpgsql/src/pl_scanner.c @@ -158,7 +158,6 @@ static const ScanKeyword unreserved_keywords[] = { PG_KEYWORD("raise", K_RAISE, UNRESERVED_KEYWORD) PG_KEYWORD("relative", K_RELATIVE, UNRESERVED_KEYWORD) PG_KEYWORD("reset", K_RESET, UNRESERVED_KEYWORD) - PG_KEYWORD("result_oid", K_RESULT_OID, UNRESERVED_KEYWORD) PG_KEYWORD("return", K_RETURN, UNRESERVED_KEYWORD) PG_KEYWORD("returned_sqlstate", K_RETURNED_SQLSTATE, UNRESERVED_KEYWORD) PG_KEYWORD("reverse", K_REVERSE, UNRESERVED_KEYWORD) diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index f6c35a5049..42177ccaa6 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -148,7 +148,6 @@ enum typedef enum PLpgSQL_getdiag_kind { PLPGSQL_GETDIAG_ROW_COUNT, - PLPGSQL_GETDIAG_RESULT_OID, PLPGSQL_GETDIAG_CONTEXT, PLPGSQL_GETDIAG_ERROR_CONTEXT, PLPGSQL_GETDIAG_ERROR_DETAIL, @@ -1043,7 +1042,6 @@ typedef struct PLpgSQL_execstate /* temporary state for results from evaluation of query or expr */ SPITupleTable *eval_tuptable; uint64 eval_processed; - Oid eval_lastoid; ExprContext *eval_econtext; /* for executing simple expressions */ /* status information for error context reporting */ diff --git a/src/pl/tcl/expected/pltcl_queries.out b/src/pl/tcl/expected/pltcl_queries.out index 736671cc1b..17e821bb4c 100644 --- a/src/pl/tcl/expected/pltcl_queries.out +++ b/src/pl/tcl/expected/pltcl_queries.out @@ -402,21 +402,6 @@ NOTICE: args: {42 {statement trigger}} ERROR: argisnull cannot be used in triggers select trigger_data(); ERROR: trigger functions can only be called as triggers --- Test spi_lastoid primitive -create temp table t1 (f1 int); -select tcl_lastoid('t1'); - tcl_lastoid -------------- - 0 -(1 row) - -create temp table t2 (f1 int) with oids; -select tcl_lastoid('t2') > 0; - ?column? ----------- - t -(1 row) - -- test some error cases create function tcl_error(out a int, out b int) as $$return {$$ language pltcl; select tcl_error(); diff --git a/src/pl/tcl/expected/pltcl_setup.out b/src/pl/tcl/expected/pltcl_setup.out index f1958c3a98..b10cf4e47d 100644 --- a/src/pl/tcl/expected/pltcl_setup.out +++ b/src/pl/tcl/expected/pltcl_setup.out @@ -431,10 +431,6 @@ create function tcl_composite_arg_ref2(T_dta1) returns text as ' create function tcl_argisnull(text) returns bool as ' argisnull 1 ' language pltcl; -create function tcl_lastoid(tabname text) returns int8 as ' - spi_exec "insert into $1 default values" - spi_lastoid -' language pltcl; create function tcl_int4add(int4,int4) returns int4 as ' return [expr $1 + $2] ' language pltcl; diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index e2fa43b890..3b1454f833 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -307,8 +307,6 @@ static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); static int pltcl_subtransaction(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int pltcl_commit(ClientData cdata, Tcl_Interp *interp, @@ -523,8 +521,6 @@ pltcl_init_interp(pltcl_interp_desc *interp_desc, Oid prolang, bool pltrusted) pltcl_SPI_prepare, NULL, NULL); Tcl_CreateObjCommand(interp, "spi_execp", pltcl_SPI_execute_plan, NULL, NULL); - Tcl_CreateObjCommand(interp, "spi_lastoid", - pltcl_SPI_lastoid, NULL, NULL); Tcl_CreateObjCommand(interp, "subtransaction", pltcl_subtransaction, NULL, NULL); Tcl_CreateObjCommand(interp, "commit", @@ -2874,28 +2870,6 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, /********************************************************************** - * pltcl_SPI_lastoid() - return the last oid. To - * be used after insert queries - **********************************************************************/ -static int -pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - /* - * Check call syntax - */ - if (objc != 1) - { - Tcl_WrongNumArgs(interp, 1, objv, ""); - return TCL_ERROR; - } - - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(SPI_lastoid)); - return TCL_OK; -} - - -/********************************************************************** * pltcl_subtransaction() - Execute some Tcl code in a subtransaction * * The subtransaction is aborted if the Tcl code fragment returns TCL_ERROR, diff --git a/src/pl/tcl/sql/pltcl_queries.sql b/src/pl/tcl/sql/pltcl_queries.sql index 71c1238bd2..7390de6bd6 100644 --- a/src/pl/tcl/sql/pltcl_queries.sql +++ b/src/pl/tcl/sql/pltcl_queries.sql @@ -117,12 +117,6 @@ select tcl_argisnull(null); insert into trigger_test(test_argisnull) values(true); select trigger_data(); --- Test spi_lastoid primitive -create temp table t1 (f1 int); -select tcl_lastoid('t1'); -create temp table t2 (f1 int) with oids; -select tcl_lastoid('t2') > 0; - -- test some error cases create function tcl_error(out a int, out b int) as $$return {$$ language pltcl; select tcl_error(); diff --git a/src/pl/tcl/sql/pltcl_setup.sql b/src/pl/tcl/sql/pltcl_setup.sql index 56a90dc844..0ea46134c7 100644 --- a/src/pl/tcl/sql/pltcl_setup.sql +++ b/src/pl/tcl/sql/pltcl_setup.sql @@ -465,11 +465,6 @@ create function tcl_argisnull(text) returns bool as ' argisnull 1 ' language pltcl; -create function tcl_lastoid(tabname text) returns int8 as ' - spi_exec "insert into $1 default values" - spi_lastoid -' language pltcl; - create function tcl_int4add(int4,int4) returns int4 as ' return [expr $1 + $2] |