psql's tab completions for ALTER command

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql's tab completions for ALTER command
Date: 2002-12-11 17:59:40
Message-ID: 20021211175940.GA29886@wallace.ece.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 10, 2002 at 09:04:07PM +0100, Peter Eisentraut wrote:
> Alvaro Herrera writes:
>
> > Would it work to make \d tab-completable in a way that showed both the
> > commands that are available and the objects they describe? e.g.
> >
> > \d<tab> would show something like
> > \dt [tables] \ds [sequences] \dv [views] ...
>
> That won't work. The actual completion and the view of the alternatives
> if the completion is ambiguous is driven by the same data.
>

Speaking of psql and tab completion, I ran into a bogosity in ALTER
yesterday, in ver 7.3. I was looking to change the ownership of a table,
so I did:

ALTER TABLE foo <tab>
ADD ALTER RENAME

Hmm, so maybe it's ALTER again? (I don't rember that syntax, but ...)

ALTER TABLE doo ALTER <tab>
GROUP SCHEMA TABLE USER

huh? ALTER TABLE foo ALTER TABLE?

<checks \h ALTER and \h ALTER TABLE>

Seems ALTER TABLE foo <tab> should yield:

ADD DROP ALTER RENAME OWNER TO

And ALTER <tab> (which currently gives GROUP SCHEMA TABLE USER)
should have:

DATABASE GROUP TABLE TRIGGER USER

And ALTER TABLE foo ALTER <tab>
should list column names of foo.

Digging into the source, I see this case was there, but you couldn't
reach it because of the match on ALTER.

I've sent a patch to PATCHES to implement my proposed completions, with
the caveat that they're based on the \h ALTER output, and manual testing,
not on reading the parser in detail.

Ross

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Benoit 2002-12-11 18:33:44 Frustration with date/times/epoch in v7.3.
Previous Message Justin Clift 2002-12-11 17:50:08 Re: http://www.postgresql.org/idocs/ is down