trivial patch: foreign table either defines row type

Started by Alexander Soudakovabout 14 years ago2 messages
#1Alexander Soudakov
cygakob@gmail.com
1 attachment(s)

Hello Hackers.

I attached trivial patch.

Foreign table either defines row type. I simply added this type to
hardcoded check.
I faced this limitation while developing www fdw feature
(http://wiki.postgresql.org/wiki/WWW_FDW).

--
Alexander Soudakov
Software Developer
email: cygakoB@gmail.com
skype: asudakov

Attachments:

foreign-table-as-argument-to-plpgsql.patchtext/x-patch; charset=US-ASCII; name=foreign-table-as-argument-to-plpgsql.patchDownload
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 578cae5..f579d98 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -1940,11 +1940,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 entries */
 	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)));
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alexander Soudakov (#1)
Re: trivial patch: foreign table either defines row type

Alexander Soudakov <cygakob@gmail.com> writes:

Foreign table either defines row type. I simply added this type to
hardcoded check.

Yeah, I think this was just an oversight. (You missed a spot in
plpgsql_parse_cwordtype, though.) Patch applied.

regards, tom lane