Is there a special reason why masking views behind table partitions is not
allowed?

Trying to do so raises an error:

CREATE RULE "_RETURN" AS ON SELECT TO xxx_20220715 DO INSTEAD SELECT * FROM
yyy WHERE ...;

ERROR:  cannot convert partitioned table "xxx_20220715" to a view

https://github.com/postgres/postgres/blob/master/src/backend/rewrite/rewriteDefine.c#L434

That said, I can trick it if I have a view on a remote server and then
attach it as a remote partition through the foreign data wrapper.

Are there any dangers that should be considered with such an approach?

I noticed that attaching the "_RETURN" rule to a table converts it to a
view, and the operation is irreversible, i.e. once attached, I cannot drop
the rule and put the relation back to a table one.

Cordially,
--
Kouber Saparev

Reply via email to