Re: [HACKERS] dropping partitioned tables without CASCADE

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: [HACKERS] dropping partitioned tables without CASCADE
Дата
Msg-id 99eb2894-684d-c8d2-8c5c-a0de634c6c7a@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: [HACKERS] dropping partitioned tables without CASCADE  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Ответы Re: [HACKERS] dropping partitioned tables without CASCADE  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Список pgsql-hackers
Hi Ashutosh,

On 2017/03/06 18:19, Ashutosh Bapat wrote:
> On Mon, Mar 6, 2017 at 11:12 AM, Ashutosh Bapat wrote:
>> On Mon, Mar 6, 2017 at 11:05 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>>> "has partitions" is not part of the DDL, whereas "FOR VALUES FROM (0)
>>> TO (100)" is. So ISTM sensible to differentiate between DDL and
>>> non-ddl using upper and lower case.
>>>
>>
>> Make sense. Will try to cook up a patch soon.
> 
> here's the patch. I have added a testcase in insert.sql to test \d+
> output for a partitioned table which has partitions which are further
> partitioned and also some partitions which are not partitioned
> themselves. I have also refactored a statement few lines above,
> replacing an if condition with ? : operator similar to code few lines
> below.

Thanks for cooking up the patch.  Looks good and works as expected.
Regression tests pass.

About the other statement you changed, I just realized that we should
perhaps do one more thing.  Show the Number of partitions, even if it's 0.
 In case of inheritance, the parent table stands on its own when there are
no child tables, but a partitioned table doesn't in the same sense.  I
tried to implement that in attached patch 0002.  Example below:

create table p (a int) partition by list (a);
\d p
<snip>
Partition key: LIST (a)
Number of partitions: 0

\d+ p
<snip>
Partition key: LIST (a)
Number of partitions: 0

create table p1 partition of p for values in (1);
\d p
<snip>
Partition key: LIST (a)
Number of partitions: 1 (Use \d+ to list them.)

\d+ p
<snip>
Partition key: LIST (a)
Partitions: p1 FOR VALUES IN (1)

0001 is your original patch.

Thanks,
Amit

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

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

Предыдущее
От: Rushabh Lathia
Дата:
Сообщение: Re: [HACKERS] CREATE/ALTER ROLE PASSWORD ('value' USING 'method')
Следующее
От: Ashutosh Bapat
Дата:
Сообщение: Re: [HACKERS] Reporting planning time with EXPLAIN