Gregory Stark <[EMAIL PROTECTED]> writes: > "Tom Lane" <[EMAIL PROTECTED]> writes: >> The point of adding is_top_level is to provide a simpler, more reliable >> means for PreventTransactionChain and related functions to detect >> whether a function is trying to invoke a non-transaction-block-safe >> command.
> I'm not exactly following. How does the exec_simple_query or > exec_execute_message tell you whether you're in a transaction? Read PreventTransactionChain and friends. We can tell from state info provided by xact.c whether we're inside a BEGIN block. The problem stems from cases like SELECT myfunc() where myfunc() tries to execute one of the verboten commands, via SPI or some similar mechanism. If we allowed that, then the function could try to execute more commands within the same top-level transaction, which is exactly what we don't want to allow. If the command is being issued directly by exec_simple_query or exec_execute_message, and it's not inside a BEGIN block, then there's no way for an additional command to be issued before commit. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match