summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavan Deolasee2014-11-12 07:20:01 +0000
committerPavan Deolasee2015-04-15 05:46:39 +0000
commit35ab52ed4c1fa9c07080ffbe679cb12984afa91b (patch)
tree1574616b39252dd0c73e56bf6350ba3aefe0b82b /src
parentf2f2103354fe76cb023c61070cbefe0e10241a36 (diff)
Allow DMLs inside a plpgsql procedure on the coordinator.
We still block them on the datanodes, but its safe to execute them on a coordinator.
Diffstat (limited to 'src')
-rw-r--r--src/pl/plpgsql/src/pl_exec.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 0a6ae59552..acb2f4c049 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -36,6 +36,9 @@
#include "utils/rel.h"
#include "utils/snapmgr.h"
#include "utils/typcache.h"
+#ifdef XCP
+#include "pgxc/pgxc.h"
+#endif
static const char *const raise_skip_msg = "RAISE";
@@ -3049,13 +3052,20 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
q->commandType == CMD_DELETE)
stmt->mod_stmt = true;
/* PGXCTODO: Support a better parameter interface for XC with DMLs */
+#ifdef XCP
+ if (IS_PGXC_DATANODE && (q->commandType == CMD_INSERT ||
+#else
if (q->commandType == CMD_INSERT ||
+#endif
q->commandType == CMD_UPDATE ||
q->commandType == CMD_DELETE)
+#ifdef XCP
+ )
+#endif
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
#ifdef XCP
- errmsg("Postgres-XL does not support DML queries in PL/pgSQL")));
+ errmsg("Postgres-XL does not support DML queries in PL/pgSQL on Datanodes")));
#else
errmsg("Postgres-XC does not support DML queries in PL/pgSQL")));
#endif