1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-05 23:56:58 +03:00

Avoid generating bad remote SQL for INSERT ... DEFAULT VALUES.

"INSERT INTO foo() VALUES ()" is invalid syntax, so don't do that.
This commit is contained in:
Tom Lane 2013-03-11 14:26:05 -04:00
parent 41eef0ff75
commit 8f9cc41daf

View File

@ -505,6 +505,9 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root, Index rtindex,
appendStringInfoString(buf, "INSERT INTO ");
deparseRelation(buf, rte->relid);
if (targetAttrs)
{
appendStringInfoString(buf, "(");
first = true;
@ -537,6 +540,9 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root, Index rtindex,
}
appendStringInfoString(buf, ")");
}
else
appendStringInfoString(buf, " DEFAULT VALUES");
if (returningList)
deparseReturningList(buf, root, rtindex, rel, returningList);