inconsitent tab completion in psql

Started by Robert Treatabout 21 years ago3 messagesbugs
Jump to latest
#1Robert Treat
xzilla@users.sourceforge.net

Disclaimer that this was found under RC1 so it might have been fixed in final
release, though I don't recall it being reported, anyway, the problem is that
tab completion does not seem to work for "\h alter operator class".

template1=# \h ALTER
AGGREGATE DOMAIN INDEX SCHEMA TABLESPACE USER
CONVERSION FUNCTION LANGUAGE SEQUENCE TRIGGER
DATABASE GROUP OPERATOR TABLE TYPE
template1=# \h ALTER OPERATOR

template1=# \h ALTER OPERATOR CL

template1=# \h ALTER OPERATOR CLASS
Command: ALTER OPERATOR CLASS
Description: change the definition of an operator class
Syntax:
ALTER OPERATOR CLASS name USING index_method RENAME TO newname
ALTER OPERATOR CLASS name USING index_method OWNER TO newowner

template1=#

I noticed another other issues too, like CREATE CONSTRAINT TRIGGER doesnt show
up when you do \h CREATE<tab><tab> and when you do \h CREATE CON<tab><tab>
you get CREATE CONVERSION instead.

--
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

#2Bruce Momjian
bruce@momjian.us
In reply to: Robert Treat (#1)
Re: inconsitent tab completion in psql

Robert Treat wrote:

Disclaimer that this was found under RC1 so it might have been fixed in final
release, though I don't recall it being reported, anyway, the problem is that
tab completion does not seem to work for "\h alter operator class".

template1=# \h ALTER
AGGREGATE DOMAIN INDEX SCHEMA TABLESPACE USER
CONVERSION FUNCTION LANGUAGE SEQUENCE TRIGGER
DATABASE GROUP OPERATOR TABLE TYPE
template1=# \h ALTER OPERATOR

template1=# \h ALTER OPERATOR CL

template1=# \h ALTER OPERATOR CLASS
Command: ALTER OPERATOR CLASS
Description: change the definition of an operator class
Syntax:
ALTER OPERATOR CLASS name USING index_method RENAME TO newname
ALTER OPERATOR CLASS name USING index_method OWNER TO newowner

template1=#

The reason this happens is because both ALTER OPERATOR and ALTER
OPERATOR CLASS are supported so for the third word you would have to do
tab complete only when the C-L-A-S-S is unique. I suppose you could say
as soon as they type 'C' it can't match an operator name but it hardly
seems worth the complexity.

I noticed another other issues too, like CREATE CONSTRAINT TRIGGER doesnt show
up when you do \h CREATE<tab><tab> and when you do \h CREATE CON<tab><tab>
you get CREATE CONVERSION instead.

CREATE CONSTRAINT TRIGGER is not supported because it is designed to be
used only by pg_dump and is not for general use. I added a source file
comment mentioning why we don't support tab completion for it.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Bruce Momjian (#2)
Re: inconsitent tab completion in psql

On Sun, Jan 23, 2005 at 11:01:14AM -0500, Bruce Momjian wrote:

The reason this happens is because both ALTER OPERATOR and ALTER
OPERATOR CLASS are supported so for the third word you would have to do
tab complete only when the C-L-A-S-S is unique. I suppose you could say
as soon as they type 'C' it can't match an operator name but it hardly
seems worth the complexity.

Maybe you could add, to the query that extract operator names to
complete, a UNION clause with the constant CLASS. So tab completion for
ALTER OPERATOR would show both the operators and the CLASS constant.
But beware of

ALTER OPERATOR ~<tab>

you'd have to add a LIKE clause to the CLASS arm of the union to prevent
that, I think.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"Para tener m�s hay que desear menos"