Skip to content

Commit ccefbeb

Browse files
committed
added test for wrong top distinct order.
1 parent 7819a2f commit ccefbeb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test/java/net/sf/jsqlparser/test/select/SelectTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
import java.io.*;
1515
import java.util.*;
16+
import java.util.logging.Level;
17+
import java.util.logging.Logger;
1618

1719
import static net.sf.jsqlparser.test.TestUtils.*;
1820

@@ -420,6 +422,15 @@ public void testDistinctTop() throws JSQLParserException {
420422
assertNotNull(plainSelect.getTop());
421423
assertStatementCanBeDeparsedAs(select, statement);
422424
}
425+
426+
public void testDistinctTop2() {
427+
String statement = "SELECT TOP 5 DISTINCT myid, mycol FROM mytable WHERE mytable.col = 9";
428+
try {
429+
parserManager.parse(new StringReader(statement));
430+
fail("sould not work");
431+
} catch (JSQLParserException ex) {
432+
}
433+
}
423434

424435
public void testFrom() throws JSQLParserException {
425436
String statement = "SELECT * FROM mytable as mytable0, mytable1 alias_tab1, mytable2 as alias_tab2, (SELECT * FROM mytable3) AS mytable4 WHERE mytable.col = 9";

0 commit comments

Comments
 (0)