*** a/src/backend/parser/gram.y --- b/src/backend/parser/gram.y *************** *** 3950,3955 **** ForeignTableElementList: --- 3950,3956 ---- ForeignTableElement: columnDef { $$ = $1; } + | TableLikeClause { $$ = $1; } ; /***************************************************************************** *** a/src/backend/parser/parse_utilcmd.c --- b/src/backend/parser/parse_utilcmd.c *************** *** 652,657 **** transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla --- 652,678 ---- table_like_clause->relation->relname))); cancel_parser_errposition_callback(&pcbstate); + + /* + * For foreign tables, disallow some options. + */ + if (strcmp(cxt->stmtType, "CREATE FOREIGN TABLE")==0) + { + if (table_like_clause->options & CREATE_TABLE_LIKE_CONSTRAINTS) + { + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("\"%s\" is a foreign table. Only local tables can take LIKE CONSTRAINTS", + table_like_clause->relation->relname))); + } + else if (table_like_clause->options & CREATE_TABLE_LIKE_INDEXES) + { + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("\"%s\" is a foreign table. Only local tables can take LIKE INDEXES", + table_like_clause->relation->relname))); + } + } /* * Check for privileges