From db53b1ff79ae2bbb11fd99aed0fa899c29c030d3 Mon Sep 17 00:00:00 2001 From: "okbob@github.com" Date: Fri, 21 Jun 2024 08:16:50 +0200 Subject: [PATCH 1/3] release plans created by plpgsql_check in passive mode. Without it, the plan can be inconsistent for plpgsql and some plpgsql assertions. the trackers tests was executed with enabled passive check. Previously, the plans created by passive check was not removed, and it did impacts on deep of contexts and result of tracking. This patch fixes output of regress tests, and disable passive check mode before tracker tests. related to #174 --- expected/plpgsql_check_active.out | 97 ++++++++++++++++--------------- sql/plpgsql_check_active.sql | 1 + src/check_function.c | 2 + 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/expected/plpgsql_check_active.out b/expected/plpgsql_check_active.out index 449808c..5c8e1b5 100644 --- a/expected/plpgsql_check_active.out +++ b/expected/plpgsql_check_active.out @@ -8315,6 +8315,7 @@ ERROR: returned record type does not match expected record type drop function test_function(); drop function test_function33(); drop type testtype; +set plpgsql_check.mode to default; -- should not to raise false alarm create type c1 as ( a text @@ -8692,18 +8693,18 @@ set plpgsql_check.tracer_test_mode = true; select trace_test(3); NOTICE: #0 ->> start of function trace_test(integer) (oid=0, tnl=1) NOTICE: #0 "b" => '3' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '0' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '1' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '2' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '0' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '1' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '2' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0 <<- end of function trace_test (elapsed time=0.010 ms) trace_test ------------ @@ -8718,41 +8719,41 @@ NOTICE: #0.1 3 --> start of statement block (tnl=1) NOTICE: #0.2 4 --> start of FOR with integer loop variable (tnl=1) NOTICE: #0.3 6 --> start of assignment r := nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '0' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '0' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '0' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '0' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '0' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '1' NOTICE: #0.3 6 --> start of assignment r := nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '1' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '1' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '1' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '1' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '1' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '2' NOTICE: #0.3 6 --> start of assignment r := nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '2' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '2' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '2' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '2' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '2' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '3' NOTICE: #0.1 <-- end of FOR with integer loop variable (elapsed time=0.010 ms) @@ -8810,15 +8811,15 @@ NOTICE: #0.1 3 --> start of statement block (tnl=1) NOTICE: #0.2 4 --> start of FOR with integer loop variable (tnl=1) NOTICE: #0.3 6 --> start of perform plpgsql_check_pragma('disable: .. (tnl=1) NOTICE: #0.2 <-- end of PERFORM (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '0' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '1' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '2' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '0' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '1' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '2' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) NOTICE: #0.1 <-- end of FOR with integer loop variable (elapsed time=0.010 ms) NOTICE: #0.5 9 --> start of RETURN (tnl=1) NOTICE: #0.5 "r" => '3' diff --git a/sql/plpgsql_check_active.sql b/sql/plpgsql_check_active.sql index 92d06b3..822ab5a 100644 --- a/sql/plpgsql_check_active.sql +++ b/sql/plpgsql_check_active.sql @@ -4842,6 +4842,7 @@ drop function test_function33(); drop type testtype; +set plpgsql_check.mode to default; -- should not to raise false alarm create type c1 as ( diff --git a/src/check_function.c b/src/check_function.c index d8bd145..5be61b7 100644 --- a/src/check_function.c +++ b/src/check_function.c @@ -429,6 +429,8 @@ passive_check_func_beg(PLpgSQL_execstate *estate, PLpgSQL_function *func, void * plpgsql_check_report_unused_variables(&cstate); plpgsql_check_report_too_high_volatility(&cstate); } + + release_exprs(cstate.exprs); } PG_CATCH(); { From e029a85878ea2f3af9416e8f409030b4e307d421 Mon Sep 17 00:00:00 2001 From: "okbob@github.com" Date: Fri, 21 Jun 2024 08:22:27 +0200 Subject: [PATCH 2/3] prepare for 2.7.7 --- META.json | 4 ++-- postgresql12-plpgsql_check.spec | 2 +- postgresql13-plpgsql_check.spec | 2 +- postgresql14-plpgsql_check.spec | 2 +- postgresql15-plpgsql_check.spec | 2 +- postgresql16-plpgsql_check.spec | 2 +- postgresql17-plpgsql_check.spec | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/META.json b/META.json index 84ac49b..ebf0769 100644 --- a/META.json +++ b/META.json @@ -2,7 +2,7 @@ "name": "plpgsql_check", "abstract": "Additional tools for plpgsql functions validation", "description": "The plpgsql_check is PostgreSQL extension with functionality for direct or indirect extra validation of functions in plpgsql language. It verifies a validity of SQL identifiers used in plpgsql code. It try to identify a performance issues. Modern versions has integrated profiler. The table and function dependencies can be displayed", - "version": "2.7.6", + "version": "2.7.7", "maintainer": "Pavel STEHULE ", "license": "bsd", "provides": { @@ -10,7 +10,7 @@ "abstract": "Additional tools for plpgsql functions validation", "file": "sql/plpgsql_check_active.sql", "docfile": "README.md", - "version": "2.7.6" + "version": "2.7.7" } }, "prereqs": { diff --git a/postgresql12-plpgsql_check.spec b/postgresql12-plpgsql_check.spec index 45e8883..e5f7755 100644 --- a/postgresql12-plpgsql_check.spec +++ b/postgresql12-plpgsql_check.spec @@ -3,7 +3,7 @@ %global sname plpgsql_check Name: %{sname}_%{pgmajorversion} -Version: 2.7.6 +Version: 2.7.7 Release: 1%{?dist} Summary: Additional tools for plpgsql functions validation diff --git a/postgresql13-plpgsql_check.spec b/postgresql13-plpgsql_check.spec index f808f5e..4499895 100644 --- a/postgresql13-plpgsql_check.spec +++ b/postgresql13-plpgsql_check.spec @@ -3,7 +3,7 @@ %global sname plpgsql_check Name: %{sname}_%{pgmajorversion} -Version: 2.7.6 +Version: 2.7.7 Release: 1%{?dist} Summary: Additional tools for plpgsql functions validation diff --git a/postgresql14-plpgsql_check.spec b/postgresql14-plpgsql_check.spec index baa8c23..7ab147d 100644 --- a/postgresql14-plpgsql_check.spec +++ b/postgresql14-plpgsql_check.spec @@ -3,7 +3,7 @@ %global sname plpgsql_check Name: %{sname}_%{pgmajorversion} -Version: 2.7.6 +Version: 2.7.7 Release: 1%{?dist} Summary: Additional tools for plpgsql functions validation diff --git a/postgresql15-plpgsql_check.spec b/postgresql15-plpgsql_check.spec index 7d56a8d..276fb25 100644 --- a/postgresql15-plpgsql_check.spec +++ b/postgresql15-plpgsql_check.spec @@ -3,7 +3,7 @@ %global sname plpgsql_check Name: %{sname}_%{pgmajorversion} -Version: 2.7.6 +Version: 2.7.7 Release: 1%{?dist} Summary: Additional tools for plpgsql functions validation diff --git a/postgresql16-plpgsql_check.spec b/postgresql16-plpgsql_check.spec index c3dcbdc..76ed251 100644 --- a/postgresql16-plpgsql_check.spec +++ b/postgresql16-plpgsql_check.spec @@ -3,7 +3,7 @@ %global sname plpgsql_check Name: %{sname}_%{pgmajorversion} -Version: 2.7.6 +Version: 2.7.7 Release: 1%{?dist} Summary: Additional tools for plpgsql functions validation diff --git a/postgresql17-plpgsql_check.spec b/postgresql17-plpgsql_check.spec index 7b14e8d..2f8f283 100644 --- a/postgresql17-plpgsql_check.spec +++ b/postgresql17-plpgsql_check.spec @@ -3,7 +3,7 @@ %global sname plpgsql_check Name: %{sname}_%{pgmajorversion} -Version: 2.7.6 +Version: 2.7.7 Release: 1%{?dist} Summary: Additional tools for plpgsql functions validation From 71090b66a6633719582903f1a926e4f3dc4670d7 Mon Sep 17 00:00:00 2001 From: "okbob@github.com" Date: Fri, 21 Jun 2024 08:02:55 +0200 Subject: [PATCH 3/3] fix regress tests --- expected/plpgsql_check_active_1.out | 97 +++++++++++++++-------------- expected/plpgsql_check_active_2.out | 97 +++++++++++++++-------------- 2 files changed, 98 insertions(+), 96 deletions(-) diff --git a/expected/plpgsql_check_active_1.out b/expected/plpgsql_check_active_1.out index c62b4db..74dc140 100644 --- a/expected/plpgsql_check_active_1.out +++ b/expected/plpgsql_check_active_1.out @@ -8313,6 +8313,7 @@ ERROR: returned record type does not match expected record type drop function test_function(); drop function test_function33(); drop type testtype; +set plpgsql_check.mode to default; -- should not to raise false alarm create type c1 as ( a text @@ -8694,18 +8695,18 @@ set plpgsql_check.tracer_test_mode = true; select trace_test(3); NOTICE: #0 ->> start of function trace_test(integer) (oid=0, tnl=1) NOTICE: #0 "b" => '3' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: SQL statement "SELECT nested_trace_test(r)" -NOTICE: #2 "a" => '0' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: SQL statement "SELECT nested_trace_test(r)" -NOTICE: #2 "a" => '1' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: SQL statement "SELECT nested_trace_test(r)" -NOTICE: #2 "a" => '2' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '0' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '1' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '2' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0 <<- end of function trace_test (elapsed time=0.010 ms) trace_test ------------ @@ -8720,41 +8721,41 @@ NOTICE: #0.1 3 --> start of statement block (tnl=1) NOTICE: #0.2 4 --> start of FOR with integer loop variable (tnl=1) NOTICE: #0.3 6 --> start of assignment nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '0' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: SQL statement "SELECT nested_trace_test(r)" -NOTICE: #2 "a" => '0' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '0' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '0' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '0' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '1' NOTICE: #0.3 6 --> start of assignment nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '1' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: SQL statement "SELECT nested_trace_test(r)" -NOTICE: #2 "a" => '1' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '1' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '1' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '1' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '2' NOTICE: #0.3 6 --> start of assignment nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '2' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: SQL statement "SELECT nested_trace_test(r)" -NOTICE: #2 "a" => '2' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '2' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '2' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '2' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '3' NOTICE: #0.1 <-- end of FOR with integer loop variable (elapsed time=0.010 ms) @@ -8812,15 +8813,15 @@ NOTICE: #0.1 3 --> start of statement block (tnl=1) NOTICE: #0.2 4 --> start of FOR with integer loop variable (tnl=1) NOTICE: #0.3 6 --> start of perform plpgsql_check_pragma('disable: .. (tnl=1) NOTICE: #0.2 <-- end of PERFORM (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '0' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '1' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '2' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '0' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '1' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '2' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) NOTICE: #0.1 <-- end of FOR with integer loop variable (elapsed time=0.010 ms) NOTICE: #0.5 9 --> start of RETURN (tnl=1) NOTICE: #0.5 "r" => '3' diff --git a/expected/plpgsql_check_active_2.out b/expected/plpgsql_check_active_2.out index 3407825..7ae3dcb 100644 --- a/expected/plpgsql_check_active_2.out +++ b/expected/plpgsql_check_active_2.out @@ -8314,6 +8314,7 @@ ERROR: returned record type does not match expected record type drop function test_function(); drop function test_function33(); drop type testtype; +set plpgsql_check.mode to default; -- should not to raise false alarm create type c1 as ( a text @@ -8691,18 +8692,18 @@ set plpgsql_check.tracer_test_mode = true; select trace_test(3); NOTICE: #0 ->> start of function trace_test(integer) (oid=0, tnl=1) NOTICE: #0 "b" => '3' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '0' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '1' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '2' -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '0' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '1' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '2' +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0 <<- end of function trace_test (elapsed time=0.010 ms) trace_test ------------ @@ -8717,41 +8718,41 @@ NOTICE: #0.1 3 --> start of statement block (tnl=1) NOTICE: #0.2 4 --> start of FOR with integer loop variable (tnl=1) NOTICE: #0.3 6 --> start of assignment r := nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '0' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '0' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '0' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '0' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '0' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '1' NOTICE: #0.3 6 --> start of assignment r := nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '1' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '1' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '1' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '1' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '1' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '2' NOTICE: #0.3 6 --> start of assignment r := nested_trace_test(r) (tnl=1) NOTICE: #0.3 "r" => '2' -NOTICE: #2 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) -NOTICE: #2 context: PL/pgSQL assignment "r := nested_trace_test(r)" -NOTICE: #2 "a" => '2' -NOTICE: #2.1 2 --> start of statement block (tnl=1) -NOTICE: #2.2 3 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.2 "a" => '2' -NOTICE: #2.1 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.2 <-- end of statement block (elapsed time=0.010 ms) -NOTICE: #2 <<- end of function nested_trace_test (elapsed time=0.010 ms) +NOTICE: #1 ->> start of function nested_trace_test(integer) (oid=0, tnl=1) +NOTICE: #1 context: PL/pgSQL function trace_test(integer) line 6 at assignment +NOTICE: #1 "a" => '2' +NOTICE: #1.1 2 --> start of statement block (tnl=1) +NOTICE: #1.2 3 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.2 "a" => '2' +NOTICE: #1.1 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.2 <-- end of statement block (elapsed time=0.010 ms) +NOTICE: #1 <<- end of function nested_trace_test (elapsed time=0.010 ms) NOTICE: #0.2 <-- end of assignment (elapsed time=0.010 ms) NOTICE: #0.3 "r" => '3' NOTICE: #0.1 <-- end of FOR with integer loop variable (elapsed time=0.010 ms) @@ -8809,15 +8810,15 @@ NOTICE: #0.1 3 --> start of statement block (tnl=1) NOTICE: #0.2 4 --> start of FOR with integer loop variable (tnl=1) NOTICE: #0.3 6 --> start of perform plpgsql_check_pragma('disable: .. (tnl=1) NOTICE: #0.2 <-- end of PERFORM (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '0' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '1' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) -NOTICE: #2.3 4 --> start of RETURN (expr='a + 1') (tnl=1) -NOTICE: #2.3 "a" => '2' -NOTICE: #2.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '0' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '1' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) +NOTICE: #1.3 4 --> start of RETURN (expr='a + 1') (tnl=1) +NOTICE: #1.3 "a" => '2' +NOTICE: #1.2 <-- end of RETURN (elapsed time=0.010 ms) NOTICE: #0.1 <-- end of FOR with integer loop variable (elapsed time=0.010 ms) NOTICE: #0.5 9 --> start of RETURN (tnl=1) NOTICE: #0.5 "r" => '3'