mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Prevent table partitions from being turned into views.
A table partition must be a table, not a view, so don't allow a "_RETURN" rule to be added that would convert an existing table partition into a view. Amit Langote Discussion: https://postgr.es/m/CAEZATCVzFcAjZwC1bTFvJ09skB_sgkF4SwPKMywev-XTnimp9Q%40mail.gmail.com
This commit is contained in:
@ -428,6 +428,12 @@ DefineQueryRewrite(char *rulename,
|
||||
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)
|
||||
|
Reference in New Issue
Block a user