[#1049] Optimise GREATEST() and LEAST() simulations for Sybase, ASE, SQL Server, Derby - added more integration tests for GREATEST() and LEAST(). In case these functions are simulated using subqueries, MAX() and UNION ALL(), be sure that all dialects still support them, even they only have limited support for derived tables.

This commit is contained in:
Lukas Eder 2012-01-11 20:29:02 +00:00
parent b7a9db1c48
commit d381d20f85

View File

@ -6549,6 +6549,26 @@ public abstract class jOOQAbstractTest<
assertEquals("4", record.getValue(2));
assertEquals("1", record.getValue(3));
// Greatest and least with tables. If they're simulated using subqueries
// there is a risk of breaking this functionality due to limited support
// for subqueries and derived tables...
Result<Record> result = create()
.select(TBook_ID(),
greatest(TBook_ID(),
TBook_AUTHOR_ID(),
TBook_LANGUAGE_ID()),
least(TBook_ID(),
TBook_AUTHOR_ID(),
TBook_LANGUAGE_ID()))
.from(TBook())
.orderBy(TBook_ID())
.fetch();
assertEquals(4, result.size());
assertEquals(BOOK_IDS, result.getValues(TBook_ID()));
assertEquals(asList(1, 2, 4, 4), result.getValues(1));
assertEquals(asList(1, 1, 2, 2), result.getValues(2));
// Mathematical functions
switch (getDialect()) {
case SQLITE: