Search code examples
postgresqlstored-proceduresstored-functions

Run sql procedure and print logs


I have a sql procedure with me:

create or replace function db.func(value varchar) returns text as $$
        select distinct key, 
        from db.func 
$$ language SQL STABLE PARALLEL SAFE;

I want to execute it, i have tried:

EXEC db.func 'value';
db.func('value');
EXEC db.func @value='value';

How can i print the logs inside the procedure or is there any tool that can convert sql procedure to plain sql queries?


Solution

  • To run the procedure from shell, run:

    SELECT db.func(value)