@@ -1575,12 +1575,41 @@ get_rel_from_name(text *relname)
15751575 relrv = makeRangeVarFromNameList (textToQualifiedNameList (relname ));
15761576 rel = relation_openrv (relrv , AccessShareLock );
15771577
1578+ #if PG_VERSION_NUM >= 150000
15781579 if (!RELKIND_HAS_STORAGE (rel -> rd_rel -> relkind ))
15791580 ereport (ERROR ,
15801581 (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
15811582 errmsg ("cannot get raw page from relation \"%s\"" ,
15821583 RelationGetRelationName (rel )),
15831584 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
15841613
15851614 /*
15861615 * Reject attempts to read non-local temporary relations; we would be
0 commit comments