From: | Thomas Hallgren <thhal(at)mailblocks(dot)com> |
---|---|
To: | "pgsql-patches(at)postgresql(dot)org" <pgsql-patches(at)postgresql(dot)org> |
Subject: | SPI function to investigate query semantics |
Date: | 2004-12-01 19:16:28 |
Message-ID: | 41AE188C.40508@mailblocks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Here's a patch containing the function SPI_iterate_query_roots(...). I'm
optimistic so it's complete with documentation :-)
I think that this function is needed so that PL/<lang> authors like
myself have a way to investigate the semantics of a prepared query. For
me this is essential since I want to prevent that savepoint related
statements are executed using normal SQL so that I can enforce the use
of the methods stipulated by the connection interface.
I forsee that this might be of interest for other PL/<lang> authors as
well. With this patch in place, it will be possible to do things like
this (returning false is rejecting in this case since false terminates
the iteration):
static bool rejectTransactionCommand(Query* query, void* clientData)
{
return !(query->commandType == CMD_UTILITY &&
IsA(query->utilityStmt, TransactionStmt));
}
and then use that like:
result = !SPI_iterate_query_roots(ePlan, rejectTransactionCommand,
NULL);
The patch has no side effects since it's a pure addon.
Kind regards,
Thomas Hallgren
Attachment | Content-Type | Size |
---|---|---|
spi-iqr.patch | text/plain | 4.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-12-01 20:18:59 | Re: SPI function to investigate query semantics |
Previous Message | Bruce Momjian | 2004-12-01 17:23:44 | Re: Developer's FAQ update |