Re: [HACKERS] Proposal: Local indexes for partitioned table
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Jesper Pedersen <jesper.pedersen@redhat.com>
Cc: Robert Haas <robertmhaas@gmail.com>,
David Rowley <david.rowley@2ndquadrant.com>,
Simon Riggs <simon@2ndquadrant.com>,
Pg Hackers <pgsql-hackers@postgresql.org>,
Maksim Milyutin <milyutinma@gmail.com>
Date: 2017-12-25T08:30:39Z
Lists: pgsql-hackers
On 2017/12/25 13:52, Amit Langote wrote:
> Hi Alvaro,
>
> On 2017/12/23 0:10, Alvaro Herrera wrote:
>> I believe these are all fixed by the attached delta patch.
>
> @@ -1676,7 +1694,12 @@ psql_completion(const char *text, int start, int end)
> "UNION SELECT 'ALL IN TABLESPACE'");
> /* ALTER INDEX <name> */
> else if (Matches3("ALTER", "INDEX", MatchAny))
> - COMPLETE_WITH_LIST5("ALTER COLUMN", "OWNER TO", "RENAME TO",
> "SET", "RESET");
> + COMPLETE_WITH_LIST7("ALTER COLUMN", "OWNER TO", "RENAME TO", "SET",
> + "RESET", "ATTACH PARTITION");
>
> This should be COMPLETE_WITH_LIST6().
I noticed a few things I thought I'd report. I was using the latest patch
(v8 + the delta patch).
1. The following crashes because of an Assert in ATExecCmd():
ALTER TABLE an_index DETACH PARTITION ...
It seems ATPrepCmd() should not pass ATT_INDEX to ATSimplePermissions()
for the ATDetachPartition sub-command type.
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);
\d pa
Table "public.pa"
Column | Type | Collation | Nullable | Default
|-------+--------------+-----------+----------+---------
a | character(1) | | |
Partition of: p FOR VALUES IN ('a')
Indexes:
"pa_a_idx" btree (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.
set client_min_messages to debug2;
drop table pa;
DEBUG: drop auto-cascades to index pa_a_idx
DEBUG: drop auto-cascades to index pb_a_idx
DEBUG: drop auto-cascades to type pa
DEBUG: drop auto-cascades to type 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.
Thanks,
Amit
Commits
-
Local partitioned indexes
- 8b08f7d4820f 11.0 landed
-
Fix StoreCatalogInheritance1 to use 32bit inhseqno
- 1ef61ddce908 11.0 landed
- 9a215fb4b5ec 9.3.21 landed
- 8a71ee628854 9.6.7 landed
- 61f08c016322 10.2 landed
- 1284d18b5de9 9.4.16 landed
- 0d993709a773 9.5.11 landed
-
Get rid of copy_partition_key
- 8a0596cb656e 11.0 landed
-
Simplify index_[constraint_]create API
- a61f5ab98638 11.0 landed