I am using the following command to describe the function in Unix.
\df+ functionName
Problem: Unable to read the description of the function.
Is there any other method to look the function with the proper indentation.
If you start psql with key -E (psql -E) and run your \df+ functionName, you will see, that it takes definition from pg_catalog.pg_proc, so you can just query it like select prosrc from pg_proc where proname = 'functionName';'
Same for \sf functionName - it's is a wrap up for pg_catalog.pg_get_functiondef.
Lastly if you do it your way, with \df+, just run \x before it and Source code will look much better.
Anyway in ALL those case indentation is saved:
b=# create function p() returns text
b-# as
b-# $$
b$# begin
b$# --tab
b$# --two spaces
b$# --three spaces
b$# return 't';
b$# end;
b$# $$ language plpgsql
b-# ;
CREATE FUNCTION
b=# \x
Expanded display is on.
b=# \df+ p
List of functions
-[ RECORD 1 ]-------+------------------
Schema | public
Name | p
Result data type | text
Argument data types |
Type | normal
Security | invoker
Volatility | volatile
Owner | postgres
Language | plpgsql
Source code | +
| begin +
| --tab +
| --two spaces +
| --three spaces+
| return 't'; +
| end; +
|
Description |
b=# \sf p
CREATE OR REPLACE FUNCTION public.p()
RETURNS text
LANGUAGE plpgsql
AS $function$
begin
--tab
--two spaces
--three spaces
return 't';
end;
$function$
\sf functionName