assertion_pg.patch
application/octet-stream
Filename: assertion_pg.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/tcop/utility.c | 12 | 5 |
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 39bdb19..bdbbb63 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -1842,9 +1842,10 @@ QueryReturnsTuples(Query *parsetree)
* We assume it is invoked only on already-parse-analyzed statements
* (else the contained parsetree isn't a Query yet).
*
- * In some cases (currently, only EXPLAIN of CREATE TABLE AS/SELECT INTO),
- * potentially Query-containing utility statements can be nested. This
- * function will drill down to a non-utility Query, or return NULL if none.
+ * In some cases (currently, only EXPLAIN of CREATE TABLE AS/SELECT INTO and
+ * CREATE TEMPORARY TABLE AS/EXECUTE), potentially Query-containing utility
+ * statements can be nested. This function will drill down to a non-utility
+ * Query, or return NULL if none.
*/
Query *
UtilityContainsQuery(Node *parsetree)
@@ -1865,8 +1866,14 @@ UtilityContainsQuery(Node *parsetree)
qry = (Query *) ((CreateTableAsStmt *) parsetree)->query;
if (IsA(qry, Query))
{
- /* Recursion currently can't be necessary here */
- Assert(qry->commandType != CMD_UTILITY);
+ /*
+ * For CREATE TEMPORARY TABLE as EXECUTE commandtype will be
+ * CMD_UTILITY, so call function recursively to get the
+ * contained query.
+ */
+ if (qry->commandType == CMD_UTILITY)
+ return UtilityContainsQuery(qry->utilityStmt);
+
return qry;
}
Assert(IsA(qry, ExecuteStmt));