@@ -180,11 +180,13 @@ SELECT pg_partition_root('ptif_normal_table');
180
180
(1 row)
181
181
182
182
DROP TABLE ptif_normal_table;
183
- -- Various partitioning-related functions return NULL if passed relations
183
+ -- Various partitioning-related functions return empty/ NULL if passed relations
184
184
-- of types that cannot be part of a partition tree; for example, views,
185
- -- materialized views, etc.
185
+ -- materialized views, legacy inheritance children or parents, etc.
186
186
CREATE VIEW ptif_test_view AS SELECT 1;
187
187
CREATE MATERIALIZED VIEW ptif_test_matview AS SELECT 1;
188
+ CREATE TABLE ptif_li_parent ();
189
+ CREATE TABLE ptif_li_child () INHERITS (ptif_li_parent);
188
190
SELECT * FROM pg_partition_tree('ptif_test_view');
189
191
relid | parentrelid | isleaf | level
190
192
-------+-------------+--------+-------
@@ -195,6 +197,16 @@ SELECT * FROM pg_partition_tree('ptif_test_matview');
195
197
-------+-------------+--------+-------
196
198
(0 rows)
197
199
200
+ SELECT * FROM pg_partition_tree('ptif_li_parent');
201
+ relid | parentrelid | isleaf | level
202
+ -------+-------------+--------+-------
203
+ (0 rows)
204
+
205
+ SELECT * FROM pg_partition_tree('ptif_li_child');
206
+ relid | parentrelid | isleaf | level
207
+ -------+-------------+--------+-------
208
+ (0 rows)
209
+
198
210
SELECT pg_partition_root('ptif_test_view');
199
211
pg_partition_root
200
212
-------------------
@@ -207,5 +219,18 @@ SELECT pg_partition_root('ptif_test_matview');
207
219
208
220
(1 row)
209
221
222
+ SELECT pg_partition_root('ptif_li_parent');
223
+ pg_partition_root
224
+ -------------------
225
+
226
+ (1 row)
227
+
228
+ SELECT pg_partition_root('ptif_li_child');
229
+ pg_partition_root
230
+ -------------------
231
+
232
+ (1 row)
233
+
210
234
DROP VIEW ptif_test_view;
211
235
DROP MATERIALIZED VIEW ptif_test_matview;
236
+ DROP TABLE ptif_li_parent, ptif_li_child;
0 commit comments