aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-11-12 18:49:15 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-11-12 18:49:15 -0500
commit37fb0170b74a0a4e1ebf19c7228330d941202841 (patch)
tree14bb7e651101ad4e31f4a189b743a66b9a184aac
parent07d5205582daa0a2b1472404f7929536d702e947 (diff)
downloadpostgresql-37fb0170b74a0a4e1ebf19c7228330d941202841.tar.gz
postgresql-37fb0170b74a0a4e1ebf19c7228330d941202841.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.
-rw-r--r--src/pl/plpgsql/src/pl_comp.c10
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 75098ec6deb..79ff6f57669 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;
/*
@@ -1947,11 +1948,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)));