Thread: psql slash# command
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!
Gregory Stark <stark@enterprisedb.com> writes: > 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. Actually, I suggested that to the patch author and he accepted it as a good idea: http://archives.postgresql.org/pgsql-hackers/2008-04/msg00245.php so let's see what he comes up with... regards, tom lane
On Sat, Apr 5, 2008 at 12:36 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
regards,
-- Sibte Abbas
Actually, I suggested that to the patch author and he accepted it as a
good idea:
http://archives.postgresql.org/pgsql-hackers/2008-04/msg00245.php
so let's see what he comes up with...
regards,
-- Sibte Abbas