Commit b3195dae authored by Neil Conway's avatar Neil Conway

Minor cleanup for recent SQLSTATE / SQLERRM patch: spell "successful"

correctly, style fixes.
parent 63e0d612
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.70 2005/05/26 00:16:31 momjian Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.71 2005/05/26 03:18:53 neilc Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -285,7 +285,8 @@ fict_vars_sect : ...@@ -285,7 +285,8 @@ fict_vars_sect :
plpgsql_build_datatype(TEXTOID, -1), true); plpgsql_build_datatype(TEXTOID, -1), true);
$$.sqlerrm_varno = var->dno; $$.sqlerrm_varno = var->dno;
plpgsql_add_initdatums(NULL); plpgsql_add_initdatums(NULL);
}; }
;
decl_sect : opt_label decl_sect : opt_label
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.139 2005/05/26 00:16:31 momjian Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.140 2005/05/26 03:18:53 neilc Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -760,7 +760,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block) ...@@ -760,7 +760,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
var = (PLpgSQL_var *) (estate->datums[block->sqlerrm_varno]); var = (PLpgSQL_var *) (estate->datums[block->sqlerrm_varno]);
var->isnull = false; var->isnull = false;
var->freeval = true; var->freeval = true;
var->value = DirectFunctionCall1(textin, CStringGetDatum("Sucessful completion")); var->value = DirectFunctionCall1(textin, CStringGetDatum("Successful completion"));
/* /*
* First initialize all variables declared in this block * First initialize all variables declared in this block
...@@ -777,7 +777,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block) ...@@ -777,7 +777,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
if (var->freeval) if (var->freeval)
{ {
pfree((void *) (var->value)); pfree(DatumGetPointer(var->value));
var->freeval = false; var->freeval = false;
} }
...@@ -872,13 +872,12 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block) ...@@ -872,13 +872,12 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
CurrentResourceOwner = oldowner; CurrentResourceOwner = oldowner;
/* set SQLSTATE and SQLERRM variables */ /* set SQLSTATE and SQLERRM variables */
var = (PLpgSQL_var *) (estate->datums[block->sqlstate_varno]); var = (PLpgSQL_var *) (estate->datums[block->sqlstate_varno]);
pfree((void *) (var->value)); pfree(DatumGetPointer(var->value));
var->value = DirectFunctionCall1(textin, CStringGetDatum(unpack_sql_state(edata->sqlerrcode))); var->value = DirectFunctionCall1(textin, CStringGetDatum(unpack_sql_state(edata->sqlerrcode)));
var = (PLpgSQL_var *) (estate->datums[block->sqlerrm_varno]); var = (PLpgSQL_var *) (estate->datums[block->sqlerrm_varno]);
pfree((void *) (var->value)); pfree(DatumGetPointer(var->value));
var->value = DirectFunctionCall1(textin, CStringGetDatum(edata->message)); var->value = DirectFunctionCall1(textin, CStringGetDatum(edata->message));
/* /*
......
...@@ -2381,7 +2381,7 @@ CONTEXT: PL/pgSQL function "missing_return_expr" ...@@ -2381,7 +2381,7 @@ CONTEXT: PL/pgSQL function "missing_return_expr"
drop function void_return_expr(); drop function void_return_expr();
drop function missing_return_expr(); drop function missing_return_expr();
-- test SQLSTATE and SQLERRM -- test SQLSTATE and SQLERRM
create or replace function trap_exceptions() returns void as $_$ create function trap_exceptions() returns void as $_$
begin begin
begin begin
raise exception 'first exception'; raise exception 'first exception';
...@@ -2398,7 +2398,7 @@ begin ...@@ -2398,7 +2398,7 @@ begin
end; $_$ language plpgsql; end; $_$ language plpgsql;
select trap_exceptions(); select trap_exceptions();
NOTICE: P0001 first exception NOTICE: P0001 first exception
NOTICE: 00000 Sucessful completion NOTICE: 00000 Successful completion
NOTICE: P0001 last exception NOTICE: P0001 last exception
trap_exceptions trap_exceptions
----------------- -----------------
......
...@@ -2018,8 +2018,9 @@ select missing_return_expr(); ...@@ -2018,8 +2018,9 @@ select missing_return_expr();
drop function void_return_expr(); drop function void_return_expr();
drop function missing_return_expr(); drop function missing_return_expr();
-- test SQLSTATE and SQLERRM -- test SQLSTATE and SQLERRM
create or replace function trap_exceptions() returns void as $_$ create function trap_exceptions() returns void as $_$
begin begin
begin begin
raise exception 'first exception'; raise exception 'first exception';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment