From: | Jerry Sievert <jerry(at)legitimatesounding(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Altering the SELECT portion of a CREATE TABLE AS plan |
Date: | 2023-08-24 15:42:57 |
Message-ID: | EC42A100-0ADA-4051-A0EC-DDB08AD597AB@legitimatesounding.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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, where the 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 after the 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 the plan specifically for the SELECT portion of a CREATE TABLE AS query, but only in the case of the SELECT TABLE AS, and in no other SELECTs.
Alternately, I can look at the query string in the CMD_SELECT planner hook and search specifically for CREATE, TABLE and AS, but I feel that there has to be a better way, and look forward to some guidance.
Thanks!
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2023-08-24 16:19:13 | Re: pg_stat_get_backend_subxact() and backend IDs? |
Previous Message | Chapman Flack | 2023-08-24 15:38:05 | Re: PostgreSQL 16 release announcement draft |