Re: psql command aliases support - Mailing list pgsql-patches

From Bernd Helmle
Subject Re: psql command aliases support
Date
Msg-id F010E6C68F874ADBBD259210@imhotep.credativ.de
Whole thread Raw
In response to Re: psql command aliases support  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: psql command aliases support  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-patches
--On Donnerstag, April 03, 2008 03:13:47 +0100 Gregory Stark
<stark@enterprisedb.com> wrote:

> I think you're crazy to think shells are more likely to have conflicts.
> Shells require a whole token match, not just the first letter.
>
> In other words, any alias *starting with* the letters c, d, e, f, g, h, i,
> o, s, w, z would be a conflict. Just for maximum confusion the list of
> letters which cause conflicts when capitalized would be entirely
> different.
>
> Picture a newbie typoing on their \old alias and trying to figure out
> where all their data is going... Hopefully they weren't too attached to
> whatever was in their "ldd" file yesterday.

Of course, the patch doesn't work this way. Only complete tokens delivered
by the parser are substituted, illustrated here with your example:


#= \alias old SELECT version();
#= \old
                                              version
---------------------------------------------------------------------------------------------------
 PostgreSQL 8.4devel on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
4.2.3 (Debian 4.2.3-2)
(1 row)

#= \o foo
#= \old
#=
zsh: suspended  psql
% cat foo
                                              version
---------------------------------------------------------------------------------------------------
 PostgreSQL 8.4devel on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
4.2.3 (Debian 4.2.3-2)
(1 row)

--
  Thanks

                    Bernd

pgsql-patches by date:

Previous
From: "Dawid Kuroczko"
Date:
Subject: psql \G command -- send query and output using extended format
Next
From: Gregory Stark
Date:
Subject: Re: psql command aliases support