if (IS_PGXC_DATANODE || !IsConnFromCoord())
{
char *nodestring;
+
+ /*
+ * Before we prepare remote nodes, check if we have accessed any temp
+ * tables and bail out. We do this extra check here to avoid any
+ * in-doubt prepared transactions on remote node. See below to know
+ * more about why prepare transactions are blocked.
+ */
+ if ((MyXactFlags & XACT_FLAGS_ACCESSEDTEMPREL))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot PREPARE a transaction that has operated on temporary tables")));
+
if (saveNodeString)
{
pfree(saveNodeString);
ctas->if_not_exists = true;
/* cram additional flags into the IntoClause */
$7->rel->relpersistence = $2;
+#ifdef PGXC
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("CREATE TABLE IF NOT EXISTS AS EXECUTE not yet supported")));
+#endif
$7->skipData = !($12);
$$ = (Node *) ctas;
}
case T_AlterRoleSetStmt:
case T_DropRoleStmt:
case T_ReassignOwnedStmt:
- case T_LockStmt:
case T_AlterOwnerStmt:
case T_AlterDomainStmt:
case T_DefineStmt:
exec_type = EXEC_ON_ALL_NODES;
break;
+ case T_LockStmt:
+ if (IS_PGXC_LOCAL_COORDINATOR)
+ {
+ ListCell *cell;
+ LockStmt *stmt = (LockStmt *) parsetree;
+ bool found_temp = false;
+ bool found_regular = false;
+
+ foreach(cell, stmt->relations)
+ {
+ Oid relid;
+ RangeVar *rel = (RangeVar *) lfirst(cell);
+
+ relid = RangeVarGetRelid(rel, NoLock, false);
+ if (IsTempTable(relid))
+ is_temp = found_temp = true;
+ else
+ found_regular = true;
+ }
+
+ if (found_regular && found_temp)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("Cannot LOCK temp and non-temp tables "
+ "in a single statement")));
+ if (is_temp)
+ exec_type = EXEC_ON_DATANODES;
+ else
+ exec_type = EXEC_ON_ALL_NODES;
+ }
+ break;
+
case T_TruncateStmt:
/*
* Check details of the object being truncated.