Re: Partitioning with temp tables is broken

2018-06-19 Thread Gavin Flower
On 20/06/18 16:47, Michael Paquier wrote: On Wed, Jun 20, 2018 at 01:32:58PM +0900, Amit Langote wrote: Just a minor nit in the last sentence: "have to be from" -> "must be from / must belong to" I think that both have the same meaning, but I am no native speaker so I may be missing a nuance

Re: Partitioning with temp tables is broken

2018-06-19 Thread Michael Paquier
On Wed, Jun 20, 2018 at 01:32:58PM +0900, Amit Langote wrote: > Just a minor nit in the last sentence: > > "have to be from" -> "must be from / must belong to" I think that both have the same meaning, but I am no native speaker so I may be missing a nuance of some kind. -- Michael

Re: Partitioning with temp tables is broken

2018-06-19 Thread Amit Langote
On 2018/06/20 10:54, Michael Paquier wrote: > On Tue, Jun 19, 2018 at 04:26:56PM +0530, Ashutosh Bapat wrote: >> On Tue, Jun 19, 2018 at 4:22 PM, Michael Paquier wrote: >>> I was under the impression that this was implied in the precious >>> phrasing but you guys visibly don't match with my

Re: Partitioning with temp tables is broken

2018-06-19 Thread Michael Paquier
On Tue, Jun 19, 2018 at 04:26:56PM +0530, Ashutosh Bapat wrote: > On Tue, Jun 19, 2018 at 4:22 PM, Michael Paquier wrote: >> I was under the impression that this was implied in the precious >> phrasing but you guys visibly don't match with my impression. So I >> would suggest this paragraph at

Re: Partitioning with temp tables is broken

2018-06-19 Thread Ashutosh Bapat
On Tue, Jun 19, 2018 at 1:24 PM, Michael Paquier wrote: > On Tue, Jun 19, 2018 at 04:27:08PM +0900, Amit Langote wrote: >> Looking at what changed from my patch: >> >> -One cannot have both temporary and permanent relations in a given >> -partition tree. That is, if the root partitioned

Re: Partitioning with temp tables is broken

2018-06-19 Thread Michael Paquier
On Tue, Jun 19, 2018 at 04:27:08PM +0900, Amit Langote wrote: > Looking at what changed from my patch: > > -One cannot have both temporary and permanent relations in a given > -partition tree. That is, if the root partitioned table is permanent, > -so must be its partitions at all

Re: Partitioning with temp tables is broken

2018-06-18 Thread Michael Paquier
On Tue, Jun 19, 2018 at 10:56:49AM +0900, Amit Langote wrote: > On 2018/06/18 15:02, Michael Paquier wrote: >> Those tests should be upper-case I think to keep consistency with the >> surrounding code. > > As you may have seen in the changed code, the guard in MergeAttributes > really just checks

Re: Partitioning with temp tables is broken

2018-06-18 Thread Amit Langote
Hello. On 2018/06/18 15:02, Michael Paquier wrote: > On Mon, Jun 18, 2018 at 01:27:51PM +0900, Amit Langote wrote: >> On 2018/06/17 22:11, Michael Paquier wrote: >> Which checks do you think are missing other than those added by the >> proposed patch? > > I was just wondering how this reacted if

Re: Partitioning with temp tables is broken

2018-06-18 Thread Michael Paquier
On Mon, Jun 18, 2018 at 01:27:51PM +0900, Amit Langote wrote: > On 2018/06/17 22:11, Michael Paquier wrote: > Which checks do you think are missing other than those added by the > proposed patch? I was just wondering how this reacted if trying to attach a foreign table to a partition tree which

Re: Partitioning with temp tables is broken

2018-06-17 Thread Amit Langote
Hi. On 2018/06/17 22:11, Michael Paquier wrote: > On Thu, Jun 14, 2018 at 10:38:14PM -0400, Tom Lane wrote: >> David Rowley writes: >>> On 15 June 2018 at 02:42, Tom Lane wrote: I think that if possible, we should still allow a partitioned table in which all the rels are temp tables

Re: Partitioning with temp tables is broken

2018-06-17 Thread Michael Paquier
On Thu, Jun 14, 2018 at 10:38:14PM -0400, Tom Lane wrote: > David Rowley writes: >> On 15 June 2018 at 02:42, Tom Lane wrote: >>> I think that if possible, we should still allow a partitioned table >>> in which all the rels are temp tables of the current session. What we >>> have to disallow is

Re: Partitioning with temp tables is broken

2018-06-14 Thread Tom Lane
David Rowley writes: > On 15 June 2018 at 02:42, Tom Lane wrote: >> I think that if possible, we should still allow a partitioned table >> in which all the rels are temp tables of the current session. What we >> have to disallow is (a) temp/permanent mixes and (b) temp tables from >> different

Re: Partitioning with temp tables is broken

2018-06-14 Thread David Rowley
On 15 June 2018 at 02:42, Tom Lane wrote: > I think that if possible, we should still allow a partitioned table > in which all the rels are temp tables of the current session. What we > have to disallow is (a) temp/permanent mixes and (b) temp tables from > different sessions. So, this used to

Re: Partitioning with temp tables is broken

2018-06-14 Thread Amit Langote
On 2018/06/14 22:11, Ashutosh Bapat wrote: > On Thu, Jun 14, 2018 at 9:42 AM, Amit Langote >> I'm attaching a patch here to forbid adding a temporary table as partition >> of permanent table. I didn't however touch the feature that allows *all* >> members in a partition tree to be temporary

Re: Partitioning with temp tables is broken

2018-06-14 Thread Amit Langote
On 2018/06/14 23:42, Tom Lane wrote: > Ashutosh Bapat writes: >> If I am reading Tom's reply upthread correctly, we should not allow >> creating a temporary partitioned table as well as temporary partitions >> altogether. > > I think that if possible, we should still allow a partitioned table >

Re: Partitioning with temp tables is broken

2018-06-14 Thread Tom Lane
Ashutosh Bapat writes: > If I am reading Tom's reply upthread correctly, we should not allow > creating a temporary partitioned table as well as temporary partitions > altogether. I think that if possible, we should still allow a partitioned table in which all the rels are temp tables of the

Re: Partitioning with temp tables is broken

2018-06-14 Thread Ashutosh Bapat
On Thu, Jun 14, 2018 at 9:42 AM, Amit Langote wrote: > On 2018/06/14 11:09, Michael Paquier wrote: >> On Wed, Jun 13, 2018 at 10:25:23PM +0530, amul sul wrote: >>> On Wed, Jun 13, 2018, 8:34 PM Tom Lane wrote: Even if you want to argue that there's a use case for these situations, it

Re: Partitioning with temp tables is broken

2018-06-13 Thread Amit Langote
On 2018/06/13 21:06, David Rowley wrote: > There's also something pretty weird around the removal of the temp > relation from the partition bound. I've had cases where the session > that attached the temp table is long gone, but \d+ shows the table is > still there and I can't attach another

Re: Partitioning with temp tables is broken

2018-06-13 Thread Amit Langote
On 2018/06/14 11:09, Michael Paquier wrote: > On Wed, Jun 13, 2018 at 10:25:23PM +0530, amul sul wrote: >> On Wed, Jun 13, 2018, 8:34 PM Tom Lane wrote: >>> Even if you want to argue that there's a use case for these situations, >>> it seems far too late in the release cycle to be trying to fix

Re: Partitioning with temp tables is broken

2018-06-13 Thread Michael Paquier
On Wed, Jun 13, 2018 at 10:25:23PM +0530, amul sul wrote: > On Wed, Jun 13, 2018, 8:34 PM Tom Lane wrote: >> Even if you want to argue that there's a use case for these situations, >> it seems far too late in the release cycle to be trying to fix all these >> issues. I think we need to forbid

Re: Partitioning with temp tables is broken

2018-06-13 Thread amul sul
On Wed, Jun 13, 2018, 8:34 PM Tom Lane wrote: > Ashutosh Bapat writes: > > [ lots o' problems with $subject ] > > > But a larger question is what use such temporary partitions are? > > Should we just prohibit adding temporary partitions to a permanant > > partitioned table? We should allow

Re: Partitioning with temp tables is broken

2018-06-13 Thread Tom Lane
Ashutosh Bapat writes: > [ lots o' problems with $subject ] > But a larger question is what use such temporary partitions are? > Should we just prohibit adding temporary partitions to a permanant > partitioned table? We should allow adding temporary partitions to a > temporary partitioned table

Re: Partitioning with temp tables is broken

2018-06-13 Thread Ashutosh Bapat
On Wed, Jun 13, 2018 at 5:36 PM, David Rowley wrote: > Hi, > > It seems temp tables with partitioned tables is not working correctly. > 9140cf8269b0c has not considered that in build_simple_rel() an > AppendRelInfo could be missing due to it having been skipped in > expand_partitioned_rtentry() >