Re: Separate psql commands from arguments

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, "Brendan Jurd" <direvus(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bernd Helmle" <mailings(at)oopsware(dot)de>
Subject: Re: Separate psql commands from arguments
Date: 2008-04-10 12:50:12
Message-ID: 200804101450.12853.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-10 12:53:04 Re: Commit fest queue
Previous Message Andrew Chernow 2008-04-10 12:47:26 Re: [PATCHES] libpq type system 0.9a