summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael P2011-01-27 06:40:34 +0000
committerPavan Deolasee2011-05-19 17:49:34 +0000
commit8dfc3fa3d39ae4bd8a068aca3334ed3d47005cf1 (patch)
tree3a1a925e9fd8396690899e1ec787ef9bf12056b8 /src
parent71c6305686e68324bf376ebf56f0c19226804807 (diff)
Fix for bug 3147497 INSERT.. DEFAULT VALUES
This fix is linked to tables having no default values defined. When doing an INSERT.. DEFAULT VALUES, XC was returning an error at planner level when deparsing the query. create table aa(a int); INSERT INTO aa DEFAULT VALUES ; XC result: ERROR: syntax error at or near ")" pg_regress results: INSERT 0 1 In this fix, when an INSERT using DEFAULT VALUES is made, query is directly returned. Patch written by sch19831106 with some editorialization by me.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/ruleutils.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 84b1de5dd4..59c818a803 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -55,7 +55,9 @@
#include "utils/syscache.h"
#include "utils/typcache.h"
#include "utils/xml.h"
-
+#ifdef PGXC
+#include "pgxc/pgxc.h"
+#endif
/* ----------
* Pretty formatting constants
@@ -3221,6 +3223,18 @@ get_insert_query_def(Query *query, deparse_context *context)
ListCell *l;
List *strippedexprs;
+#ifdef PGXC
+ /*
+ * In the case of "INSERT ... DEFAULT VALUES" analyzed in pgxc planner,
+ * return the sql statement directly if the table has no default values.
+ */
+ if (IS_PGXC_COORDINATOR && !IsConnFromCoord() && !query->targetList)
+ {
+ appendStringInfo(buf, "%s", query->sql_statement);
+ return;
+ }
+#endif
+
/*
* If it's an INSERT ... SELECT or VALUES (...), (...), ... there will be
* a single RTE for the SELECT or VALUES.