Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 290713e

Browse files
committed
Fix another test for RELKIND_RELATION that should allow foreign tables now.
I thought I'd gone through all of these before, but a fresh review found this one too. (Perhaps it would be better to just delete this test and let the failure occur later, but for the moment I'll preserve the logic.) The case that this was rejecting is like CREATE FOREIGN TABLE ft (f1 int ...) ...; CREATE TABLE c1 (UNIQUE(f1)) INHERITS(ft);
1 parent ad9f08f commit 290713e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/parser/parse_utilcmd.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -1799,10 +1799,12 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
17991799

18001800
Assert(IsA(inh, RangeVar));
18011801
rel = heap_openrv(inh, AccessShareLock);
1802-
if (rel->rd_rel->relkind != RELKIND_RELATION)
1802+
/* check user requested inheritance from valid relkind */
1803+
if (rel->rd_rel->relkind != RELKIND_RELATION &&
1804+
rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
18031805
ereport(ERROR,
18041806
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
1805-
errmsg("inherited relation \"%s\" is not a table",
1807+
errmsg("inherited relation \"%s\" is not a table or foreign table",
18061808
inh->relname)));
18071809
for (count = 0; count < rel->rd_att->natts; count++)
18081810
{

0 commit comments

Comments
 (0)