errmsg("could not convert partitioned table \"%s\" to a view",
RelationGetRelationName(event_relation))));
+ if (event_relation->rd_rel->relispartition)
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("could not convert partition \"%s\" to a view",
+ RelationGetRelationName(event_relation))));
+
snapshot = RegisterSnapshot(GetLatestSnapshot());
scanDesc = heap_beginscan(event_relation, snapshot, 0, NULL);
if (heap_getnext(scanDesc, ForwardScanDirection) != NULL)
create rule "_RETURN" as on select to fooview do instead
select 1 as x, 'aaa'::text as y;
ERROR: could not convert partitioned table "fooview" to a view
+-- nor can one convert a partition to view
+create table fooview_part partition of fooview for values in (1);
+create rule "_RETURN" as on select to fooview_part do instead
+ select 1 as x, 'aaa'::text as y;
+ERROR: could not convert partition "fooview_part" to a view
--
-- check for planner problems with complex inherited UPDATES
--
create rule "_RETURN" as on select to fooview do instead
select 1 as x, 'aaa'::text as y;
+-- nor can one convert a partition to view
+create table fooview_part partition of fooview for values in (1);
+create rule "_RETURN" as on select to fooview_part do instead
+ select 1 as x, 'aaa'::text as y;
+
--
-- check for planner problems with complex inherited UPDATES
--