psql slash# command - Mailing list pgsql-hackers

From Gregory Stark
Subject psql slash# command
Date
Msg-id 87lk3tc5e9.fsf@oxford.xeocode.com
Whole thread Raw
Responses Re: psql slash# command  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
There's a patch on the patch list to implement \# in psql.

Coincidentally this seems to be of a piece with the recent "alias"
discussions. People seem to be intent on turning psql into a full blown unix
shell including all the weird quirky rough edges of the csh family tree.

I'm big on the retro computing stuff and even *I* don't use line-number-based
history interfaces. It's been over a decade since I've done anything like
^ls^rm which is indeed (contrary to Josh's claim) part of this feature-set.

The patch is simple enough and if it was all it would take I would say let's
go ahead even if it's something only Josh would use. But it isn't anywhere
near everything you would expect to have this work cleanly. Really you would
want to be able to type \#142 and then press a key (tab works in bash) and
have it expand that into the text so you can edit it on the command line. So
would expect the code to support this to grow eventually.

I guess I'm against reflexively reimplementing features from shells in psql.
Bash is a very large program and it implements a lot of functionality which it
inherited from a very old (and bushy) family tree. Trying to reimplement
everything in psql is going to be doomed to failure.

That's the same thinking I have about using the shell as a model for
"aliases". Aliases in the shell date back to csh as well; the modern
equivalent is "functions" which have a much more consistent and predictable
syntax, but we're stuck with aliases for hysterical reasons. Better to go our
own way with a command that makes sense for psql than to try to turn psql into
a traditional command-line shell.

[1] http://archives.postgresql.org/pgsql-hackers/2006-12/msg00214.php


--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's PostGIS support!


pgsql-hackers by date:

Previous
From: Aidan Van Dyk
Date:
Subject: Re: modules
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Patch queue -> wiki