Re: Declarative partitioning vs. sql_inheritance

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Erik Rijkers <er(at)xs4all(dot)nl>, Amit Langote <amitlangote09(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers-owner(at)postgresql(dot)org
Subject: Re: Declarative partitioning vs. sql_inheritance
Date: 2016-12-16 16:05:21
Message-ID: CA+TgmoYe+EG7LdYX6pkcNxr4ygkP4+A=jm9o-CPXyOvRiCNwaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 15, 2016 at 10:40 AM, Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru> wrote:
> Hi everyone,
>
> Looks like "sql_inheritance" GUC is affecting partitioned tables:
>
> explain (costs off) select * from test;
> QUERY PLAN ------------------------------
> Append
> -> Seq Scan on test
> -> Seq Scan on test_1
> -> Seq Scan on test_2
> -> Seq Scan on test_1_1
> -> Seq Scan on test_1_2
> -> Seq Scan on test_1_1_1
> -> Seq Scan on test_1_2_1
> (8 rows)
>
>
> set sql_inheritance = off;
>
>
> explain (costs off) select * from test;
> QUERY PLAN ------------------
> Seq Scan on test
> (1 row)
>
>
> I might be wrong, but IMO this should not happen. Queries involving update,
> delete etc on partitioned tables are basically broken. Moreover, there's no
> point in performing such operations on a parent table that's supposed to be
> empty at all times.

An earlier version of Amit's patches tried to handle this by forcing
sql_inheritance on for partitioned tables, but it wasn't
well-implemented and I don't see the point anyway. Sure, turning off
sql_inheritance off for partitioned tables produces stupid results.
But turning off sql_inheritance for inheritance hierarchies also
produces stupid results. If we were going to do anything about this,
my vote would be to remove sql_inheritance.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-12-16 16:07:28 Re: Declarative partitioning - another take
Previous Message Tom Lane 2016-12-16 16:00:16 Re: invalid number of sync standbys in synchronous_standby_names