aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_utilcmd.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2012-01-10 21:46:29 +0200
committerPeter Eisentraut <peter_e@gmx.net>2012-01-10 21:46:29 +0200
commita9f2e31cf653bad72debae616521130065e55077 (patch)
tree3bd085c73b3d971981871c3295a114ae98b7b7d1 /src/backend/parser/parse_utilcmd.c
parent07123dff778389382f08d2152742bb061d351c21 (diff)
downloadpostgresql-a9f2e31cf653bad72debae616521130065e55077.tar.gz
postgresql-a9f2e31cf653bad72debae616521130065e55077.zip
Support CREATE TABLE (LIKE ...) with foreign tables and views
Composite types are not yet supported, because parserOpenTable() rejects them.
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r--src/backend/parser/parse_utilcmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index e14ae09e6f9..335bdc6b075 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -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)));
/*