| From: | Joe Conway <mail(at)joeconway(dot)com> | 
|---|---|
| To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: PG10 Partitioned tables and relation_is_updatable() | 
| Date: | 2017-06-11 15:59:46 | 
| Message-ID: | b8fea30d-39fe-2bf9-b02e-23749746592d@joeconway.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 06/11/2017 08:55 AM, Joe Conway wrote:
> On 06/11/2017 04:32 AM, Dean Rasheed wrote:
>> It looks like relation_is_updatable() didn't get the message about
>> partitioned tables. Thus, for example, information_schema.views and
>> information_schema.columns report that simple views built on top of
>> partitioned tables are non-updatable, which is wrong. Attached is a
>> patch to fix this.
> 
>> I think this kind of omission is an easy mistake to make when adding a
>> new relkind, so it might be worth having more pairs of eyes looking
>> out for more of the same. I did a quick scan of the rewriter code
>> (prompted by the recent similar omission for RLS on partitioned
>> tables) and I didn't find any more problems there, but I haven't
>> looked elsewhere yet.
> 
> Yeah, I noticed the same while working on the RLS related patch. I did
> not see anything else in rewriteHandler.c but it is probably worth
> looking wider for other omissions.
So in particular:
src/include/utils/rel.h:318:
8<----------------------------
/*
 * RelationIsUsedAsCatalogTable
 *    Returns whether the relation should be treated as a catalog table
 *    from the pov of logical decoding.  Note multiple eval of argument!
 */
#define RelationIsUsedAsCatalogTable(relation)  \
((relation)->rd_options && \
 ((relation)->rd_rel->relkind == RELKIND_RELATION || \
  (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
8<----------------------------
Does RELKIND_PARTITIONED_TABLE apply there?
Will continue to poke around...
Joe
-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chapman Flack | 2017-06-11 16:01:55 | regproc and when to schema-qualify | 
| Previous Message | Joe Conway | 2017-06-11 15:55:21 | Re: PG10 Partitioned tables and relation_is_updatable() |