1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Support CREATE TABLE (LIKE ...) with foreign tables and views

Composite types are not yet supported, because parserOpenTable()
rejects them.
This commit is contained in:
Peter Eisentraut
2012-01-10 21:46:29 +02:00
parent 07123dff77
commit a9f2e31cf6
4 changed files with 48 additions and 2 deletions

View File

@ -644,10 +644,12 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
relation = parserOpenTable(cxt->pstate, table_like_clause->relation,
AccessShareLock);
if (relation->rd_rel->relkind != RELKIND_RELATION)
if (relation->rd_rel->relkind != RELKIND_RELATION
&& relation->rd_rel->relkind != RELKIND_VIEW
&& relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("LIKE source relation \"%s\" is not a table",
errmsg("LIKE source relation \"%s\" is not a table, view, or foreign table",
table_like_clause->relation->relname)));
/*