Cannot convert partitioned table to a view - Mailing list pgsql-general

From Kouber Saparev
Subject Cannot convert partitioned table to a view
Date
Msg-id CAN4RuQt7Yp3CX583y8KR9SbqdxaNo6BmR=RwKD1o=UypgE2bng@mail.gmail.com
Whole thread Raw
Responses Re: Cannot convert partitioned table to a view
List pgsql-general
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


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

pgsql-general by date:

Previous
From: Wen Yi
Date:
Subject: [Beginner Question]How to generate a call-graph for project?
Next
From: Tom Lane
Date:
Subject: Re: Cannot convert partitioned table to a view