313
313
$$ language plpgsql;
314
314
call proc(10);
315
315
select * from plpgsql_check_function('proc(int)');
316
- plpgsql_check_function
317
- -------------------------------------------------
318
- warning extra:00000:parameter "a" is never read
316
+ plpgsql_check_function
317
+ ------------------------------------------
318
+ warning extra:00000:unused parameter "a"
319
319
(1 row)
320
320
321
321
create or replace procedure testproc()
@@ -360,9 +360,9 @@ $$ language plpgsql;
360
360
select * from plpgsql_check_function('proc(int,int, int)');
361
361
plpgsql_check_function
362
362
-------------------------------------------------
363
- warning extra:00000:parameter "a" is never read
364
- warning extra:00000:parameter "b" is never read
365
- warning extra:00000:parameter "c" is never read
363
+ warning extra:00000:unused parameter "a"
364
+ warning extra:00000:unused parameter "b"
365
+ warning extra:00000:unused parameter "c"
366
366
warning extra:00000:unmodified OUT variable "b"
367
367
(4 rows)
368
368
@@ -373,10 +373,9 @@ begin
373
373
end;
374
374
$$ language plpgsql;
375
375
select * from plpgsql_check_function('proc(int,int, int)');
376
- plpgsql_check_function
377
- -------------------------------------------------
378
- warning extra:00000:parameter "b" is never read
379
- (1 row)
376
+ plpgsql_check_function
377
+ ------------------------
378
+ (0 rows)
380
379
381
380
create or replace procedure testproc()
382
381
as $$
@@ -425,37 +424,35 @@ select * from plpgsql_check_function('testproc(int)');
425
424
------------------------
426
425
(0 rows)
427
426
428
- -- check assignement to recfield
429
- create table foo(a int);
430
- create or replace function test_field_assignment()
431
- returns void as $$
432
- declare v foo;
427
+ drop procedure testproc(int);
428
+ -- should to raise warnings
429
+ create or replace procedure testproc2(in p1 int, inout p2 int, in p3 int, inout p4 int)
430
+ as $$
433
431
begin
434
- v.a := 10;
435
- v.a := current_timestamp;
436
- raise notice '%', v;
432
+ raise notice '% %', p1, p3;
437
433
end;
438
434
$$ language plpgsql;
439
- select * from plpgsql_check_function('test_field_assignment ');
440
- plpgsql_check_function
441
- ----------------------------------------------------------------------------------
442
- warning:42804:5:assignment:target type is different type than source type
443
- Detail: cast "timestamp with time zone" value to "integer" type
444
- Hint: There are no possible explicit coercion between those types, possibly bug!
445
- Context: at assignment to field "a" of variable "v" declared on line 2
435
+ select * from plpgsql_check_function('testproc2 ');
436
+ plpgsql_check_function
437
+ --------------------------------------------------
438
+ warning extra:00000:unused parameter "p2"
439
+ warning extra:00000:unused parameter "p4"
440
+ warning extra:00000:unmodified OUT variable "p2"
441
+ warning extra:00000:unmodified OUT variable "p4"
446
442
(4 rows)
447
443
448
- drop table foo ;
449
- create table foo(a int, b int);
450
- create or replace function foofunc( )
451
- returns void as $$
444
+ drop procedure testproc2 ;
445
+ -- should be ok
446
+ create or replace procedure testproc3(in p1 int, inout p2 int, in p3 int, inout p4 int )
447
+ as $$
452
448
begin
453
- -- should be ok
454
- perform * from foo ;
449
+ p2 := p1;
450
+ p4 := p3 ;
455
451
end;
456
452
$$ language plpgsql;
457
- select * from plpgsql_check_function('foofunc ');
453
+ select * from plpgsql_check_function('testproc3 ');
458
454
plpgsql_check_function
459
455
------------------------
460
456
(0 rows)
461
457
458
+ drop procedure testproc3;
0 commit comments