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

Commitb3195da

Browse files
author
Neil Conway
committed
Minor cleanup for recent SQLSTATE / SQLERRM patch: spell "successful"
correctly, style fixes.
1 parent63e0d61 commitb3195da

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

‎src/pl/plpgsql/src/gram.y

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.70 2005/05/2600:16:31 momjian Exp $
7+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.71 2005/05/2603:18:53 neilc Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -285,7 +285,8 @@ fict_vars_sect:
285285
plpgsql_build_datatype(TEXTOID, -1), true);
286286
$$.sqlerrm_varno = var->dno;
287287
plpgsql_add_initdatums(NULL);
288-
};
288+
}
289+
;
289290

290291
decl_sect:opt_label
291292
{

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.139 2005/05/2600:16:31 momjian Exp $
6+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.140 2005/05/2603:18:53 neilc Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -760,7 +760,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
760760
var= (PLpgSQL_var*) (estate->datums[block->sqlerrm_varno]);
761761
var->isnull= false;
762762
var->freeval= true;
763-
var->value=DirectFunctionCall1(textin,CStringGetDatum("Sucessful completion"));
763+
var->value=DirectFunctionCall1(textin,CStringGetDatum("Successful completion"));
764764

765765
/*
766766
* First initialize all variables declared in this block
@@ -777,7 +777,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
777777

778778
if (var->freeval)
779779
{
780-
pfree((void*)(var->value));
780+
pfree(DatumGetPointer(var->value));
781781
var->freeval= false;
782782
}
783783

@@ -872,13 +872,12 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
872872
CurrentResourceOwner=oldowner;
873873

874874
/* set SQLSTATE and SQLERRM variables */
875-
876875
var= (PLpgSQL_var*) (estate->datums[block->sqlstate_varno]);
877-
pfree((void*)(var->value));
876+
pfree(DatumGetPointer(var->value));
878877
var->value=DirectFunctionCall1(textin,CStringGetDatum(unpack_sql_state(edata->sqlerrcode)));
879-
878+
880879
var= (PLpgSQL_var*) (estate->datums[block->sqlerrm_varno]);
881-
pfree((void*)(var->value));
880+
pfree(DatumGetPointer(var->value));
882881
var->value=DirectFunctionCall1(textin,CStringGetDatum(edata->message));
883882

884883
/*

‎src/test/regress/expected/plpgsql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,7 @@ CONTEXT: PL/pgSQL function "missing_return_expr"
23812381
drop function void_return_expr();
23822382
drop function missing_return_expr();
23832383
-- test SQLSTATE and SQLERRM
2384-
createor replacefunction trap_exceptions() returns void as $_$
2384+
create function trap_exceptions() returns void as $_$
23852385
begin
23862386
begin
23872387
raise exception 'first exception';
@@ -2398,7 +2398,7 @@ begin
23982398
end; $_$ language plpgsql;
23992399
select trap_exceptions();
24002400
NOTICE: P0001 first exception
2401-
NOTICE: 00000Sucessful completion
2401+
NOTICE: 00000Successful completion
24022402
NOTICE: P0001 last exception
24032403
trap_exceptions
24042404
-----------------

‎src/test/regress/sql/plpgsql.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,8 +2018,9 @@ select missing_return_expr();
20182018

20192019
dropfunction void_return_expr();
20202020
dropfunction missing_return_expr();
2021+
20212022
-- test SQLSTATE and SQLERRM
2022-
createor replacefunctiontrap_exceptions() returns voidas $_$
2023+
createfunctiontrap_exceptions() returns voidas $_$
20232024
begin
20242025
begin
20252026
raise exception'first exception';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp