Re: hint infrastructure setup (v3)

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: hint infrastructure setup (v3)
Дата
Msg-id Pine.GSO.4.58.0404011636540.29898@elvis
обсуждение исходный текст
Ответ на Re: hint infrastructure setup (v3)  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: hint infrastructure setup (v3)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Dear Bruce,

> Why did all the tags have to be renamed:
>
>     + cmdGRANT: GRANT {noH;};

that's a good question.

In order to add hints, I want to attach them to the states of the parser
automaton. So as to do that, I need I put a name on every state, so I need
to refactor the prefix that lead to a state, at give it a name.


Otherwise, I would have :

xxx: GRANT {noH;} ALL
   | GRANT {noH;} CREATE
   ;

(1) I would have to put the "after GRANT" hint twice, one after each
    GRANT occurence.

(2) this would result in shift/reduce conflicts, as the parser does not
    know which hint should be put. Well, it is the same code in both case,
    but yacc does not look at that.

Also, I need to stop hints, otherwise the last 'pushed' hint would be
shown on any error later.


> Also, what is typical output for a hint?  Can you show one?

Well, the current status of the infrastructure is that there is no hint;-)
The only hint with the patch is if you do not put an SQL command.

It may look like :

psql> creat table foo();
ERROR: syntax error at or near "creat" at character 1
creat table foo();
^
HINT: sql command such as SELECT or CREATE... ?


All other syntax errors result in no hint being displayed, thanks to
all added noH calls I put.


Also, As far as I remember, I put a new option to activate these hints.
Hints are disactivated by default. This is because some people do not
like advices and may want to turn them on or off.


--
Fabien Coelho - coelho@cri.ensmp.fr

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: hint infrastructure setup (v3)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: hint infrastructure setup (v3)