Re: Separate psql commands from arguments

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, 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 13:48:48
Message-ID: 20080410134848.GD6610@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark escribió:

> Ah but I would use it. In particular the query I found myself writing *all*
> the time over and over again in Oracle was:
>
> select count(*),n from (select count(*) as n from <tab> group by <col>) group by n
>
> I can type it out now from finger-memory without even thinking about it. I
> would have killed for a macro facility like this where I could just do
>
> \query dist users city

If we separated the namespace with something that involved a bit less
typing, would you use it? Say

\-dist users city

(Or some other char instead of hyphen)

The point is that you don't mix it with other \ commands, and as soon as
you put \- you can already press TAB to get a list of "aliases". So it
_is_ useful both for interactive use and script use.

"\query dist" is good for scripts but bad for interactive: too much
extra typing. Whereas "\dist" is only relatively good for interactive
(no good support for tab completion), and not any better for scripting.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2008-04-10 14:04:12 Re: Commit fest queue
Previous Message Andrew Chernow 2008-04-10 13:45:46 Re: [PATCHES] libpq type system 0.9a