From: 德哥 <digoal@126.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org, "PG Bug reporting form" <noreply@postgresql.org>
Subject: Re:Re: BUG #15565: truncate bug with tables which have temp table inherited
Date: Wed, 26 Dec 2018 14:06:22 +0800 (CST)
Message-ID: <3466d6bc.57f7.167e91f000e.Coremail.digoal@126.com> (raw)
In-Reply-To: <20181226015127.GB2234@paquier.xyz>
References: <15565-ce67a48d0244436a@postgresql.org>
<0285c6d1-2d11-2f2c-6fae-d4575cdc3c7b@lab.ntt.co.jp>
<CAKJS1f_pDqUvyWeiUufRUJ2nUHvD4-rYvjHr2ZiPLsvQ6UQkUg@mail.gmail.com>
<20181225080314.GF2334@paquier.xyz>
<ab9d096e-2b9e-8588-4b61-6607cf43da62@lab.ntt.co.jp>
<20181226015127.GB2234@paquier.xyz>
Thanks,
We can use this feature emulate Oracle-style Global temp table.
https://github.com/digoal/blog/blob/master/201807/20180715_01.md
best regards,
digoal
--
公益是一辈子的事,I'm Digoal,Just Do It.
At 2018-12-26 09:51:27, "Michael Paquier" <michael@paquier.xyz> wrote:
>On Tue, Dec 25, 2018 at 05:46:28PM +0900, Amit Langote wrote:
>> On 2018/12/25 17:03, Michael Paquier wrote:
>>> Nope, it doesn't. heap_close ought to not normally release the lock
>>> either until the transaction has committed.
>>
>> Note that expand_inherited_rtentry does release the lock.
>>
>> /*
>> * It is possible that the parent table has children that are temp
>> * tables of other backends. We cannot safely access such tables
>> * (because of buffering issues), and the best thing to do seems
>> * to be to silently ignore them.
>> */
>> if (childOID != parentOID && RELATION_IS_OTHER_TEMP(newrelation))
>> {
>> heap_close(newrelation, lockmode);
>> continue;
>> }
>
>Oh, good point here. Both David and you have been touching this area
>of the code way more than myself lately.
>
>>> The patch clobbers
>>> something that truncate_check_activity() already checks, which is not
>>> elegant.
>>
>> Indeed, I missed truncate_check_activity. Although, if we want to fix
>> this behavior like I'm proposing (ignore child tables that are temporary
>> tables of other sessions), it may not be such a good idea to do it by
>> modifying truncate_check_activity to deal specially with such tables,
>> because that would unnecessarily complicate its interface.
>
>I got to think more about that point, and indeed I agree with your
>point to complicate truncate_check_activity more than necessary as it
>still gets used for CASCADE and parent relations, so what you are
>proposing is acceptable to me.
>
>>> I am wondering as well if we could take this occasion for
>>> having better isolation testing when it comes to inheritance trees
>>> mixing relation persistency. At least for the TRUNCATE case it would
>>> be nice to have something.
>>
>> Yeah, perhaps.
>
>Let's bite the bullet then. Attached is a more advanced patch which
>is based on what you previously sent, except that I don't like much
>the fact of copying AccessExclusiveLock around, so let's save it into
>a separate variable. I hope that's clearer. I have also designed a
>set of isolation tests which adds more coverage for inheritance trees
>mixing persistence across sessions which I also used to check the
>patch. This test suite could always be expanded later on, but I think
>that's already a step in the good direction.
>
>Thoughts?
>--
>Michael
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: digoal@126.com, michael@paquier.xyz, Langote_Amit_f8@lab.ntt.co.jp, david.rowley@2ndquadrant.com, noreply@postgresql.org
Subject: Re:Re: BUG #15565: truncate bug with tables which have temp table inherited
In-Reply-To: <3466d6bc.57f7.167e91f000e.Coremail.digoal@126.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox