Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Re-allow user_catalog_table option for materialized views.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Nov 2016 20:00:58 +0000 (15:00 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Nov 2016 20:00:58 +0000 (15:00 -0500)
The reloptions stuff allows this option to be set on a matview.
While it's questionable whether that is useful or was really intended,
it does work, and we shouldn't change that in minor releases.  Commit
e3e66d8a9 disabled the option since I didn't realize that it was
possible for it to be set on a matview.  Tweak the test to re-allow it.

Discussion: <19749.1478711862@sss.pgh.pa.us>

src/include/utils/rel.h

index 755badff0c993989d228864ee13f05316d2fd534..ebc00b0d4d4ebe3cf47b789f043435f1ee820168 100644 (file)
@@ -253,8 +253,9 @@ typedef struct StdRdOptions
  *     from the pov of logical decoding.  Note multiple eval or argument!
  */
 #define RelationIsUsedAsCatalogTable(relation) \
-   ((relation)->rd_rel->relkind == RELKIND_RELATION && \
-    (relation)->rd_options ? \
+   ((relation)->rd_options && \
+    ((relation)->rd_rel->relkind == RELKIND_RELATION || \
+     (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
     ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)