Re: [COMMITTERS] pgsql: Correct some errors and do some SGML

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [COMMITTERS] pgsql: Correct some errors and do some SGML
Дата
Msg-id 20060402091654.GA12964@surnet.cl
обсуждение исходный текст
Список pgsql-hackers
Alvaro Herrera wrote:
> Neil Conway wrote:
> > On Sun, 2006-04-02 at 00:02 -0400, Neil Conway wrote:
> > > Correct some errors and do some SGML police work on the reference pages
> > > for REASSIGN OWNED and DROP OWNED.
> > 
> > BTW, I notice that the patch adding these commands also neglected to
> > update psql's tab completion. I'm fairly busy ATM -- would anyone like
> > to take a look at fixing this?
> 
> Will do.

Ok, I just applied a simple hack by separating the generators for CREATE
and DROP.

DROP OWNED is a bit kludgy -- I added a constant "element" to the list
of completions to be returned for DROP, which is still
words_after_create.  It seems better to do it this way rather than
duplicating the entire list.  However, the current implementation for
both is a bit bogus: if you type CREATE FOO <tab> it will list the
existing FOOs, which is nonsensical -- why would you want to create a
FOO using an already existing name?  Because of this, I think CREATE
should just emit the list of possible objects to create; only DROP would
complete using the queries.

Also, DROP is wrong when you do something like

ALTER TABLE foo ALTER bar DROP <tab>

If you stop before that last DROP is complete, it shows "DROP DEFAULT"
and "DROP NOT NULL", but as soon as the DROP is complete it shows
instead the list of things to drop:

alvherre=# alter TABLE foo ALTER a D
DROP DEFAULT   DROP NOT NULL  
alvherre=# alter TABLE foo ALTER a DROP 
AGGREGATE   DOMAIN      LANGUAGE    RULE        TABLESPACE  UNIQUE
CAST        FUNCTION    OPERATOR    SCHEMA      TEMP        USER
CONVERSION  GROUP       OWNED       SEQUENCE    TRIGGER     VIEW
DATABASE    INDEX       ROLE        TABLE       TYPE


I tried to "fix" it by having the completion for DROP only work when
it's the first word of the buffer, by checking that prev2_wd is NULL.
This doesn't work however, because at this point

alvherre=# DROP<tab>

prev_wd, prev2_wd, prev3_wd and prev4_wd are all "DROP"!  This disagrees
with what the comment for previous_word says; this should probably be
fixed, but I wouldn't want to do it this late.

I wonder how far we are from needing a true parser here, if we want to
improve much more.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: Slony-I for circular replication
Следующее
От: "Qingqing Zhou"
Дата:
Сообщение: Re: Problem compiling with mingw