psql: edit function, show function commands patch

Lists: pgsql-hackers
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: psql: edit function, show function commands patch
Date: 2010-03-29 16:27:15
Message-ID: 162867791003290927y3ca44051p80e697bc6b19de29@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 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 Content-Type Size
editfce.diff application/octet-stream 13.5 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: edit function, show function commands patch
Date: 2010-03-31 22:38:35
Message-ID: 201003312238.o2VMcZB14996@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I have added this to the next commit-fest.

---------------------------------------------------------------------------

Pavel Stehule wrote:
> 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, skipping... ]

>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: edit function, show function commands patch
Date: 2010-04-01 05:28:28
Message-ID: u2n162867791003312228nb47fd5f3w22888560921a72de@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/4/1 Bruce Momjian <bruce(at)momjian(dot)us>:
>
> I have added this to the next commit-fest.
>

thank you
Pavel
> ---------------------------------------------------------------------------
>
> Pavel Stehule wrote:
>> 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, skipping... ]
>
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>
> --
>  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
>  EnterpriseDB                             http://enterprisedb.com
>