Re: dropping partitioned tables without CASCADE

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: dropping partitioned tables without CASCADE
Date: 2017-03-06 09:19:57
Message-ID: CAFjFpRcJ6RakTCczLc5hYotPMxuahaKpeSAzDrNR-yEx73WCTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 6, 2017 at 11:12 AM, Ashutosh Bapat
<ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
> On Mon, Mar 6, 2017 at 11:05 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> On 6 March 2017 at 05:29, Ashutosh Bapat
>> <ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
>>
>>> Just to confirm, you want the output to look like this
>>>>> \d+ t1
>>>>> Table "public.t1"
>>>>> Column | Type | Collation | Nullable | Default | Storage | Stats
>>>>> target | Description
>>>>> --------+---------+-----------+----------+---------+---------+--------------+-------------
>>>>> a | integer | | not null | | plain | |
>>>>> Partition key: RANGE (a)
>>>>> Partitions: t1p1 FOR VALUES FROM (0) TO (100), HAS PARTITIONS
>>>>> t1p2 FOR VALUES FROM (100) TO (200)
>>>
>>>>
>>>> lowercase please
>>>
>>> Except for HAS PARTITIONS, everything is part of today's output. Given
>>> the current output, HAS PARTITIONS should be in upper case.
>>
>> "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.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

Attachment Content-Type Size
pg_part_desc.patch application/octet-stream 4.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vinayak 2017-03-06 09:20:04 Re: ANALYZE command progress checker
Previous Message Rushabh Lathia 2017-03-06 09:16:59 Re: Print correct startup cost for the group aggregate.