Re: PG10 Partitioned tables and relation_is_updatable()

From: Joe Conway <mail(at)joeconway(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PG10 Partitioned tables and relation_is_updatable()
Date: 2017-06-12 14:40:09
Message-ID: a57bc86d-d1b7-9283-5d60-6d04d1dc49b9@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/12/2017 01:49 AM, Amit Langote wrote:
>> On Sun, Jun 11, 2017 at 5:02 PM, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> 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.
>
> Thanks for the patch, Dean.
>
>>> 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.
>
> As he mentioned in his reply, Ashutosh's proposal to abstract away the
> relkind checks is interesting in this regard.
>
> On 2017/06/12 17:29, Ashutosh Bapat wrote:
>> Changes look good to me. In order to avoid such instances in future, I
>> have proposed to bundle the conditions as macros in [1].
>
> It seems that Ashutosh forgot to include the link:
>
> https://www.postgresql.org/message-id/CAFjFpRcfzs+yst6YBCseD_orEcDNuAr9GUTraZ5GC=AvCYh55Q@mail.gmail.com

I have not looked at Ashutosh's patch yet, but it sounds like a good
idea to me.

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-06-12 15:09:06 Re: ICU support on Windows
Previous Message Tom Lane 2017-06-12 14:32:57 Re: Disallowing multiple queries per PQexec()