From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-patches(at)postgreSQL(dot)org |
Subject: | WIP: replacing executor's use of Query with a PlannedStmt node type |
Date: | 2007-02-20 03:25:21 |
Message-ID: | 19121.1171941921@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Here is a preliminary patch for removing Query from the executor API.
I've created a new "top plan" node type, which I chose to call
PlannedStmt. I have not yet done anything about replacing the runtime
representation of the range table, but I'm intending to tackle that after
completing this part.
One thing that made this uglier than I was expecting is that for
statements that are prepared via the FE/BE protocol, we may choose not to
plan until the Bind message is received. That means that
PreparedStatement has to be prepared to store either Query trees or
finished Plan trees, and so I couldn't simply remove the storage of Query
trees as is possible in other contexts. To try to minimize the amount of
duplicated code, I changed some of the support routines in utility.c so
that they could work on either Query or PlannedStmt (or bare utility
statements, as they already did). It's still a bit ugly though,
particularly in prepare.c --- see for instance
FetchPreparedStatementResultDesc. Anyone see a nicer way to do it?
(This is gonna have some consequences for the plan-invalidation project
too; AFAICS we'll have to be prepared to tend to invalidation of a
parsed-and-rewritten-but-not-planned query. Or else not do any advance
parse/rewrite work, but that sort of takes the point out of a "prepared"
statement...)
Something else that emerged from this is that the SQL-level PREPARE and
EXECUTE commands are unprepared to cope with a protocol-prepared statement
that wasn't actually planned. For the moment I just made them throw
elog(ERROR), and that may be the only solution that's reasonable to
back-patch, but it seems like it'd be nice if it worked. OTOH it may be
that nobody cares, and then a quick elog is sufficient.
Comments?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
plannedstmt-1.patch.gz | application/octet-stream | 33.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-02-20 03:44:06 | Re: [PATCHES] WIP patch - INSERT-able log statements |
Previous Message | Andrew Dunstan | 2007-02-20 02:50:07 | Re: [HACKERS] \copy (query) delimiter syntax error |