diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-11-12 18:49:09 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-11-12 18:49:09 -0500 |
commit | 02d88efea1f719e59ce684c2e14bad23d55fdd15 (patch) | |
tree | 74646fc4b609dbeba1cb889f23e6c72af4e2ade8 /src | |
parent | 95d2af1646080474ad3e1f1303e68dd5799f9cad (diff) | |
download | postgresql-02d88efea1f719e59ce684c2e14bad23d55fdd15.tar.gz postgresql-02d88efea1f719e59ce684c2e14bad23d55fdd15.zip |
In plpgsql, allow foreign tables to define row types.
This seems to have been just an oversight in previous foreign-table work.
A quick grep didn't turn up any other places where RELKIND_FOREIGN_TABLE
was obviously omitted.
One change noted by Alexander Soudakov, the other by me.
Back-patch to 9.1.
Diffstat (limited to 'src')
-rw-r--r-- | src/pl/plpgsql/src/pl_comp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index 48399d3929c..04d8b532c39 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -1721,12 +1721,13 @@ plpgsql_parse_cwordtype(List *idents) classStruct = (Form_pg_class) GETSTRUCT(classtup); /* - * It must be a relation, sequence, view, or type + * It must be a relation, sequence, view, composite type, or foreign table */ if (classStruct->relkind != RELKIND_RELATION && classStruct->relkind != RELKIND_SEQUENCE && classStruct->relkind != RELKIND_VIEW && - classStruct->relkind != RELKIND_COMPOSITE_TYPE) + classStruct->relkind != RELKIND_COMPOSITE_TYPE && + classStruct->relkind != RELKIND_FOREIGN_TABLE) goto done; /* @@ -1942,11 +1943,12 @@ build_row_from_class(Oid classOid) classStruct = RelationGetForm(rel); relname = RelationGetRelationName(rel); - /* accept relation, sequence, view, or composite type entries */ + /* accept relation, sequence, view, composite type, or foreign table */ if (classStruct->relkind != RELKIND_RELATION && classStruct->relkind != RELKIND_SEQUENCE && classStruct->relkind != RELKIND_VIEW && - classStruct->relkind != RELKIND_COMPOSITE_TYPE) + classStruct->relkind != RELKIND_COMPOSITE_TYPE && + classStruct->relkind != RELKIND_FOREIGN_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("relation \"%s\" is not a table", relname))); |