Re: lead() with arrays - strange behaviour

2019-08-08 Thread Thomas Kellerer
Tom Lane schrieb am 08.08.2019 um 16:10: > David's point is that the two occurrences of lead() don't mean the > same thing. A window function is directly tied to the SELECT that > it is in the select-list of, and its notion of next and previous > rows is concerned with the set of rows that that SE

Re: lead() with arrays - strange behaviour

2019-08-08 Thread Tom Lane
Thomas Kellerer writes: > David Rowley schrieb am 08.08.2019 um 13:03: >> I think you're confused with what the SELECT with the empty FROM >> clause does here. In your subquery "id_list" is just a parameter from >> the outer query. LEAD(id_list) OVER (ORDER BY id) is never going to >> return anyt

Re: lead() with arrays - strange behaviour

2019-08-08 Thread Thomas Kellerer
David Rowley schrieb am 08.08.2019 um 13:03: >> The following statement tries to find the overlapping values in id_list >> between the current row and the next row: >> >> select id, >>id_list, >>lead(id_list) over (order by id) as next_list, >>array(select u

Re: lead() with arrays - strange behaviour

2019-08-08 Thread David Rowley
On Thu, 8 Aug 2019 at 21:06, Thomas Kellerer wrote: > The following statement tries to find the overlapping values in id_list > between the current row and the next row: > > select id, >id_list, >lead(id_list) over (order by id) as next_list, >array(select