Hi

I wrote a new check in plpgsql_check, that tries to identify explicit work
with the name of the referenced portal.

create or replace function foo01()
returns refcursor as $$#option dump
declare
  c cursor for select 1;
  r refcursor;
begin
  open c;
  r := 'c';
  return r;
end;
$$ language plpgsql;
CREATE FUNCTION
(2023-01-09 16:49:10) postgres=# select * from
plpgsql_check_function('foo01', compatibility_warnings => true);
┌───────────────────────────────────────────────────────────────────────────────────┐
│                              plpgsql_check_function
        │
╞═══════════════════════════════════════════════════════════════════════════════════╡
│ compatibility:00000:7:assignment:obsolete setting of refcursor or cursor
variable │
│ Detail: Internal name of cursor should not be specified by users.
        │
│ Context: at assignment to variable "r" declared on line 4
        │
│ warning extra:00000:3:DECLARE:never read variable "c"
        │
└───────────────────────────────────────────────────────────────────────────────────┘
(4 rows)

Regards

Pavel

Reply via email to