psql \e command

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

psql \e command

Volkan Yazıcı
Hi,

I have two feature proposals for psql:

1. After executing some set of commands from a file via "\e foo.sql",
   pressing C-p or Up brings executed commands, instead of
   "\e foo.sql". Shouldn't psql be bringing "\e foo.sql"?

2. It would be really neat to be able to issue

     \et  regex  - Edit table. (Create script of table will get dumped.)
     \et+ regex  - Edit table with dependents. (With create script of
                   INDEXes, triggers, etc.)
     \ef  regex  - Edit function.

   Because, I generally end up entering to a manual copy-paste cycle
   when I want to modify an existing function.

What do others think about these features? (Actually, I generally run my
psql instances within emacs, and that makes no need for any \e
combination. But that is not the case everytime I query a PostgreSQL
database server.)


Regards.

--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply | Threaded
Open this post in threaded view
|

Re: psql \e command

Klint Gore-2
Volkan YAZICI wrote:
> 2. It would be really neat to be able to issue
>
>      \et  regex  - Edit table. (Create script of table will get dumped.)
>      \et+ regex  - Edit table with dependents. (With create script of
>                    INDEXes, triggers, etc.)
>  
How do you intend to use it?

postgres=# create table bar (foo int);
CREATE TABLE
postgres=# \e
ERROR:  relation "bar" already exists
postgres=#

You'd have to comment out the create table and then write all the alter
table statements to get the changes made.

>      \ef  regex  - Edit function.
>  
Yes.  Like what pgadmin does when you hit the sql button with a function
selected.

postgres=# create or replace function foo() returns int as $$ select 1;
$$ language sql;
CREATE FUNCTION
postgres=# \e
CREATE FUNCTION
postgres=#

klint.

--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350

Ph: 02 6773 3789  
Fax: 02 6773 3266
EMail: [hidden email]


--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply | Threaded
Open this post in threaded view
|

Re: psql \e command

Volkan Yazıcı
On Wed, 04 Jun 2008, Klint Gore <[hidden email]> writes:
> postgres=# create table bar (foo int);
> CREATE TABLE
> postgres=# \e
> ERROR:  relation "bar" already exists
> postgres=#

Not exactly like that, consider placing a "\c new_copy" line to your
script file.

>>      \ef  regex  - Edit function.
>>  
> Yes. Like what pgadmin does when you hit the sql button with a
> function selected.

Despite we have both the EMS SQL Manager and PGadmin, none of these
(IMHO) give the flexibility and ease of use of psql.


Regards.

--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general