Hi, On 11/24/18 10:28 AM, Surafel Temesgen wrote: > Attach is rebased patch against the current master > regards > Surafel > > On Thu, Nov 1, 2018 at 2:28 PM Surafel Temesgen <surafel3...@gmail.com > <mailto:surafel3...@gmail.com>> wrote: > > hi, > > The attached patch include all the comment given by Tomas and i > check sql standard about LIMIT and this feature >
Unfortunately, it seems the "limit" regression tests fail for some reason - the output mismatches the expected results for some reason. It seems as if the WITH TIES code affects ordering of the results within the group. See the attached file. > it did not say anything about it but I think its good idea to > include it to LIMIT too and I will add it if we have consensus on it. > Hmm, I'm not sure that's needed. I don't see an urgent need to do that in v1 of the patch. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
*** /home/user/work/postgres/src/test/regress/expected/limit.out 2019-01-01 18:04:32.863729423 +0100 --- /home/user/work/postgres/src/test/regress/results/limit.out 2019-01-01 18:14:13.328729423 +0100 *************** *** 512,527 **** ORDER BY thousand FETCH FIRST 2 ROW WITH TIES; two | unique1 | unique2 | stringu1 | thousand -----+---------+---------+----------+---------- - | 800 | 9 | UEAAAA | 0 | 200 | 95 | SHAAAA | 0 - | 500 | 262 | GTAAAA | 0 - | 400 | 309 | KPAAAA | 0 - | 300 | 374 | OLAAAA | 0 - | 600 | 402 | CXAAAA | 0 | 700 | 434 | YAAAAA | 0 | 900 | 913 | QIAAAA | 0 - | 100 | 946 | WDAAAA | 0 | 0 | 998 | AAAAAA | 0 (10 rows) SELECT ''::text AS two, unique1, unique2, stringu1, thousand --- 512,527 ---- ORDER BY thousand FETCH FIRST 2 ROW WITH TIES; two | unique1 | unique2 | stringu1 | thousand -----+---------+---------+----------+---------- | 200 | 95 | SHAAAA | 0 | 700 | 434 | YAAAAA | 0 + | 600 | 402 | CXAAAA | 0 | 900 | 913 | QIAAAA | 0 | 0 | 998 | AAAAAA | 0 + | 500 | 262 | GTAAAA | 0 + | 800 | 9 | UEAAAA | 0 + | 100 | 946 | WDAAAA | 0 + | 400 | 309 | KPAAAA | 0 + | 300 | 374 | OLAAAA | 0 (10 rows) SELECT ''::text AS two, unique1, unique2, stringu1, thousand *************** *** 529,536 **** ORDER BY thousand FETCH FIRST 2 ROW ONLY; two | unique1 | unique2 | stringu1 | thousand -----+---------+---------+----------+---------- | 200 | 95 | SHAAAA | 0 - | 500 | 262 | GTAAAA | 0 (2 rows) -- should fail --- 529,536 ---- ORDER BY thousand FETCH FIRST 2 ROW ONLY; two | unique1 | unique2 | stringu1 | thousand -----+---------+---------+----------+---------- + | 800 | 9 | UEAAAA | 0 | 200 | 95 | SHAAAA | 0 (2 rows) -- should fail ======================================================================