Skip to content

Commit 02d88ef

Browse files
committed
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.
1 parent 95d2af1 commit 02d88ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/pl/plpgsql/src/pl_comp.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,12 +1721,13 @@ plpgsql_parse_cwordtype(List *idents)
17211721
classStruct = (Form_pg_class) GETSTRUCT(classtup);
17221722

17231723
/*
1724-
* It must be a relation, sequence, view, or type
1724+
* It must be a relation, sequence, view, composite type, or foreign table
17251725
*/
17261726
if (classStruct->relkind != RELKIND_RELATION &&
17271727
classStruct->relkind != RELKIND_SEQUENCE &&
17281728
classStruct->relkind != RELKIND_VIEW &&
1729-
classStruct->relkind != RELKIND_COMPOSITE_TYPE)
1729+
classStruct->relkind != RELKIND_COMPOSITE_TYPE &&
1730+
classStruct->relkind != RELKIND_FOREIGN_TABLE)
17301731
goto done;
17311732

17321733
/*
@@ -1942,11 +1943,12 @@ build_row_from_class(Oid classOid)
19421943
classStruct = RelationGetForm(rel);
19431944
relname = RelationGetRelationName(rel);
19441945

1945-
/* accept relation, sequence, view, or composite type entries */
1946+
/* accept relation, sequence, view, composite type, or foreign table */
19461947
if (classStruct->relkind != RELKIND_RELATION &&
19471948
classStruct->relkind != RELKIND_SEQUENCE &&
19481949
classStruct->relkind != RELKIND_VIEW &&
1949-
classStruct->relkind != RELKIND_COMPOSITE_TYPE)
1950+
classStruct->relkind != RELKIND_COMPOSITE_TYPE &&
1951+
classStruct->relkind != RELKIND_FOREIGN_TABLE)
19501952
ereport(ERROR,
19511953
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
19521954
errmsg("relation \"%s\" is not a table", relname)));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy