Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of wrong evaluation? Result of row_number is not correct Sure it is ... or at least, you won't

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Thom Brown
On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of wrong evaluation? Result of row_number is not correct Looks

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread David Johnston
On Jul 30, 2012, at 12:33, Thom Brown t...@linux.com wrote: On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Pavel Stehule
2012/7/30 Thom Brown t...@linux.com On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of wrong evaluation? Result

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Josh Berkus
it looks like row_number is evaluated before SRF - this behave is absolutely undefined - for me - more native behave is different evaluation. SRFs which return multiple rows in the SELECT clause have ALWAYS behaved oddly when it comes to row evaluation (LIMIT, COUNT(), etc.). This isn't

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Merlin Moncure
On Mon, Jul 30, 2012 at 11:47 AM, Pavel Stehule pavel.steh...@gmail.com wrote: 2012/7/30 Thom Brown t...@linux.com On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Tom Lane
Josh Berkus j...@agliodbs.com writes: it looks like row_number is evaluated before SRF - this behave is absolutely undefined - for me - more native behave is different evaluation. SRFs which return multiple rows in the SELECT clause have ALWAYS behaved oddly when it comes to row evaluation

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Andrew Dunstan
On 07/30/2012 01:18 PM, Tom Lane wrote: My feeling is that SRFs in targetlists are just fundamentally poorly defined, and the answer is to avoid them not try to make them cleaner. Most of the real use-cases for them could be handled in a better-defined, more standard way with LATERAL ... so

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Pavel Stehule
2012/7/30 Tom Lane t...@sss.pgh.pa.us Josh Berkus j...@agliodbs.com writes: it looks like row_number is evaluated before SRF - this behave is absolutely undefined - for me - more native behave is different evaluation. SRFs which return multiple rows in the SELECT clause have ALWAYS