Allow parens directly before and after FROM

This commit is contained in:
Travis Burtrum 2020-03-31 23:50:48 -04:00
parent 3a51d6ee56
commit 1e4a1c2371
2 changed files with 6 additions and 1 deletions

View File

@ -10,7 +10,7 @@ public class SimpleSQLParser extends AbstractSQLParser {
private static final Pattern aliasPattern = Pattern.compile("^.*\\.");
private static final Pattern parenPattern = Pattern.compile("\\([^)]+\\)");
private static final Pattern fromPattern = Pattern.compile("\\s+FROM\\s+");
private static final Pattern fromPattern = Pattern.compile("[\\s)]+FROM[\\s(]+");
public SimpleSQLParser() {
super(null, false);

View File

@ -37,6 +37,11 @@ public class SimpleSQLParserTest {
assertTrue(ret.isSelect());
assertArrayEquals(new String[]{null, "SOMETHING_FROM_BOB"}, ret.columnNames());
}
{
final SQLParser ret = getFactory().parse("select something_from_bob from( tom)");
assertTrue(ret.isSelect());
assertArrayEquals(new String[]{null, "SOMETHING_FROM_BOB"}, ret.columnNames());
}
}
@Test