diff options
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 16 |
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. |