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

Commit4af123a

Browse files
committed
Fix misleading error message context
Author: Pavel Stehule <pavel.stehule@gmail.com>Reviewed-by: Stepan Neretin <sncfmgg@gmail.com>Discussion:https://www.postgresql.org/message-id/flat/CAFj8pRAw+OkVW=FgMKHKyvY3CgtWy3cWdY7XT+S5TJaTttu=oA@mail.gmail.com
1 parent1b373ae commit4af123a

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

‎src/backend/executor/spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2978,7 +2978,7 @@ _SPI_error_callback(void *arg)
29782978
switch (carg->mode)
29792979
{
29802980
caseRAW_PARSE_PLPGSQL_EXPR:
2981-
errcontext("SQL expression \"%s\"",query);
2981+
errcontext("PL/pgSQL expression \"%s\"",query);
29822982
break;
29832983
caseRAW_PARSE_PLPGSQL_ASSIGN1:
29842984
caseRAW_PARSE_PLPGSQL_ASSIGN2:

‎src/pl/plpgsql/src/expected/plpgsql_record.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ NOTICE: r1.q1 = <NULL>
272272
NOTICE: r1.q2 = <NULL>
273273
NOTICE: r1 = <NULL>
274274
ERROR: record "r1" has no field "nosuchfield"
275-
CONTEXT:SQL expression "r1.nosuchfield"
275+
CONTEXT:PL/pgSQL expression "r1.nosuchfield"
276276
PL/pgSQL function inline_code_block line 7 at RAISE
277277
-- records, not so much
278278
do $$
@@ -286,7 +286,7 @@ end$$;
286286
NOTICE: r1 = <NULL>
287287
ERROR: record "r1" is not assigned yet
288288
DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.
289-
CONTEXT:SQL expression "r1.f1"
289+
CONTEXT:PL/pgSQL expression "r1.f1"
290290
PL/pgSQL function inline_code_block line 5 at RAISE
291291
-- but OK if you assign first
292292
do $$
@@ -304,7 +304,7 @@ NOTICE: r1.f1 = 1
304304
NOTICE: r1.f2 = 2
305305
NOTICE: r1 = (1,2)
306306
ERROR: record "r1" has no field "nosuchfield"
307-
CONTEXT:SQL expression "r1.nosuchfield"
307+
CONTEXT:PL/pgSQL expression "r1.nosuchfield"
308308
PL/pgSQL function inline_code_block line 9 at RAISE
309309
-- check %type with block-qualified variable names
310310
do $$
@@ -598,7 +598,7 @@ create function getf3(x mutable) returns int language plpgsql as
598598
$$ begin return x.f3; end $$;
599599
select getf3(null::mutable); -- doesn't work yet
600600
ERROR: record "x" has no field "f3"
601-
CONTEXT:SQL expression "x.f3"
601+
CONTEXT:PL/pgSQL expression "x.f3"
602602
PL/pgSQL function getf3(mutable) line 1 at RETURN
603603
alter table mutable add column f3 int;
604604
select getf3(null::mutable); -- now it works

‎src/pl/plpgsql/src/expected/plpgsql_varprops.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ begin
7676
raise notice 'x = %', x;
7777
end$$;
7878
ERROR: division by zero
79-
CONTEXT:SQL expression "1/0"
79+
CONTEXT:PL/pgSQL expression "1/0"
8080
PL/pgSQL function inline_code_block line 2 during statement block local variable initialization
8181
do $$
8282
declare x bigint[] := array[1,3,5];

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,7 +2388,7 @@ begin
23882388
end $$ language plpgsql;
23892389
select namedparmcursor_test7();
23902390
ERROR: division by zero
2391-
CONTEXT:SQL expression "42/0 AS p1, 77 AS p2"
2391+
CONTEXT:PL/pgSQL expression "42/0 AS p1, 77 AS p2"
23922392
PL/pgSQL function namedparmcursor_test7() line 6 at OPEN
23932393
-- check that line comments work correctly within the argument list
23942394
-- (this used to require a special hack in the code; it no longer does,
@@ -4563,11 +4563,11 @@ end
45634563
$$;
45644564
select fail();
45654565
ERROR: division by zero
4566-
CONTEXT:SQL expression "1/0"
4566+
CONTEXT:PL/pgSQL expression "1/0"
45674567
PL/pgSQL function fail() line 3 at RETURN
45684568
select fail();
45694569
ERROR: division by zero
4570-
CONTEXT:SQL expression "1/0"
4570+
CONTEXT:PL/pgSQL expression "1/0"
45714571
PL/pgSQL function fail() line 3 at RETURN
45724572
drop function fail();
45734573
-- Test handling of string literals.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp