From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers-owner(at)postgresql(dot)org, Kevin Grittner <kgrittn(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
Subject: | Re: Declarative partitioning - another take |
Date: | 2017-05-01 04:51:43 |
Message-ID: | 5d17ab8d-7ceb-40bb-d688-215a3bc58b93@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2017/04/29 6:56, David Fetter wrote:
> On Fri, Apr 28, 2017 at 06:29:48PM +0900, Amit Langote wrote:
>> On 2017/04/28 7:36, David Fetter wrote:
>>> Did I notice correctly that there's no way to handle transition tables
>>> for partitions in AFTER STATEMENT triggers?
>>
>> Did you mean to ask about AFTER STATEMENT triggers defined on
>> "partitioned" tables? Specifying transition table for them is disallowed
>> at all.
>>
>> ERROR: "p" is a partitioned table
>> DETAIL: Triggers on partitioned tables cannot have transition tables.
>
> OK, I suppose. It wasn't clear from the documentation.
>
>> Triggers created on (leaf) partitions *do* allow specifying transition table.
>
> That includes the upcoming "default" tables, I presume.
If a "default" table is also a "leaf" table, then yes. A default
table/partition can also be itself a partitioned table, in which case, it
won't allow triggers that require transition tables. AFAICS, it's the
table's being partitioned that stops it from supporting transition tables,
not whether it is a "default" partition or not.
>> Or are you asking something else altogether?
>
> I was just fuzzy on the interactions among these features.
>
>>> If not, I'm not suggesting that this be added at this late date, but
>>> we might want to document that.
>>
>> I don't see mentioned in the documentation that such triggers cannot be
>> defined on partitioned tables. Is that what you are saying should be
>> documented?
>
> Yes, but I bias toward documenting a lot, and this restriction could
> go away in some future version, which would make things more confusing
> in the long run.
Yeah, it would be a good idea to document this.
> I'm picturing a conversation in 2020 that goes
> something like this:
>
> "On 10, you could have AFTER STATEMENT triggers on tables, foreigh
> tables, and leaf partition tables which referenced transition tables,
> but not on DEFAULT partitions. On 11, you could on DEFAULT partition
> tables. From 12 onward, you can have transition tables on any
> relation."
What we could document now is that partitioned tables don't allow
specifying triggers that reference transition tables. Although, I am
wondering where this note really belongs - the partitioning chapter, the
triggers chapter or the CREATE TRIGGER reference page? Maybe, Kevin and
Thomas have something to say about that. If it turns out that the
partitioning chapter is a good place, here is a documentation patch.
Thanks,
Amit
Attachment | Content-Type | Size |
---|---|---|
0001-Document-transition-table-trigger-limitation-of-part.patch | text/x-diff | 927 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-05-01 04:53:49 | Re: OK, so culicidae is *still* broken |
Previous Message | Amit Kapila | 2017-05-01 04:48:47 | Re: OK, so culicidae is *still* broken |