diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index e9e8ef3b44..e4dc508682 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -156,6 +156,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString) Oid existing_relid; ParseCallbackState pcbstate; bool like_found = false; + bool is_foreign_table = IsA(stmt, CreateForeignTableStmt); /* * We must not scribble on the passed-in CreateStmt, so copy it. (This is @@ -312,7 +313,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString) /* * Postprocess check constraints. */ - transformCheckConstraints(&cxt, true); + transformCheckConstraints(&cxt, !is_foreign_table ? true : false); /* * Output results. @@ -1935,9 +1936,9 @@ transformCheckConstraints(CreateStmtContext *cxt, bool skipValidation) return; /* - * If creating a new table, we can safely skip validation of check - * constraints, and nonetheless mark them valid. (This will override any - * user-supplied NOT VALID flag.) + * If creating a new table (but not a foreign table), we can safely skip + * validation of check constraints, and nonetheless mark them valid. + * (This will override any user-supplied NOT VALID flag.) */ if (skipValidation) {