From 9567d7709f725674fccda60de8ed7fed8464e722 Mon Sep 17 00:00:00 2001 From: msepga Date: Thu, 26 Sep 2024 13:15:53 -0400 Subject: [PATCH] Deparse `COPY ... FORCE_NULL(*)` --- src/postgres_deparse.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/postgres_deparse.c b/src/postgres_deparse.c index 3ba92a97..a341f8ee 100644 --- a/src/postgres_deparse.c +++ b/src/postgres_deparse.c @@ -7546,15 +7546,29 @@ static void deparseCopyStmt(StringInfo str, CopyStmt *copy_stmt) } else if (strcmp(def_elem->defname, "force_not_null") == 0) { - appendStringInfoString(str, "FORCE_NOT_NULL ("); - deparseColumnList(str, castNode(List, def_elem->arg)); - appendStringInfoChar(str, ')'); + appendStringInfoString(str, "FORCE_NOT_NULL "); + + if (IsA(def_elem->arg, A_Star)) + deparseAStar(str, castNode(A_Star, def_elem->arg)); + else + { + appendStringInfoChar(str, '('); + deparseColumnList(str, castNode(List, def_elem->arg)); + appendStringInfoChar(str, ')'); + } } else if (strcmp(def_elem->defname, "force_null") == 0) { - appendStringInfoString(str, "FORCE_NULL ("); - deparseColumnList(str, castNode(List, def_elem->arg)); - appendStringInfoChar(str, ')'); + appendStringInfoString(str, "FORCE_NULL "); + + if (IsA(def_elem->arg, A_Star)) + deparseAStar(str, castNode(A_Star, def_elem->arg)); + else + { + appendStringInfoChar(str, '('); + deparseColumnList(str, castNode(List, def_elem->arg)); + appendStringInfoChar(str, ')'); + } } else if (strcmp(def_elem->defname, "encoding") == 0) {