-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: postgresql add default expr and nextval #2301
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2301 +/- ##
=============================================
- Coverage 51.41% 51.32% -0.09%
+ Complexity 2807 2803 -4
=============================================
Files 553 553
Lines 17698 17716 +18
Branches 2093 2097 +4
=============================================
- Hits 9099 9093 -6
- Misses 7742 7763 +21
- Partials 857 860 +3
|
...rser-druid/src/main/java/io/seata/sqlparser/druid/postgresql/PostgresqlInsertRecognizer.java
Show resolved
Hide resolved
@@ -0,0 +1,42 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use com.alibaba.druid.sql.ast.expr.SQLSequenceExpr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sqlparser module can be multi implemention. druid just one of them.
rm-datasource/src/main/java/io/seata/rm/datasource/exec/InsertExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/InsertExecutor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how to support mysql default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Test case:
PG
insert into account_tbl(id, user_id, money) values (nextval('seq_account_tbl_id'), trim(both ?), ?)
insert into account_tbl(user_id, money, id) values (trim(both ?), ?, nextval('seq_account_tbl_id'))
insert into account_tbl(id, user_id, money) values (default, ?, ?)
Oracle
insert into account_tbl(id, user_id, money, information, description) values (account_tbl_seq.nextval, ?, ?, ?, ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ⅰ. Describe what this PR did
feature: postgresql add default expr and convert nextval to sequence expr.
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews