This commit is contained in:
高铁
2020-11-15 10:38:43 +08:00
parent 8d6c3058f9
commit 2bc4300ca7
3 changed files with 19 additions and 1 deletions
@@ -4855,7 +4855,7 @@ public class SQLExprParser extends SQLParser {
if (lexer.token == Token.ON) {
lexer.nextToken();
accept(Token.DELETE);
if (lexer.identifierEquals(FnvHash.Constants.CASCADE)) {
if (lexer.identifierEquals(FnvHash.Constants.CASCADE) || lexer.token == Token.CASCADE) {
lexer.nextToken();
fk.setOnDeleteCascade(true);
} else {
@@ -44,6 +44,10 @@ public class PostgresqlResourceTest extends PGTest {
exec_test("bvt/parser/postgresql-1.txt");
}
public void test_2() throws Exception {
exec_test("bvt/parser/postgresql-2.txt");
}
public void exec_test(String resource) throws Exception {
System.out.println(resource);
InputStream is = null;
@@ -0,0 +1,14 @@
alter table ACT_RU_INTEGRATION
add constraint ACT_FK_INT_EXECUTION
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_)
on delete cascade
---------------------------
SELECT e1.last_name
FROM employees e1
WHERE f(CURSOR((
SELECT e2.hire_date
FROM employees e2
WHERE e1.employee_id = e2.manager_id
)), e1.hire_date) = 1
ORDER BY last_name;