Re: psql command aliases support

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: psql command aliases support
Date: 2008-04-03 08:34:56
Message-ID: F010E6C68F874ADBBD259210@imhotep.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

--On Donnerstag, April 03, 2008 03:13:47 +0100 Gregory Stark
<stark(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2008-04-03 09:54:48 Re: psql command aliases support
Previous Message Dawid Kuroczko 2008-04-03 07:23:06 psql \G command -- send query and output using extended format