Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-28 Thread Rushabh Lathia
Thanks Tom. I performed testing with the latest commit and test are running fine. On Tue, Jun 28, 2016 at 8:14 PM, Tom Lane wrote: > Rushabh Lathia writes: > > SELECT setval('s', max(100)) from tab; > > ERROR: ORDER/GROUP BY expression not found

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-28 Thread Tom Lane
Rushabh Lathia writes: > SELECT setval('s', max(100)) from tab; > ERROR: ORDER/GROUP BY expression not found in targetlist Fixed, thanks for the report! regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-28 Thread Amit Langote
On Tue, Jun 28, 2016 at 2:52 PM, Rushabh Lathia wrote: > Hi, > > Consider the below testcase: > > CREATE TABLE tab( > c1 INT NOT NULL, > c2 INT NOT NULL > ); > INSERT INTO tab VALUES (1, 2); > INSERT INTO tab VALUES (2, 1); > INSERT INTO tab VALUES (1, 2); > > > case

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-26 Thread Noah Misch
On Mon, Jun 13, 2016 at 05:27:13PM -0400, Robert Haas wrote: > One problem that I've realized that is related to this is that the way > that the consider_parallel flag is being set for upper rels is almost > totally bogus, which I believe accounts for your complaint at PGCon > that

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-26 Thread Noah Misch
On Mon, Jun 13, 2016 at 04:46:19PM -0400, Tom Lane wrote: > Robert Haas writes: > > In practice, we don't yet have the ability for > > parallel-safe paths from subqueries to affect planning at higher query > > levels, but that's because the pathification stuff landed too

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-26 Thread Noah Misch
On Mon, Jun 13, 2016 at 03:42:49PM -0400, Tom Lane wrote: > I wrote: > > ... there was also an unexplainable plan change: > > > *** /home/postgres/pgsql/src/test/regress/expected/aggregates.out Thu Apr > > 7 21:13:14 2016 > > --- /home/postgres/pgsql/src/test/regress/results/aggregates.out

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-20 Thread Tatsuro Yamada
Hi, I ran tpc-h's queries on this version and it's successful. The error is fixed. commit 705ad7f3b523acae0ddfdebd270b7048b2bb8029 Author: Tom Lane Date: Sun Jun 19 13:11:40 2016 -0400 Regards, Tatsuro Yamada NTT OSS Center On 2016/06/18 1:26, Robert Haas wrote: On

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-17 Thread Robert Haas
On Fri, Jun 17, 2016 at 9:29 AM, Robert Haas wrote: > On Fri, Jun 17, 2016 at 9:04 AM, Amit Kapila wrote: >> Attached, please find updated patch based on above lines. Due to addition >> of projection path on top of partial paths, some small

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-17 Thread Robert Haas
On Fri, Jun 17, 2016 at 9:04 AM, Amit Kapila wrote: > Attached, please find updated patch based on above lines. Due to addition > of projection path on top of partial paths, some small additional cost is > added for parallel paths. In one of the tests in

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-17 Thread Amit Kapila
On Fri, Jun 17, 2016 at 8:18 AM, Amit Kapila wrote: > > On Fri, Jun 17, 2016 at 3:20 AM, Robert Haas wrote: > > > > > Something like what you have there might work if you use > > create_projection_path instead of apply_projection_to_path. > >

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-17 Thread Andreas Joseph Krogh
På fredag 17. juni 2016 kl. 08:14:39, skrev Amit Kapila >: On Fri, Jun 17, 2016 at 11:39 AM, Andreas Joseph Krogh > wrote: På torsdag 16. juni 2016 kl. 20:19:44, skrev Tom Lane

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-17 Thread Amit Kapila
On Fri, Jun 17, 2016 at 11:39 AM, Andreas Joseph Krogh wrote: > På torsdag 16. juni 2016 kl. 20:19:44, skrev Tom Lane : > > Amit Kapila writes: > > On Mon, Jun 13, 2016 at 10:36 PM, Tom Lane wrote: > >>

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-17 Thread Andreas Joseph Krogh
På torsdag 16. juni 2016 kl. 20:19:44, skrev Tom Lane >: Amit Kapila writes: > On Mon, Jun 13, 2016 at 10:36 PM, Tom Lane wrote: >> min_parallel_relation_size, or min_parallelizable_relation_size,

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Amit Kapila
On Fri, Jun 17, 2016 at 3:20 AM, Robert Haas wrote: > > On Thu, Jun 16, 2016 at 12:16 PM, Robert Haas wrote: > > On Thu, Jun 16, 2016 at 8:00 AM, Amit Kapila wrote: > >>> 1. The case originally reported by Thomas Munro still

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Tom Lane
Amit Kapila writes: > On Thu, Jun 16, 2016 at 11:49 PM, Tom Lane wrote: >> But you need to include to use INT_MAX ... > I wonder why it has not given me any compilation error/warning. I have > tried it on both Windows and CentOS, before sending the

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Amit Kapila
On Thu, Jun 16, 2016 at 11:49 PM, Tom Lane wrote: > > Amit Kapila writes: > > On Mon, Jun 13, 2016 at 10:36 PM, Tom Lane wrote: > >> min_parallel_relation_size, or min_parallelizable_relation_size, or > >> something like

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Robert Haas
On Thu, Jun 16, 2016 at 12:16 PM, Robert Haas wrote: > On Thu, Jun 16, 2016 at 8:00 AM, Amit Kapila wrote: >>> 1. The case originally reported by Thomas Munro still fails. To fix >>> that, we probably need to apply scanjoin_target to each partial

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Tom Lane
Amit Kapila writes: > On Mon, Jun 13, 2016 at 10:36 PM, Tom Lane wrote: >> min_parallel_relation_size, or min_parallelizable_relation_size, or >> something like that? > You are right that such a variable will make it simpler to write tests for >

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Robert Haas
On Thu, Jun 16, 2016 at 12:50 PM, Tom Lane wrote: > Amit Kapila writes: >> On Thu, Jun 16, 2016 at 9:26 AM, Robert Haas wrote: >>> 3. In https://www.postgresql.org/message-id/25521.1465837...@sss.pgh.pa.us >>> Tom proposed

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Tom Lane
Amit Kapila writes: > On Thu, Jun 16, 2016 at 9:26 AM, Robert Haas wrote: >> 3. In https://www.postgresql.org/message-id/25521.1465837...@sss.pgh.pa.us >> Tom proposed adding a GUC to set the minimum relation size required >> for consideration of

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Robert Haas
On Thu, Jun 16, 2016 at 8:00 AM, Amit Kapila wrote: >> 1. The case originally reported by Thomas Munro still fails. To fix >> that, we probably need to apply scanjoin_target to each partial path. >> But we can only do that if it's parallel-safe. It seems like what we >>

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-16 Thread Amit Kapila
On Thu, Jun 16, 2016 at 9:26 AM, Robert Haas wrote: > > On Tue, Jun 14, 2016 at 12:18 PM, Tom Lane wrote: > > Amit Kapila writes: > >> On Mon, Jun 13, 2016 at 9:37 PM, Tom Lane wrote: > >>> ... I got a

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-15 Thread Robert Haas
On Tue, Jun 14, 2016 at 12:18 PM, Tom Lane wrote: > Amit Kapila writes: >> On Mon, Jun 13, 2016 at 9:37 PM, Tom Lane wrote: >>> ... I got a core dump in the window.sql test: >>> which I think may be another manifestation of the

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-15 Thread Amit Kapila
On Tue, Jun 14, 2016 at 4:48 PM, Amit Kapila wrote: > On Mon, Jun 13, 2016 at 8:11 PM, Tom Lane wrote: > > > I do > > not share your confidence that using apply_projection_to_path within > > create_grouping_paths is free of such a hazard. > > > >

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-14 Thread Tom Lane
Amit Kapila writes: > On Mon, Jun 13, 2016 at 9:37 PM, Tom Lane wrote: >> ... I got a core dump in the window.sql test: >> which I think may be another manifestation of the failure-to-apply-proper- >> pathtarget issue we're looking at in this thread.

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-14 Thread Tom Lane
Robert Haas writes: > On Mon, Jun 13, 2016 at 6:21 PM, Tom Lane wrote: >> I think this is bad because it forces any external creators of >> UPPERREL_GROUP_AGG to duplicate that code --- and heaven help everybody >> if anyone is out of sync on whether to

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-14 Thread Amit Kapila
On Mon, Jun 13, 2016 at 10:36 PM, Tom Lane wrote: > > Robert Haas writes: > > On Mon, Jun 13, 2016 at 11:02 AM, Tom Lane wrote: > >> BTW, decent regression tests could be written without the need to create > >> enormous tables if

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-14 Thread Tom Lane
David Rowley writes: > Do you think it's worth also applying the attached so as to have > ressortgroupref set to NULL more consistently, instead of sometimes > NULL and other times allocated to memory wastefully filled with zeros? Meh --- that seems to add

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-14 Thread Amit Kapila
On Tue, Jun 14, 2016 at 2:16 AM, Tom Lane wrote: > > Robert Haas writes: > > In practice, we don't yet have the ability for > > parallel-safe paths from subqueries to affect planning at higher query > > levels, but that's because the pathification stuff

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-14 Thread Amit Kapila
On Mon, Jun 13, 2016 at 8:11 PM, Tom Lane wrote: > > Amit Kapila writes: > > On Mon, Jun 13, 2016 at 7:51 PM, Tom Lane wrote: > >> I think the real question here is why the code removed by 04ae11f62 > >> was wrong. It was

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-14 Thread David Rowley
On 14 June 2016 at 04:07, Tom Lane wrote: > Just as an experiment to see what would happen, I did > > - int parallel_threshold = 1000; > + int parallel_threshold = 1; > > and ran the regression tests. I got a

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Amit Kapila
On Mon, Jun 13, 2016 at 9:37 PM, Tom Lane wrote: > > I wrote: > > Amit Kapila writes: > >> It is slightly tricky to write a reproducible parallel-query test, but > >> point taken and I think we should try to have a test unless such a test is > >>

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 6:21 PM, Tom Lane wrote: > Robert Haas writes: >> Again, please have a look at the patch and see if it seems unsuitable >> to you for some reason. I'm not confident of my ability to get all of >> this path stuff right without a

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Robert Haas writes: > Again, please have a look at the patch and see if it seems unsuitable > to you for some reason. I'm not confident of my ability to get all of > this path stuff right without a bit of help from the guy who designed > it. I'm kind of in a bind right

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 5:46 PM, Tom Lane wrote: > Robert Haas writes: >> One problem that I've realized that is related to this is that the way >> that the consider_parallel flag is being set for upper rels is almost >> totally bogus, which I believe

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Robert Haas writes: > Oh, one other thing about this: I'm not going to try to defend > whatever confusion between subplans and subqueries appears in that > comment, but prior to upper planner pathification I think we were dead > in the water here anyway, because the

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Robert Haas writes: > One problem that I've realized that is related to this is that the way > that the consider_parallel flag is being set for upper rels is almost > totally bogus, which I believe accounts for your complaint at PGCon > that force_parallel_mode was not

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 5:27 PM, Robert Haas wrote: > On Mon, Jun 13, 2016 at 4:46 PM, Tom Lane wrote: >> Robert Haas writes: >>> In practice, we don't yet have the ability for >>> parallel-safe paths from subqueries to affect

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 4:46 PM, Tom Lane wrote: > Robert Haas writes: >> In practice, we don't yet have the ability for >> parallel-safe paths from subqueries to affect planning at higher query >> levels, but that's because the pathification stuff

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Robert Haas writes: > In practice, we don't yet have the ability for > parallel-safe paths from subqueries to affect planning at higher query > levels, but that's because the pathification stuff landed too late in > the cycle for me to fully react to it. I wonder if that's

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 3:42 PM, Tom Lane wrote: >> I would not be surprised at a change to a parallel-query plan, but there's >> no parallelism here, so what happened? This looks like a bug to me. >> (Also, doing this query without COSTS OFF shows that the newly selected >>

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
I wrote: > ... there was also an unexplainable plan change: > *** /home/postgres/pgsql/src/test/regress/expected/aggregates.out Thu Apr > 7 21:13:14 2016 > --- /home/postgres/pgsql/src/test/regress/results/aggregates.out Mon Jun > 13 11:54:01 2016 > *** > *** 577,590

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 1:06 PM, Tom Lane wrote: > Robert Haas writes: >> On Mon, Jun 13, 2016 at 11:02 AM, Tom Lane wrote: >>> BTW, decent regression tests could be written without the need to create >>> enormous tables if the

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Amit Kapila
On Mon, Jun 13, 2016 at 7:51 PM, Tom Lane wrote: > > Robert Haas writes: > > On Mon, Jun 13, 2016 at 3:18 AM, Amit Kapila wrote: > >> In create_grouping_paths(), we are building partial_grouping_path and same > >> is used for

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Amit Kapila
On Mon, Jun 13, 2016 at 7:17 PM, Robert Haas wrote: > > On Mon, Jun 13, 2016 at 3:18 AM, Amit Kapila wrote: > > In create_grouping_paths(), we are building partial_grouping_path and same > > is used for gather path and other grouping paths (for

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Robert Haas writes: > On Mon, Jun 13, 2016 at 11:02 AM, Tom Lane wrote: >> BTW, decent regression tests could be written without the need to create >> enormous tables if the minimum rel size in create_plain_partial_paths() >> could be configured to

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 11:02 AM, Tom Lane wrote: > Amit Kapila writes: >> It is slightly tricky to write a reproducible parallel-query test, but >> point taken and I think we should try to have a test unless such a test is >> really time

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
I wrote: > Amit Kapila writes: >> It is slightly tricky to write a reproducible parallel-query test, but >> point taken and I think we should try to have a test unless such a test is >> really time consuming. > BTW, decent regression tests could be written without

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Amit Kapila writes: > It is slightly tricky to write a reproducible parallel-query test, but > point taken and I think we should try to have a test unless such a test is > really time consuming. BTW, decent regression tests could be written without the need to

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Amit Kapila writes: > On Mon, Jun 13, 2016 at 7:51 PM, Tom Lane wrote: >> I think the real question here is why the code removed by 04ae11f62 >> was wrong. It was unsafe to use apply_projection_to_path, certainly, >> but using

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tom Lane
Robert Haas writes: > On Mon, Jun 13, 2016 at 3:18 AM, Amit Kapila wrote: >> In create_grouping_paths(), we are building partial_grouping_path and same >> is used for gather path and other grouping paths (for partial paths). >> However, we don't

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Robert Haas
On Mon, Jun 13, 2016 at 3:18 AM, Amit Kapila wrote: > In create_grouping_paths(), we are building partial_grouping_path and same > is used for gather path and other grouping paths (for partial paths). > However, we don't use it for partial path list and sort path due to

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tatsuro Yamada
Hi, I applied your patch and run tpc-h. Then I got new errors on Q4,12,17 and 19. ERROR: Aggref found in non-Agg plan node. See bellow, -- postgres=# \i queries/4.explain.sql ERROR: Aggref found in non-Agg plan node STATEMENT: explain analyze select

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Tatsuro Yamada
On 2016/06/13 15:52, Michael Paquier wrote: On Mon, Jun 13, 2016 at 2:42 PM, Tatsuro Yamada wrote: I got mistake to write an e-mail to -hackers on last week. :-< I should have written this. The bug has not fixed by Tom Lane's patch: commit aeb9ae6. Because

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Amit Kapila
On Mon, Jun 13, 2016 at 11:05 AM, David Rowley wrote: > > On 13 June 2016 at 15:39, Thomas Munro wrote: > > What is going on here? > > ... > > > > > postgres=# set max_parallel_workers_per_gather = 2; > > SET > > postgres=# explain

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-13 Thread Michael Paquier
On Mon, Jun 13, 2016 at 2:42 PM, Tatsuro Yamada wrote: > I got mistake to write an e-mail to -hackers on last week. :-< > I should have written this. > > The bug has not fixed by Tom Lane's patch: commit aeb9ae6. > Because I got the same error using tpc-h. This

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-12 Thread Tatsuro Yamada
Hi, Subject: Re: [HACKERS] ORDER/GROUP BY expression not found in targetlist Date: Thu, 09 Jun 2016 12:08:01 +0900 Right, I saw that thread which involved the same error message:

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-12 Thread David Rowley
On 13 June 2016 at 15:39, Thomas Munro wrote: > What is going on here? ... > > postgres=# set max_parallel_workers_per_gather = 2; > SET > postgres=# explain select length(data) from logs group by length(data); > ERROR: ORDER/GROUP BY expression not found in

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-12 Thread Thomas Munro
On Mon, Jun 13, 2016 at 4:16 PM, Tatsuro Yamada wrote: > I tried to run tpc-h queries, but some queries failed by the error on last > week. > >>Subject: Re: [HACKERS] ORDER/GROUP BY expression not found in targetlist >>Date: Thu, 09 Jun 2016 12:08:01 +0900 Right, I

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-12 Thread Tatsuro Yamada
Hi, I tried to run tpc-h queries, but some queries failed by the error on last week. >Subject: Re: [HACKERS] ORDER/GROUP BY expression not found in targetlist >Date: Thu, 09 Jun 2016 12:08:01 +0900 Today, I try it again by changing max_parallel_workers_per_gather parameter. The result of Q1 is