On 01/26/2015 05:14 PM, Tom Lane wrote:
Pavel Stehule <pavel.steh...@gmail.com> writes:
2015-01-26 14:02 GMT+01:00 Marko Tiikkaja <ma...@joh.to>:
I am thinking, so solution
/* if we are doing RAISE, don't report its location */
if (estate->err_text == raise_skip_msg)
return;
is too simple, and this part should be fixed. This change can be done by on
plpgsql or libpq side. This is bug, and it should be fixed.
Doing this in libpq is utterly insane. It has not got sufficient context
to do anything intelligent. The fact that it's not intelligent is exposed
by the regression test changes that the proposed patch causes, most of
which do not look like improvements.
I think doing this in libpq (or psql) is the way to go. How can the
server know if the client wants to display context information? We just
have to make sure the client has enough information to make a smart
decision. If the client doesn't have enough information today, then
let's work on that.
Note that Marko's patch didn't change libpq's default printing mode,
which is why you got all the extra CONTEXT lines in the regression tests
that were not there before. Just as if we just removed the suppression
from PL/pgSQL and did nothing else. I think we need to also change the
default behaviour to not print CONTEXT lines for NOTICE-level messages,
getting us closer to the current behaviour again.
If you run the regression tests in the "compact" verbosity, the
regression test output changes look quite sensible to me. See attached.
Another problem is that past requests to change this behavior have
generally been to the effect that people wanted *more* context suppressed
not less, ie they didn't want any CONTEXT lines at all on certain
messages. So the proposed patch seems to me to be going in exactly the
wrong direction.
After changing the default to "compact", it prints less CONTEXT lines.
The design I thought had been agreed on was to add some new option to
plpgsql's RAISE command which would cause suppression of all CONTEXT lines
not just the most closely nested one.
I don't understand how you came to that conclusion. In particular, see
http://www.postgresql.org/message-id/6656.1377100...@sss.pgh.pa.us. If
you changed your mind, you forgot to tell why.
- Heikki
***
/home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/triggers.out
2015-07-07 15:40:38.697861317 +0300
--- /home/heikki/git-sandbox-pgsql/master/src/test/regress/results/triggers.out
2015-07-07 15:50:34.885805473 +0300
***************
*** 958,968 ****
NOTICE: main_view INSTEAD OF INSERT ROW (instead_of_ins)
NOTICE: NEW: (20,30)
NOTICE: trigger_func(before_ins_stmt) called: action = INSERT, when =
BEFORE, level = STATEMENT
- CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
- PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: trigger_func(after_ins_stmt) called: action = INSERT, when = AFTER,
level = STATEMENT
- CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
- PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: main_view AFTER INSERT STATEMENT (after_view_ins_stmt)
INSERT 0 1
INSERT INTO main_view VALUES (21, 31) RETURNING a, b;
--- 958,964 ----
***************
*** 970,980 ****
NOTICE: main_view INSTEAD OF INSERT ROW (instead_of_ins)
NOTICE: NEW: (21,31)
NOTICE: trigger_func(before_ins_stmt) called: action = INSERT, when =
BEFORE, level = STATEMENT
- CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
- PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: trigger_func(after_ins_stmt) called: action = INSERT, when = AFTER,
level = STATEMENT
- CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
- PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: main_view AFTER INSERT STATEMENT (after_view_ins_stmt)
a | b
----+----
--- 966,972 ----
***************
*** 988,1004 ****
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (20,30), NEW: (20,31)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when =
BEFORE, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(before_upd_a_row) called: action = UPDATE, when =
BEFORE, level = ROW
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when =
AFTER, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER,
level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
UPDATE 0
UPDATE main_view SET b = 32 WHERE a = 21 AND b = 31 RETURNING a, b;
--- 980,988 ----
***************
*** 1006,1022 ****
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (21,31), NEW: (21,32)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when =
BEFORE, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(before_upd_a_row) called: action = UPDATE, when =
BEFORE, level = ROW
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when =
AFTER, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER,
level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
a | b
---+---
--- 990,998 ----
***************
*** 1031,1050 ****
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (20,30), NEW: (20,31)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when =
BEFORE, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_a_b_row) called: action = UPDATE, when =
AFTER, level = ROW
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_row) called: action = UPDATE, when = AFTER,
level = ROW
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when =
AFTER, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER,
level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
UPDATE 1
UPDATE main_view SET b = 32 WHERE a = 21 AND b = 31 RETURNING a, b;
--- 1007,1016 ----
***************
*** 1052,1071 ****
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (21,31), NEW: (21,32)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when =
BEFORE, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_a_b_row) called: action = UPDATE, when =
AFTER, level = ROW
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_row) called: action = UPDATE, when = AFTER,
level = ROW
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when =
AFTER, level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER,
level = STATEMENT
- CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a =
OLD.a AND b = OLD.b"
- PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
a | b
----+----
--- 1018,1027 ----
***************
*** 1277,1282 ****
--- 1233,1239 ----
-- UPDATE .. RETURNING
UPDATE city_view SET country_name = 'Japon' WHERE city_name = 'Tokyo'; --
error
ERROR: No such country: "Japon"
+ CONTEXT: PL/pgSQL function city_update() line 9 at RAISE
UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Takyo'; -- no
match
UPDATE 0
UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Tokyo'
RETURNING *; -- OK
***************
*** 1489,1514 ****
insert into depth_a values (1);
NOTICE: depth_a_tr: depth = 1
NOTICE: depth_b_tr: depth = 2
- CONTEXT: SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
- CONTEXT: SQL statement "insert into depth_c values (1)"
- PL/pgSQL function depth_b_tf() line 5 at EXECUTE statement
- SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: SQLSTATE = U9999: depth = 2
- CONTEXT: SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_b_tr: depth = 2
- CONTEXT: SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
- CONTEXT: SQL statement "insert into depth_c values (1)"
- PL/pgSQL function depth_b_tf() line 12 at EXECUTE statement
- SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
ERROR: U9999
! CONTEXT: SQL statement "insert into depth_c values (1)"
PL/pgSQL function depth_b_tf() line 12 at EXECUTE statement
SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
--- 1446,1458 ----
insert into depth_a values (1);
NOTICE: depth_a_tr: depth = 1
NOTICE: depth_b_tr: depth = 2
NOTICE: depth_c_tr: depth = 3
NOTICE: SQLSTATE = U9999: depth = 2
NOTICE: depth_b_tr: depth = 2
NOTICE: depth_c_tr: depth = 3
ERROR: U9999
! CONTEXT: PL/pgSQL function depth_c_tf() line 5 at RAISE
! SQL statement "insert into depth_c values (1)"
PL/pgSQL function depth_b_tf() line 12 at EXECUTE statement
SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
***************
*** 1521,1541 ****
insert into depth_a values (2);
NOTICE: depth_a_tr: depth = 1
NOTICE: depth_b_tr: depth = 2
- CONTEXT: SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
- CONTEXT: SQL statement "insert into depth_c values (2)"
- PL/pgSQL function depth_b_tf() line 5 at EXECUTE statement
- SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
- CONTEXT: SQL statement "insert into depth_c values (2)"
- PL/pgSQL function depth_b_tf() line 5 at EXECUTE statement
- SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_b_tr: depth = 2
- CONTEXT: SQL statement "insert into depth_b values (new.id)"
- PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_a_tr: depth = 1
select pg_trigger_depth();
pg_trigger_depth
--- 1465,1473 ----
======================================================================
***
/home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/privileges.out
2015-07-07 15:40:38.689861374 +0300
---
/home/heikki/git-sandbox-pgsql/master/src/test/regress/results/privileges.out
2015-07-07 15:50:39.833771884 +0300
***************
*** 1023,1029 ****
ERROR: must have admin option on role "regressgroup2"
SELECT dogrant_ok(); -- ok: SECURITY DEFINER conveys ADMIN
NOTICE: role "regressuser5" is already a member of role "regressgroup2"
- CONTEXT: SQL function "dogrant_ok" statement 1
dogrant_ok
------------
--- 1023,1028 ----
======================================================================
***
/home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/plancache.out
2015-07-07 15:40:38.689861374 +0300
---
/home/heikki/git-sandbox-pgsql/master/src/test/regress/results/plancache.out
2015-07-07 15:50:42.433754234 +0300
***************
*** 234,241 ****
end$$ language plpgsql;
select cachebug();
NOTICE: table "temptable" does not exist, skipping
- CONTEXT: SQL statement "drop table if exists temptable cascade"
- PL/pgSQL function cachebug() line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
--- 234,239 ----
***************
*** 246,253 ****
select cachebug();
NOTICE: drop cascades to view vv
- CONTEXT: SQL statement "drop table if exists temptable cascade"
- PL/pgSQL function cachebug() line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
--- 244,249 ----
======================================================================
*** /home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/plpgsql.out
2015-07-07 15:40:38.689861374 +0300
--- /home/heikki/git-sandbox-pgsql/master/src/test/regress/results/plpgsql.out
2015-07-07 15:50:45.549733081 +0300
***************
*** 1518,1544 ****
DETAIL: Key (name)=(PF1_1) already exists.
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
ERROR: WS.not.there does not exist
! CONTEXT: PL/pgSQL function tg_backlink_a() line 17 at assignment
update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal backlink beginning with XX
! CONTEXT: PL/pgSQL function tg_backlink_a() line 17 at assignment
update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1';
ERROR: PS.not.there does not exist
! CONTEXT: PL/pgSQL function tg_slotlink_a() line 17 at assignment
update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal slotlink beginning with XX
! CONTEXT: PL/pgSQL function tg_slotlink_a() line 17 at assignment
insert into HSlot values ('HS', 'base.hub1', 1, '');
ERROR: duplicate key value violates unique constraint "hslot_name"
DETAIL: Key (slotname)=(HS.base.hub1.1 ) already exists.
insert into HSlot values ('HS', 'base.hub1', 20, '');
ERROR: no manual manipulation of HSlot
delete from HSlot;
ERROR: no manual manipulation of HSlot
insert into IFace values ('IF', 'notthere', 'eth0', '');
ERROR: system "notthere" does not exist
insert into IFace values ('IF', 'orion', 'ethernet_interface_name_too_long',
'');
ERROR: IFace slotname "IF.orion.ethernet_interface_name_too_long" too long
(20 char max)
--
-- The following tests are unrelated to the scenario outlined above;
-- they merely exercise specific parts of PL/pgSQL
--- 1518,1552 ----
DETAIL: Key (name)=(PF1_1) already exists.
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
ERROR: WS.not.there does not exist
! CONTEXT: PL/pgSQL function tg_backlink_set(character,character) line 30 at
RAISE
! PL/pgSQL function tg_backlink_a() line 17 at assignment
update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal backlink beginning with XX
! CONTEXT: PL/pgSQL function tg_backlink_set(character,character) line 47 at
RAISE
! PL/pgSQL function tg_backlink_a() line 17 at assignment
update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1';
ERROR: PS.not.there does not exist
! CONTEXT: PL/pgSQL function tg_slotlink_set(character,character) line 30 at
RAISE
! PL/pgSQL function tg_slotlink_a() line 17 at assignment
update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal slotlink beginning with XX
! CONTEXT: PL/pgSQL function tg_slotlink_set(character,character) line 77 at
RAISE
! PL/pgSQL function tg_slotlink_a() line 17 at assignment
insert into HSlot values ('HS', 'base.hub1', 1, '');
ERROR: duplicate key value violates unique constraint "hslot_name"
DETAIL: Key (slotname)=(HS.base.hub1.1 ) already exists.
insert into HSlot values ('HS', 'base.hub1', 20, '');
ERROR: no manual manipulation of HSlot
+ CONTEXT: PL/pgSQL function tg_hslot_biu() line 12 at RAISE
delete from HSlot;
ERROR: no manual manipulation of HSlot
+ CONTEXT: PL/pgSQL function tg_hslot_bd() line 12 at RAISE
insert into IFace values ('IF', 'notthere', 'eth0', '');
ERROR: system "notthere" does not exist
+ CONTEXT: PL/pgSQL function tg_iface_biu() line 8 at RAISE
insert into IFace values ('IF', 'orion', 'ethernet_interface_name_too_long',
'');
ERROR: IFace slotname "IF.orion.ethernet_interface_name_too_long" too long
(20 char max)
+ CONTEXT: PL/pgSQL function tg_iface_biu() line 14 at RAISE
--
-- The following tests are unrelated to the scenario outlined above;
-- they merely exercise specific parts of PL/pgSQL
***************
*** 1963,1968 ****
--- 1971,1977 ----
NOTICE: should see this only if -100 <> 0
NOTICE: should see this only if -100 fits in smallint
ERROR: -100 is less than zero
+ CONTEXT: PL/pgSQL function trap_zero_divide(integer) line 12 at RAISE
create function trap_matching_test(int) returns int as $$
declare x int;
sx smallint;
***************
*** 2066,2079 ****
end$$ language plpgsql;
select test_variable_storage();
NOTICE: should see this
- CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
- PL/pgSQL function test_variable_storage() line 8 at PERFORM
NOTICE: should see this only if -100 <> 0
- CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
- PL/pgSQL function test_variable_storage() line 8 at PERFORM
NOTICE: should see this only if -100 fits in smallint
- CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
- PL/pgSQL function test_variable_storage() line 8 at PERFORM
test_variable_storage
-----------------------
123456789012
--- 2075,2082 ----
***************
*** 4052,4057 ****
--- 4055,4061 ----
HINT: some hint
ERROR: 1 2 3
DETAIL: some detail info
+ CONTEXT: PL/pgSQL function raise_test() line 5 at RAISE
-- Since we can't actually see the thrown SQLSTATE in default psql output,
-- test it like this; this also tests re-RAISE
create or replace function raise_test() returns void as $$
***************
*** 4068,4073 ****
--- 4072,4078 ----
NOTICE: SQLSTATE: 22012 SQLERRM: check me
ERROR: check me
DETAIL: some detail info
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise 'check me'
***************
*** 4082,4087 ****
--- 4087,4093 ----
NOTICE: SQLSTATE: 1234F SQLERRM: check me
ERROR: check me
DETAIL: some detail info
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
-- SQLSTATE specification in WHEN
create or replace function raise_test() returns void as $$
begin
***************
*** 4097,4102 ****
--- 4103,4109 ----
NOTICE: SQLSTATE: 1234F SQLERRM: check me
ERROR: check me
DETAIL: some detail info
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise division_by_zero using detail = 'some detail info';
***************
*** 4110,4115 ****
--- 4117,4123 ----
NOTICE: SQLSTATE: 22012 SQLERRM: division_by_zero
ERROR: division_by_zero
DETAIL: some detail info
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise division_by_zero;
***************
*** 4117,4122 ****
--- 4125,4131 ----
$$ language plpgsql;
select raise_test();
ERROR: division_by_zero
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise sqlstate '1234F';
***************
*** 4124,4129 ****
--- 4133,4139 ----
$$ language plpgsql;
select raise_test();
ERROR: 1234F
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise division_by_zero using message = 'custom' || ' message';
***************
*** 4131,4136 ****
--- 4141,4147 ----
$$ language plpgsql;
select raise_test();
ERROR: custom message
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise using message = 'custom' || ' message', errcode = '22012';
***************
*** 4138,4143 ****
--- 4149,4155 ----
$$ language plpgsql;
select raise_test();
ERROR: custom message
+ CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
-- conflict on message
create or replace function raise_test() returns void as $$
begin
***************
*** 4254,4259 ****
--- 4266,4272 ----
select raise_test();
NOTICE: 22012
ERROR: substitute message
+ CONTEXT: PL/pgSQL function raise_test() line 7 at RAISE
drop function raise_test();
-- test passing column_name, constraint_name, datatype_name, table_name
-- and schema_name error fields
***************
*** 4744,4750 ****
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
QUERY: SELECT 'foo\\bar\041baz'
- CONTEXT: PL/pgSQL function strtest() line 4 at RETURN
strtest
-------------
foo\bar!baz
--- 4757,4762 ----
***************
*** 5260,5281 ****
select outer_outer_func(10);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 4 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 7 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------
--- 5272,5285 ----
***************
*** 5286,5307 ****
select outer_outer_func(20);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 4 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 7 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------
--- 5290,5303 ----
***************
*** 5358,5379 ****
select outer_outer_func(10);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 10 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 15 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------
--- 5354,5367 ----
***************
*** 5384,5405 ****
select outer_outer_func(20);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 10 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 15 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
- CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
- PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
- CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------
--- 5372,5385 ----
======================================================================
*** /home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/copy2.out
2015-07-07 15:40:38.677861460 +0300
--- /home/heikki/git-sandbox-pgsql/master/src/test/regress/results/copy2.out
2015-07-07 15:50:42.577753257 +0300
***************
*** 447,458 ****
copy check_con_tbl from stdin;
NOTICE: input = {"f1":1}
- CONTEXT: COPY check_con_tbl, line 1: "1"
NOTICE: input = {"f1":null}
- CONTEXT: COPY check_con_tbl, line 2: "\N"
copy check_con_tbl from stdin;
NOTICE: input = {"f1":0}
- CONTEXT: COPY check_con_tbl, line 1: "0"
ERROR: new row for relation "check_con_tbl" violates check constraint
"check_con_tbl_check"
DETAIL: Failing row contains (0).
CONTEXT: COPY check_con_tbl, line 1: "0"
--- 447,455 ----
======================================================================
***
/home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/rangefuncs.out
2015-07-07 15:40:38.689861374 +0300
---
/home/heikki/git-sandbox-pgsql/master/src/test/regress/results/rangefuncs.out
2015-07-07 15:50:42.745752116 +0300
***************
*** 1704,1712 ****
execute procedure noticetrigger();
select insert_tt2('foolme','barme') limit 1;
NOTICE: noticetrigger 11 foolme
- CONTEXT: SQL function "insert_tt2" statement 1
NOTICE: noticetrigger 12 barme
- CONTEXT: SQL function "insert_tt2" statement 1
insert_tt2
------------
11
--- 1704,1710 ----
***************
*** 1735,1743 ****
insert into tt_log values(new.*);
select insert_tt2('foollog','barlog') limit 1;
NOTICE: noticetrigger 13 foollog
- CONTEXT: SQL function "insert_tt2" statement 1
NOTICE: noticetrigger 14 barlog
- CONTEXT: SQL function "insert_tt2" statement 1
insert_tt2
------------
13
--- 1733,1739 ----
======================================================================
*** /home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/xml.out
2015-07-07 15:40:38.697861317 +0300
--- /home/heikki/git-sandbox-pgsql/master/src/test/regress/results/xml.out
2015-07-07 15:50:42.425754288 +0300
***************
*** 934,940 ****
WARNING: line 1: xmlns: URI relative is not absolute
<relativens xmlns='relative'/>
^
- CONTEXT: SQL function "xpath" statement 1
xpath
--------------------------------------
{"<relativens xmlns=\"relative\"/>"}
--- 934,939 ----
======================================================================
***
/home/heikki/git-sandbox-pgsql/master/src/test/regress/expected/event_trigger.out
2015-07-07 15:40:38.681861432 +0300
---
/home/heikki/git-sandbox-pgsql/master/src/test/regress/results/event_trigger.out
2015-07-07 15:50:45.665732294 +0300
***************
*** 234,248 ****
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_two"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS
audit_tbls.audit_tbls_schema_two_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
- SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
ERROR: object audit_tbls.schema_two_table_three of type table cannot be
dropped
! CONTEXT: SQL statement "DROP TABLE IF EXISTS
audit_tbls.schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
DELETE FROM undroppable_objs WHERE object_identity =
'audit_tbls.schema_two_table_three';
DROP SCHEMA schema_one, schema_two CASCADE;
--- 234,243 ----
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
ERROR: object audit_tbls.schema_two_table_three of type table cannot be
dropped
! CONTEXT: PL/pgSQL function undroppable() line 14 at RAISE
! SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
DELETE FROM undroppable_objs WHERE object_identity =
'audit_tbls.schema_two_table_three';
DROP SCHEMA schema_one, schema_two CASCADE;
***************
*** 255,277 ****
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_two"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS
audit_tbls.audit_tbls_schema_two_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
- SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "schema_one_table_one" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_one_table_one"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "schema_one_table two" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls."schema_one_table
two""
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "schema_one_table_three" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS
audit_tbls.schema_one_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
ERROR: object schema_one.table_three of type table cannot be dropped
DELETE FROM undroppable_objs WHERE object_identity = 'schema_one.table_three';
DROP SCHEMA schema_one, schema_two CASCADE;
NOTICE: drop cascades to 7 other objects
--- 250,261 ----
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
NOTICE: table "schema_one_table_one" does not exist, skipping
NOTICE: table "schema_one_table two" does not exist, skipping
NOTICE: table "schema_one_table_three" does not exist, skipping
ERROR: object schema_one.table_three of type table cannot be dropped
+ CONTEXT: PL/pgSQL function undroppable() line 14 at RAISE
DELETE FROM undroppable_objs WHERE object_identity = 'schema_one.table_three';
DROP SCHEMA schema_one, schema_two CASCADE;
NOTICE: drop cascades to 7 other objects
***************
*** 283,304 ****
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_two"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS
audit_tbls.audit_tbls_schema_two_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
- SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "schema_one_table_one" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_one_table_one"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "schema_one_table two" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls."schema_one_table
two""
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
NOTICE: table "schema_one_table_three" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS
audit_tbls.schema_one_table_three"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
SELECT * FROM dropped_objects WHERE schema IS NULL OR schema <> 'pg_toast';
type | schema | object
--------------+------------+-------------------------------------
--- 267,276 ----
***************
*** 329,336 ****
DROP OWNED BY regression_bob;
NOTICE: schema "audit_tbls" does not exist, skipping
- CONTEXT: SQL statement "DROP TABLE IF EXISTS
audit_tbls.audit_tbls_schema_one_table_two"
- PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE statement
SELECT * FROM dropped_objects WHERE type = 'schema';
type | schema | object
--------+--------+------------
--- 301,306 ----
***************
*** 402,409 ****
--- 372,381 ----
select x * 1.001 from generate_series(1, 500) as t(x);
alter table rewriteme alter column foo type numeric;
ERROR: I'm sorry Sir, No Rewrite Allowed.
+ CONTEXT: PL/pgSQL function test_evtrig_no_rewrite() line 3 at RAISE
alter table rewriteme add column baz int default 0;
ERROR: I'm sorry Sir, No Rewrite Allowed.
+ CONTEXT: PL/pgSQL function test_evtrig_no_rewrite() line 3 at RAISE
-- test with more than one reason to rewrite a single table
CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger
LANGUAGE plpgsql AS $$
======================================================================
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers