Re: PG10 Partitioned tables and relation_is_updatable()

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PG10 Partitioned tables and relation_is_updatable()
Date: 2017-06-11 18:53:57
Message-ID: CAEZATCUnNOKN8sLML9jUzxecALWpEXK3a3W7y0PgFR4+uhgc=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11 June 2017 at 16:59, Joe Conway <mail(at)joeconway(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-06-11 19:19:25 Re: Make ANALYZE more selective about what is a "most common value"?
Previous Message Vladimir Borodin 2017-06-11 18:29:59 Re: Broken hint bits (freeze)