@@ -307,9 +307,9 @@ select f1();
307
307
(1 row)
308
308
309
309
select * from plpgsql_check_function_tb('f1()');
310
- functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
311
- ------------+--------+------------+----------+-----------------------------+--------+------+-------+----------+-------+---------
312
- f1 | 6 | assignment | 42703 | record "r" has no field "c" | | | error | | |
310
+ functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
311
+ ------------+--------+------------+----------+-----------------------------+--------+------+-------+----------+-------+---------------------------------------------------------------
312
+ f1 | 6 | assignment | 42703 | record "r" has no field "c" | | | error | | | at assignment to field "c" of variable "r" declared on line 2
313
313
(1 row)
314
314
315
315
select f1();
@@ -337,9 +337,9 @@ select f1();
337
337
(1 row)
338
338
339
339
select * from plpgsql_check_function_tb('f1()');
340
- functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
341
- ------------+--------+------------+----------+---------------------------+--------+------+-------+----------+--------------+---------
342
- f1 | 5 | assignment | 42703 | column "a" does not exist | | | error | 8 | SELECT a + b |
340
+ functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
341
+ ------------+--------+------------+----------+---------------------------+--------+------+-------+----------+--------------+--------------------------------------------------
342
+ f1 | 5 | assignment | 42703 | column "a" does not exist | | | error | 8 | SELECT a + b | at assignment to variable "r" declared on line 2
343
343
(1 row)
344
344
345
345
select f1();
@@ -365,9 +365,9 @@ select f1();
365
365
(1 row)
366
366
367
367
select * from plpgsql_check_function_tb('f1()');
368
- functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
369
- ------------+--------+------------+----------+---------------------------+--------+------+-------+----------+-------------+---------
370
- f1 | 5 | assignment | 42703 | column "c" does not exist | | | error | 8 | SELECT c+10 |
368
+ functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
369
+ ------------+--------+------------+----------+---------------------------+--------+------+-------+----------+-------------+-------------------------------------------------------------
370
+ f1 | 5 | assignment | 42703 | column "c" does not exist | | | error | 8 | SELECT c+10 | at assignment to element of variable "r" declared on line 2
371
371
(1 row)
372
372
373
373
select f1();
@@ -393,9 +393,9 @@ select f1();
393
393
(1 row)
394
394
395
395
select * from plpgsql_check_function_tb('f1()');
396
- functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
397
- ------------+--------+------------+----------+------------------------------------+--------+------+-------+----------+-------+---------
398
- f1 | 5 | assignment | 42804 | subscripted object is not an array | | | error | | |
396
+ functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
397
+ ------------+--------+------------+----------+------------------------------------+--------+------+-------+----------+-------+-------------------------------------------------------------
398
+ f1 | 5 | assignment | 42804 | subscripted object is not an array | | | error | | | at assignment to element of variable "r" declared on line 2
399
399
(1 row)
400
400
401
401
select f1();
437
437
$$ language plpgsql;
438
438
-- should to fail
439
439
select * from plpgsql_check_function_tb('f1_trg()','t1');
440
- functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
441
- ------------+--------+------------+----------+-------------------------------+--------+------+-------+----------+-------+---------
442
- f1_trg | 5 | assignment | 42703 | record "new" has no field "c" | | | error | | |
440
+ functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
441
+ ------------+--------+------------+----------+-------------------------------+--------+------+-------+----------+-------+-----------------------------------------------------------------
442
+ f1_trg | 5 | assignment | 42703 | record "new" has no field "c" | | | error | | | at assignment to field "c" of variable "new" declared on line 0
443
443
(1 row)
444
444
445
445
-- should to fail but not crash
@@ -699,10 +699,11 @@ select f1();
699
699
(1 row)
700
700
701
701
select * from plpgsql_check_function('f1()');
702
- plpgsql_check_function
703
- ------------------------------------------------------
702
+ plpgsql_check_function
703
+ ------------------------------------------------------------------------
704
704
error:42703:6:assignment:record "r" has no field "c"
705
- (1 row)
705
+ Context: at assignment to field "c" of variable "r" declared on line 2
706
+ (2 rows)
706
707
707
708
select f1();
708
709
f1
@@ -729,12 +730,13 @@ select f1();
729
730
(1 row)
730
731
731
732
select * from plpgsql_check_function('f1()');
732
- plpgsql_check_function
733
- ----------------------------------------------------
733
+ plpgsql_check_function
734
+ -----------------------------------------------------------
734
735
error:42703:5:assignment:column "a" does not exist
735
736
Query: SELECT a + b
736
737
-- ^
737
- (3 rows)
738
+ Context: at assignment to variable "r" declared on line 2
739
+ (4 rows)
738
740
739
741
select f1();
740
742
f1
@@ -759,12 +761,13 @@ select f1();
759
761
(1 row)
760
762
761
763
select * from plpgsql_check_function('f1()');
762
- plpgsql_check_function
763
- ----------------------------------------------------
764
+ plpgsql_check_function
765
+ ----------------------------------------------------------------------
764
766
error:42703:5:assignment:column "c" does not exist
765
767
Query: SELECT c+10
766
768
-- ^
767
- (3 rows)
769
+ Context: at assignment to element of variable "r" declared on line 2
770
+ (4 rows)
768
771
769
772
select f1();
770
773
f1
@@ -789,10 +792,11 @@ select f1();
789
792
(1 row)
790
793
791
794
select * from plpgsql_check_function('f1()');
792
- plpgsql_check_function
793
- -------------------------------------------------------------
795
+ plpgsql_check_function
796
+ ----------------------------------------------------------------------
794
797
error:42804:5:assignment:subscripted object is not an array
795
- (1 row)
798
+ Context: at assignment to element of variable "r" declared on line 2
799
+ (2 rows)
796
800
797
801
select f1();
798
802
f1
@@ -834,10 +838,11 @@ end;
834
838
$$ language plpgsql;
835
839
-- should to fail
836
840
select * from plpgsql_check_function('f1_trg()','t1');
837
- plpgsql_check_function
838
- --------------------------------------------------------
841
+ plpgsql_check_function
842
+ --------------------------------------------------------------------------
839
843
error:42703:5:assignment:record "new" has no field "c"
840
- (1 row)
844
+ Context: at assignment to field "c" of variable "new" declared on line 0
845
+ (2 rows)
841
846
842
847
-- should to fail but not crash
843
848
insert into t1 values(6,30);
@@ -1213,12 +1218,15 @@ select * from plpgsql_check_function('f1()', performance_warnings := true);
1213
1218
warning:42804:7:assignment:target type is different type than source type
1214
1219
Detail: cast "text" value to "integer" type
1215
1220
Hint: The input expression type does not have an assignment cast to the target type.
1221
+ Context: at assignment to variable "intval" declared on line 3
1216
1222
warning:42804:8:assignment:target type is different type than source type
1217
1223
Detail: cast "text" value to "integer" type
1218
1224
Hint: The input expression type does not have an assignment cast to the target type.
1225
+ Context: at assignment to variable "intval" declared on line 3
1219
1226
warning:42804:9:assignment:target type is different type than source type
1220
1227
Detail: cast "date" value to "integer" type
1221
1228
Hint: There are no possible explicit coercion between those types, possibly bug!
1229
+ Context: at assignment to variable "intval" declared on line 3
1222
1230
warning:42804:12:SQL statement:target type is different type than source type
1223
1231
Detail: cast "text" value to "integer" type
1224
1232
Hint: The input expression type does not have an assignment cast to the target type.
@@ -1228,7 +1236,7 @@ select * from plpgsql_check_function('f1()', performance_warnings := true);
1228
1236
warning extra:00000:3:DECLARE:never read variable "intval"
1229
1237
performance:00000:routine is marked as VOLATILE, should be STABLE
1230
1238
Hint: When you fix this issue, please, recheck other functions that uses this function.
1231
- (18 rows)
1239
+ (21 rows)
1232
1240
1233
1241
drop function f1();
1234
1242
create or replace function f1()
@@ -1806,10 +1814,10 @@ begin
1806
1814
end;
1807
1815
$$ language plpgsql;
1808
1816
select * from plpgsql_check_function_tb('fx()', performance_warnings := true);
1809
- functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
1810
- ------------+--------+--------------------+----------+-------------------------------------------------+----------------------------------------+-----------------------------------------------------------------------------------+-------------+----------+-------+---------
1817
+ functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
1818
+ ------------+--------+--------------------+----------+-------------------------------------------------+----------------------------------------+-----------------------------------------------------------------------------------+-------------+----------+-------+--------------------------------------------------
1811
1819
fx | 6 | FOREACH over array | 42804 | target type is different type than source type | cast "integer" value to "numeric" type | Hidden casting can be a performance issue. | performance | | |
1812
- fx | 8 | assignment | 42804 | target type is different type than source type | cast "numeric" value to "integer" type | Hidden casting can be a performance issue. | performance | | |
1820
+ fx | 8 | assignment | 42804 | target type is different type than source type | cast "numeric" value to "integer" type | Hidden casting can be a performance issue. | performance | | | at assignment to variable "s" declared on line 3
1813
1821
fx | | | 00000 | routine is marked as VOLATILE, should be STABLE | | When you fix this issue, please, recheck other functions that uses this function. | performance | | |
1814
1822
(3 rows)
1815
1823
@@ -1912,9 +1920,9 @@ begin
1912
1920
end;
1913
1921
$$ language plpgsql;
1914
1922
select * from plpgsql_check_function_tb('fx()', performance_warnings := true, fatal_errors := false);
1915
- functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
1916
- ------------+--------+------------+----------+----------------------------------------------------+-------------------------------------+-----------------------------------------------------------------------------------+---------------+----------+-------+---------
1917
- fx | 9 | assignment | 42804 | target type is different type than source type | cast "date" value to "integer" type | There are no possible explicit coercion between those types, possibly bug! | warning | | |
1923
+ functionid | lineno | statement | sqlstate | message | detail | hint | level | position | query | context
1924
+ ------------+--------+------------+----------+----------------------------------------------------+-------------------------------------+-----------------------------------------------------------------------------------+---------------+----------+-------+--------------------------------------------------------------
1925
+ fx | 9 | assignment | 42804 | target type is different type than source type | cast "date" value to "integer" type | There are no possible explicit coercion between those types, possibly bug! | warning | | | at assignment to element of variable "sa" declared on line 4
1918
1926
fx | 4 | DECLARE | 00000 | never read variable "sa" | | | warning extra | | |
1919
1927
fx | | | 00000 | routine is marked as VOLATILE, should be IMMUTABLE | | When you fix this issue, please, recheck other functions that uses this function. | performance | | |
1920
1928
(3 rows)
@@ -1935,11 +1943,12 @@ select * from plpgsql_check_function('fx()', performance_warnings := true);
1935
1943
plpgsql_check_function
1936
1944
-----------------------------------------------------------------------------------------
1937
1945
error:42804:7:assignment:cannot cast composite value to a scalar type
1946
+ Context: at assignment to variable "_txt" declared on line 3
1938
1947
warning extra:00000:2:DECLARE:never read variable "_tt"
1939
1948
warning extra:00000:3:DECLARE:never read variable "_txt"
1940
1949
performance:00000:routine is marked as VOLATILE, should be IMMUTABLE
1941
1950
Hint: When you fix this issue, please, recheck other functions that uses this function.
1942
- (5 rows)
1951
+ (6 rows)
1943
1952
1944
1953
drop function fx();
1945
1954
create or replace function fx()
@@ -2200,9 +2209,10 @@ select * from plpgsql_check_function('fx()', performance_warnings := true, fatal
2200
2209
warning:42804:4:assignment:target type is different type than source type
2201
2210
Detail: cast "integer" value to "date" type
2202
2211
Hint: There are no possible explicit coercion between those types, possibly bug!
2212
+ Context: at assignment to variable "d" declared on line 2
2203
2213
performance:00000:routine is marked as VOLATILE, should be STABLE
2204
2214
Hint: When you fix this issue, please, recheck other functions that uses this function.
2205
- (5 rows)
2215
+ (6 rows)
2206
2216
2207
2217
drop function fx();
2208
2218
create table tab_1(i int);
@@ -3540,6 +3550,7 @@ select * from plpgsql_check_function('test_crash', fatal_errors=>true);
3540
3550
Query: SELECT buggyfunc(10)
3541
3551
-- ^
3542
3552
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
3543
- (4 rows)
3553
+ Context: during statement block local variable "ec" initialization on line 3
3554
+ (5 rows)
3544
3555
3545
3556
drop function test_crash();
0 commit comments