Re: Separate psql commands from arguments - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Separate psql commands from arguments
Date
Msg-id 200804101450.12853.peter_e@gmx.net
Whole thread Raw
In response to Re: Separate psql commands from arguments  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Separate psql commands from arguments  (Gregory Stark <stark@enterprisedb.com>)
Re: Separate psql commands from arguments  (Decibel! <decibel@decibel.org>)
List pgsql-hackers
Am Samstag, 5. April 2008 schrieb Gregory Stark:
> Regardless of whether we go ahead with this (and I'm not fond of it
> primarily because I want \c& to "work"), I think we would still be better
> off keeping the aliases in a separate namespace from psql commands and
> having an explicit command for calling them.

The very point of this feature is to *not* have them in a separate name space.  
Shell aliases are commonly used for defining one- or two-letter abbreviations 
for other commands.  No one would be using shell commands if they required 
you to prefix the call by "mycommand " or something like that.

If you want to have a separate namespace, you could just write a function and 
call it, which uses about as many keystrokes as your proposed \query syntax.

> I also don't see any point in allowing aliases which call other psql
> commands. psql is not a particularly nice and well defined interface and it
> would just make it that much more complex and confusing.

But other people do want to use it.  If it is too confusing for you, don't use 
it.  That's what's nice about this feature: If you don't use it, it doesn't 
affect you at all.

> I still see it much cleaner and much clearer for people reading the script

Aliases are not primarily intended for scripts but for interactive use.  No 
one wants to optimize away a few letters from a script.


pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: [PATCHES] libpq type system 0.9a
Next
From: Alvaro Herrera
Date:
Subject: Re: Commit fest queue