From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Jesper Pedersen <jesper.pedersen@redhat.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Maksim Milyutin <milyutinma@gmail.com>
Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table
Date: Thu, 28 Dec 2017 18:53:04 -0300
Message-ID: <20171228215304.twephgpycnt7s5gz@alvherre.pgsql> (raw)
In-Reply-To: <24ed32c9-51fa-be1c-0a85-170d88483d2b@lab.ntt.co.jp>
Amit Langote wrote:
> 2. Something strange about how dependencies are managed:
>
> create table p (a char) partition by list (a);
> create table pa partition of p for values in ('a');;
> create table pb partition of p for values in ('b');
> create index on p (a);
> drop table pa;
> ERROR: cannot drop table pa because other objects depend on it
> DETAIL: index p_a_idx depends on table pa
> HINT: Use DROP ... CASCADE to drop the dependent objects too.
Hmm, this is quite nasty and I'm not seeing any reasonable way to fix
it. The problem is that we have an internal dep from the parent index
to the partition index, which prompts us to recurse the chase of
dependencies inverting the way the dependencies flow -- the "case 3" in
findDependentObjects:
/*
* 3. Not all the owning objects have been visited, so
* transform this deletion request into a delete of this
* owning object.
The problem is that we don't want the partition index to go away unless
it's together with its parent index, except if the table which contains
it goes away first. We have no way to specify this condition ... Maybe
something like sticking a phony additional record in pg_depend that
causes the partition index to get added to the targetObjects list ahead
of time ... but that doesn't work either, because we still want to chase
the internal deps in that case. Hm.
Maybe we need a new "auto internal" deptype with a mix of semantics of
the other two deptypes. It seems a bit ugly and I'm not sure it'd work
either ... I'll try to code it tomorrow.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, Langote_Amit_f8@lab.ntt.co.jp, jesper.pedersen@redhat.com, robertmhaas@gmail.com, david.rowley@2ndquadrant.com, simon@2ndquadrant.com, milyutinma@gmail.com
Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table
In-Reply-To: <20171228215304.twephgpycnt7s5gz@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox