@@ -1575,12 +1575,41 @@ get_rel_from_name(text *relname)
1575
1575
relrv = makeRangeVarFromNameList (textToQualifiedNameList (relname ));
1576
1576
rel = relation_openrv (relrv , AccessShareLock );
1577
1577
1578
+ #if PG_VERSION_NUM >= 150000
1578
1579
if (!RELKIND_HAS_STORAGE (rel -> rd_rel -> relkind ))
1579
1580
ereport (ERROR ,
1580
1581
(errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1581
1582
errmsg ("cannot get raw page from relation \"%s\"" ,
1582
1583
RelationGetRelationName (rel )),
1583
1584
errdetail_relkind_not_supported (rel -> rd_rel -> relkind )));
1585
+ #else
1586
+ /* Check that this relation has storage */
1587
+ if (rel -> rd_rel -> relkind == RELKIND_VIEW )
1588
+ ereport (ERROR ,
1589
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1590
+ errmsg ("cannot get raw page from view \"%s\"" ,
1591
+ RelationGetRelationName (rel ))));
1592
+ if (rel -> rd_rel -> relkind == RELKIND_COMPOSITE_TYPE )
1593
+ ereport (ERROR ,
1594
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1595
+ errmsg ("cannot get raw page from composite type \"%s\"" ,
1596
+ RelationGetRelationName (rel ))));
1597
+ if (rel -> rd_rel -> relkind == RELKIND_FOREIGN_TABLE )
1598
+ ereport (ERROR ,
1599
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1600
+ errmsg ("cannot get raw page from foreign table \"%s\"" ,
1601
+ RelationGetRelationName (rel ))));
1602
+ if (rel -> rd_rel -> relkind == RELKIND_PARTITIONED_TABLE )
1603
+ ereport (ERROR ,
1604
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1605
+ errmsg ("cannot get raw page from partitioned table \"%s\"" ,
1606
+ RelationGetRelationName (rel ))));
1607
+ if (rel -> rd_rel -> relkind == RELKIND_PARTITIONED_INDEX )
1608
+ ereport (ERROR ,
1609
+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
1610
+ errmsg ("cannot get raw page from partitioned index \"%s\"" ,
1611
+ RelationGetRelationName (rel ))));
1612
+ #endif
1584
1613
1585
1614
/*
1586
1615
* Reject attempts to read non-local temporary relations; we would be
0 commit comments