forked from phoedos/pmd
Merge remote-tracking branch 'adangel/issue-1589' into plsql-parser-fixes2
This commit is contained in:
@ -39,6 +39,7 @@ This is a {{ site.pmd.release_type }} release.
|
||||
* [#1632](https://github.com/pmd/pmd/issues/1632): \[java] ConsecutiveLiteralAppends false positive over catch
|
||||
* plsql
|
||||
* [#1587](https://github.com/pmd/pmd/issues/1587): \[plsql] Parse Exception with EXISTS
|
||||
* [#1589](https://github.com/pmd/pmd/issues/1589): \[plsql] ParseException with subqueries in WHERE clause
|
||||
|
||||
### API Changes
|
||||
|
||||
|
@ -1481,6 +1481,8 @@ ASTSqlExpression SqlExpression() :
|
||||
LOOKAHEAD(2) Column()
|
||||
|
|
||||
LOOKAHEAD(2) <ROWNUM>
|
||||
|
|
||||
LOOKAHEAD(2) "(" SelectStatement() ")" // see "Scalar Subquery Expressions"
|
||||
|
|
||||
AdditiveExpression() // this can be a literal or a simple expression, but no conditional
|
||||
)
|
||||
|
@ -12,7 +12,7 @@ import org.junit.Test;
|
||||
|
||||
import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst;
|
||||
|
||||
public class TableCollectionExpression extends AbstractPLSQLParserTst {
|
||||
public class TableCollectionExpressionTest extends AbstractPLSQLParserTst {
|
||||
|
||||
@Test
|
||||
public void testExamples() throws Exception {
|
@ -94,4 +94,11 @@ public class WhereClauseTest extends AbstractPLSQLParserTst {
|
||||
Assert.assertEquals("'([aeiou])\\1'", regexps.get(1).getPattern().getImage());
|
||||
Assert.assertEquals("'i'", regexps.get(1).getMatchParam());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubqueries() throws Exception {
|
||||
String code = IOUtils.toString(this.getClass().getResourceAsStream("WhereClauseSubqueries.pls"),
|
||||
StandardCharsets.UTF_8);
|
||||
ASTInput input = parsePLSQL(code);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
--
|
||||
-- Where Clause with Subqueries
|
||||
--
|
||||
|
||||
BEGIN
|
||||
|
||||
SELECT id INTO v_id FROM my_table
|
||||
WHERE id = (SELECT id FROM other_table);
|
||||
|
||||
UPDATE my_table SET name = 'a'
|
||||
WHERE id = (SELECT id FROM other_table);
|
||||
|
||||
END;
|
||||
/
|
Reference in New Issue
Block a user