-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
针对create trigger sql加上postgresql的execute语法支持 #5474
针对create trigger sql加上postgresql的execute语法支持 #5474
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/src/test/java/com/alibaba/druid/bvt/sql/postgresql/issues/Issue5474.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.alibaba.druid.bvt.sql.postgresql.issues; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.ast.SQLStatement; | ||
import com.alibaba.druid.sql.parser.SQLParserUtils; | ||
import com.alibaba.druid.sql.parser.SQLStatementParser; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
|
||
/** | ||
* @author lizongbo | ||
* @see <a href="https://github.com/alibaba/druid/issues/5474">Issue来源</a> | ||
* @see <a href="https://www.postgresql.org/docs/current/sql-createtrigger.html">PostgreSQL CREATE TRIGGER — define a new trigger</a> | ||
*/ | ||
public class Issue5474 { | ||
|
||
@Test | ||
public void test_create_triger_execute() throws Exception { | ||
for (DbType dbType : new DbType[]{DbType.postgresql}) { | ||
String sql = "CREATE TRIGGER \"update_time\" BEFORE UPDATE ON \"poit_cloud\".\"ent_i_checking_analyze\" FOR EACH ROW EXECUTE PROCEDURE poit_cloud.modify_timestamp();"; | ||
|
||
SQLStatementParser parser = SQLParserUtils.createSQLStatementParser(sql, dbType); | ||
SQLStatement statement = parser.parseStatement(); | ||
System.out.println("原始的sql===" + sql); | ||
String newSql = statement.toString(); | ||
System.out.println("生成的sql===" + newSql); | ||
|
||
} | ||
} | ||
} |