psql: edit function, show function commands patch - Mailing list pgsql-hackers

From Pavel Stehule
Subject psql: edit function, show function commands patch
Date
Msg-id 162867791003290927y3ca44051p80e697bc6b19de29@mail.gmail.com
Whole thread Raw
Responses Re: psql: edit function, show function commands patch
List pgsql-hackers
Hello

this simple patch allow to specify cursor row when some function is
opened in editor.

\e aaa.txt
\a aaa.txt 3 ... move cursor on 3nd line of text
\ef foo
\ef foo 3 ... move cursor on 3nd line of function body
\sf foo ... show function body
\sf+ foo ... show function body - use line numbers
\sf[+] foo n ... show function body from line n

postgres=# \sf foo

CREATE OR REPLACE FUNCTION public.foo()
 RETURNS integer
 LANGUAGE plpgsql
AS $function$
begin
  return 10/0;
end;
$function$

postgres=# \sf+ foo

****  CREATE OR REPLACE FUNCTION public.foo()
****   RETURNS integer
****   LANGUAGE plpgsql
   1  AS $function$
   2  begin
   3    return 10/0;
   4  end;
****  $function$

Regards
Pavel Stehule

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: enable_joinremoval
Next
From: Robert Haas
Date:
Subject: Re: enable_joinremoval