Re: Get the name of the target Relation from Query struct?

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Get the name of the target Relation from Query struct?
Дата
Msg-id CAKJS1f8pacTSymTMvT__J_23+KBOfJ_i0=8s+Kb9QMVDfZ0P=g@mail.gmail.com
обсуждение исходный текст
Ответ на AW: Get the name of the target Relation from Query struct?  (Ernst-Georg Schmid <ernst-georg.schmid@bayer.com>)
Ответы AW: Get the name of the target Relation from Query struct?  (Ernst-Georg Schmid <ernst-georg.schmid@bayer.com>)
AW: Get the name of the target Relation from Query struct?  (Ernst-Georg Schmid <ernst-georg.schmid@bayer.com>)
Список pgsql-hackers
On 6 April 2018 at 20:38, Ernst-Georg Schmid
<ernst-georg.schmid@bayer.com> wrote:
> I can get the resultRelation and it is 1 (which matches the Documentation that says that it would be 0 for a SELECT
butI exclude SELECTs as you suggested).
 

I didn't quite say exclude SELECT :)

I wrote:
> You'll probably also want to check the query->commandType to ensure
> the command is one that will actually have a valid resultRelation.

>     if(parse->commandType != CMD_SELECT) {

Does it perhaps crash on a utility command?

Have a look at parsenodes.h and find the comments for resultRelation,
then find the commandType field and look for the definition of
CmdType. You'll see you need to think a bit harder about which
commandTypes you allow.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: amul sul
Дата:
Сообщение: Re: [HACKERS] Restrict concurrent update/delete with UPDATE ofpartition key
Следующее
От: Ernst-Georg Schmid
Дата:
Сообщение: AW: Get the name of the target Relation from Query struct?