@@ -96,8 +96,9 @@ static LogicalDecodingContext *setup_decoding(Oid relid, TupleDesc tup_desc,
9696 Snapshot * snap_hist );
9797static void decoding_cleanup (LogicalDecodingContext * ctx );
9898static CatalogState * get_catalog_state (Oid relid );
99- static void get_pg_class_info (Oid relid , TransactionId * xmin ,
100- Form_pg_class * form_p , TupleDesc * desc_p );
99+ static void get_pg_class_info (Oid relid , bool is_composite_type ,
100+ TransactionId * xmin , Form_pg_class * form_p ,
101+ TupleDesc * desc_p );
101102static void get_attribute_info (Oid relid , int relnatts ,
102103 TransactionId * * xmins_p ,
103104 CatalogState * cat_state );
@@ -1119,7 +1120,7 @@ get_catalog_state(Oid relid)
11191120 * turned off and on. On the other hand it might restrict some concurrent
11201121 * DDLs that would be safe as such.
11211122 */
1122- get_pg_class_info (relid , & result -> rel .xmin , & result -> form_class ,
1123+ get_pg_class_info (relid , false, & result -> rel .xmin , & result -> form_class ,
11231124 & result -> desc_class );
11241125
11251126 result -> rel .relnatts = result -> form_class -> relnatts ;
@@ -1149,8 +1150,8 @@ get_catalog_state(Oid relid)
11491150 * pointers are passed.
11501151 */
11511152static void
1152- get_pg_class_info (Oid relid , TransactionId * xmin , Form_pg_class * form_p ,
1153- TupleDesc * desc_p )
1153+ get_pg_class_info (Oid relid , bool is_composite_type , TransactionId * xmin ,
1154+ Form_pg_class * form_p , TupleDesc * desc_p )
11541155{
11551156 HeapTuple tuple ;
11561157 Form_pg_class form_class ;
@@ -1185,7 +1186,7 @@ get_pg_class_info(Oid relid, TransactionId *xmin, Form_pg_class *form_p,
11851186
11861187 /* Invalid relfilenode indicates mapped relation. */
11871188 form_class = (Form_pg_class ) GETSTRUCT (tuple );
1188- if (form_class -> relfilenode == InvalidOid )
1189+ if (form_class -> relfilenode == InvalidOid && ! is_composite_type )
11891190 ereport (ERROR ,
11901191 (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
11911192 (errmsg ("Mapped relation cannot be squeezed" ))));
@@ -1366,8 +1367,8 @@ get_composite_type_info(TypeCatInfo *tinfo)
13661367 * as the corresponding pg_attribute tuples.
13671368 */
13681369 tinfo -> rel .relid = form_type -> typrelid ;
1369- get_pg_class_info (form_type -> typrelid , & tinfo -> rel .xmin , & form_class ,
1370- NULL );
1370+ get_pg_class_info (form_type -> typrelid , true, & tinfo -> rel .xmin ,
1371+ & form_class , NULL );
13711372 if (form_class -> relnatts > 0 )
13721373 get_attribute_info (form_type -> typrelid , form_class -> relnatts ,
13731374 & tinfo -> rel .attr_xmins , NULL );
@@ -1636,7 +1637,7 @@ check_pg_class_changes(CatalogState *cat_state)
16361637{
16371638 TransactionId xmin_current ;
16381639
1639- get_pg_class_info (cat_state -> rel .relid , & xmin_current , NULL , NULL );
1640+ get_pg_class_info (cat_state -> rel .relid , false, & xmin_current , NULL , NULL );
16401641
16411642 /*
16421643 * Check if pg_class(xmin) has changed.
0 commit comments