Обсуждение: Altering the SELECT portion of a CREATE TABLE AS plan

Поиск
Список
Период
Сортировка

Altering the SELECT portion of a CREATE TABLE AS plan

От
Jerry Sievert
Дата:
Hi, i am trying to mutate a plan for a T_CreateTableAsStmt before it executes.

I've created a planner_hook_type hook, where i can see the plan that gets executed as part of the AS of the query,
wherethe CmdType is CMD_SELECT, and its subplans are the plans for the actual select itself. 

I've also created a ProcessUtility_hook_type, which correctly shows the T_CreateTableAsStmt, but the hook is called
afterthe actual CREATE TABLE is called, and the plan is no longer mutable for the part that i need. 

Is there another hook i should be looking at, or another way i should be approaching this?  I need to be able to alter
theplan specifically for the SELECT portion of a CREATE TABLE AS query, but only in the case of the SELECT TABLE AS,
andin no other SELECTs. 

Alternately, I can look at the query string in the CMD_SELECT planner hook and search specifically for CREATE, TABLE
andAS, but I feel that there has to be a better way, and look forward to some guidance. 

Thanks!