Re: [HACKERS] Proposal: Local indexes for partitioned table

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: [HACKERS] Proposal: Local indexes for partitioned table
Дата
Msg-id 24ed32c9-51fa-be1c-0a85-170d88483d2b@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: [HACKERS] Proposal: Local indexes for partitioned table  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Ответы Re: [HACKERS] Proposal: Local indexes for partitioned table  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: Huge backend memory footprint
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Unique indexes & constraints on partitioned tables