Re: [HACKERS] PG10 Partitioned tables and relation_is_updatable() - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: [HACKERS] PG10 Partitioned tables and relation_is_updatable()
Date
Msg-id CAEZATCUnNOKN8sLML9jUzxecALWpEXK3a3W7y0PgFR4+uhgc=g@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] PG10 Partitioned tables and relation_is_updatable()  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
On 11 June 2017 at 16:59, Joe Conway <mail@joeconway.com> wrote:
> On 06/11/2017 08:55 AM, Joe Conway wrote:
>> 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:
>
> #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?
>

Hmm, a quick experiment shows that it won't allow a partitioned table
to be used as a user catalog table, although I'm not sure if that's
intentional. If it is, it doesn't appear to be documented.

I found another RLS-related omission -- RemoveRoleFromObjectPolicy()
doesn't work for partitioned tables, so DROP OWNED BY <role> will fail
if there are any partitioned tables with RLS.

I also found another couple of omissions in PL/pgSQL --
plpgsql_parse_cwordtype() and build_row_from_class(), so for example
%rowtype doesn't work for partitioned tables.

That's it for my quick once-over the code-base, but I'm not confident
that will have caught everything.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Vladimir Borodin
Date:
Subject: Re: [HACKERS] Broken hint bits (freeze)
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Make ANALYZE more selective about what is a "most common value"?