[#2335] SQL syntax error when projecting two columns of the same name along with a LIMIT clause in Oracle - Added failing integration test
This commit is contained in:
parent
aa018cad8e
commit
eca996a5ca
@ -449,6 +449,46 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
assertEquals(Integer.valueOf(3), result.getValue(1, TBook_ID()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLimitWithAmbiguousColumnNames() throws Exception {
|
||||
// [#2335] In those databases that do not support LIMIT .. OFFSET, emulations
|
||||
// using ROW_NUMBER() or ROWNUM may cause additional issues
|
||||
|
||||
Result<Record2<Integer, Integer>> result1 =
|
||||
create().select(TAuthor_ID(), TBook_ID())
|
||||
.from(TAuthor())
|
||||
.join(TBook()).on(TAuthor_ID().eq(TBook_AUTHOR_ID()))
|
||||
.orderBy(TBook_ID())
|
||||
.limit(2)
|
||||
.fetch();
|
||||
|
||||
assertEquals(2, result1.size());
|
||||
assertEquals(asList(1, 1), result1.getValues(TAuthor_ID()));
|
||||
assertEquals(asList(1, 2), result1.getValues(TBook_ID()));
|
||||
|
||||
/* [pro] xx
|
||||
xx xxxxxxx xxxxx xxxxxxxxx xxxx xxxx xxx xx xxxxxx xxx xxxxxx xxx
|
||||
xx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x
|
||||
xxxxxxxxxxxxxxxxxxxx xxxxxx xx xxxxxx xxxxxxxx
|
||||
xxxxxxx
|
||||
x
|
||||
|
||||
xx [/pro] */
|
||||
|
||||
Result<Record2<Integer, Integer>> result2 =
|
||||
create().select(TAuthor_ID(), TBook_ID())
|
||||
.from(TAuthor())
|
||||
.join(TBook()).on(TAuthor_ID().eq(TBook_AUTHOR_ID()))
|
||||
.orderBy(TBook_ID())
|
||||
.limit(2)
|
||||
.offset(2)
|
||||
.fetch();
|
||||
|
||||
assertEquals(2, result2.size());
|
||||
assertEquals(asList(2, 2), result2.getValues(TAuthor_ID()));
|
||||
assertEquals(asList(3, 4), result2.getValues(TBook_ID()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLimitDistinct() throws Exception {
|
||||
|
||||
|
||||
@ -1991,6 +1991,11 @@ public abstract class jOOQAbstractTest<
|
||||
new OrderByTests(this).testLimit();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLimitWithAmbiguousColumnNames() throws Exception {
|
||||
new OrderByTests(this).testLimitWithAmbiguousColumnNames();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLimitDistinct() throws Exception {
|
||||
new OrderByTests(this).testLimitDistinct();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user