
ruby-sequel - issue #253
union, intersect and except clause after clauses such as limit, order by and so on
What steps will reproduce the problem?
- assume SQLite3 as backend: db = Sequel.sqlite d1 = db[:items] d2 = db[:items].filter(:owner => "foo") p d1.intersect(d2).order_by(:owner).sql
What is the expected output? What do you see instead?
expected:
"SELECT * FROM items
INTERSECT SELECT * FROM items
WHERE (owner
=
'foo') ORDER BY owner
"
but got:
"SELECT * FROM items
ORDER BY owner
INTERSECT SELECT * FROM items
WHERE (owner
= 'foo')"
What version of the product are you using? On what operating system?
sequel 2.5.0 on ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
Please provide any additional information below.
In my knowledge at least order-by clause can not appear in sub queries.
Comment #1
Posted on Dec 1, 2008 by Happy BearFixed: http://github.com/jeremyevans/sequel/commit/c790367020280e1495e31c5a53fe380f48980b19
If you use this functionality on other databases, make sure to test it to make sure Sequel produces SQL that those databases like.
Status: Fixed