Skip site navigation (1) Skip section navigation (2)

Re: Partitioned tables and relfilenode

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Amit Langote <amitlangote09(at)gmail(dot)com>, Maksim Milyutin <m(dot)milyutin(at)postgrespro(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Partitioned tables and relfilenode
Date: 2017-04-12 02:15:10
Message-ID: e5c3cbd3-1551-d6f8-c9e2-51777d632fd2@lab.ntt.co.jp (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-hackers
On 2017/04/12 2:41, Robert Haas wrote:
> On Tue, Apr 11, 2017 at 9:45 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> writes:
>>> 2. DefineQueryRewrite() may try to scan a partitioned table in the case of
>>> converting a table to view, where we must make sure that the table being
>>> converted is empty.  It's checked by scanning the heap, which we should
>>> not do for a partitioned table.  Nor should we try to drop the storage
>>> once ready to make the table into a REKIND_VIEW relation (because all
>>> other checks passed okaying the conversion).
>>
>> It looks like this patch intends to allow converting a partitioned table
>> to a view.  I would lobby for refusing the command, instead.  There is
>> no good reason to allow it, and it might well be a user error.
> 
> Yeah, I agree.

Alright.  So I made it into two patches instead: 0001 fixes the bug that
validateCheckConstraint() tries to scan partitioned tables and 0002 makes
trying to convert a partitioned table to a view a user error.

Thanks,
Amit

Attachment: 0001-Fix-a-few-places-still-scanning-partitioned-tables.patch
Description: text/x-diff (2.7 KB)
Attachment: 0002-Disallow-converting-partitioned-tables-to-a-view.patch
Description: text/x-diff (1.6 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2017-04-12 02:16:38
Subject: Re: SUBSCRIPTIONS and pg_upgrade
Previous:From: Noah MischDate: 2017-04-12 02:13:02
Subject: Re: error handling in RegisterBackgroundWorker

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group