psql's tab completions for ALTER command - Mailing list pgsql-hackers

From Ross J. Reedstrom
Subject psql's tab completions for ALTER command
Date
Msg-id 20021211175940.GA29886@wallace.ece.rice.edu
Whole thread Raw
Responses Frustration with date/times/epoch in v7.3.
List 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



pgsql-hackers by date:

Previous
From: Justin Clift
Date:
Subject: Re: http://www.postgresql.org/idocs/ is down
Next
From: Mike Benoit
Date:
Subject: Frustration with date/times/epoch in v7.3.