Skip to content
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

bugfix: postgresql schema lowerCase #2479

Merged
merged 4 commits into from
Apr 1, 2020
Merged

Conversation

jaspercloud
Copy link
Contributor

@jaspercloud jaspercloud commented Mar 29, 2020

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

#2435

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Mar 29, 2020

Codecov Report

Merging #2479 into develop will decrease coverage by 0.00%.
The diff coverage is 16.66%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2479      +/-   ##
=============================================
- Coverage      51.45%   51.44%   -0.01%     
- Complexity      2662     2664       +2     
=============================================
  Files            529      529              
  Lines          16952    16956       +4     
  Branches        2049     2051       +2     
=============================================
+ Hits            8722     8723       +1     
- Misses          7405     7408       +3     
  Partials         825      825              
Impacted Files Coverage Δ Complexity Δ
...rce/sql/struct/cache/PostgresqlTableMetaCache.java 76.08% <16.66%> (-3.46%) 10.00 <0.00> (ø)
...torage/file/store/FileTransactionStoreManager.java 56.19% <0.00%> (-0.32%) 29.00% <0.00%> (ø%)
...in/java/io/seata/server/session/GlobalSession.java 85.77% <0.00%> (+0.45%) 72.00% <0.00%> (+1.00%)
...o/seata/server/coordinator/DefaultCoordinator.java 54.59% <0.00%> (+0.51%) 29.00% <0.00%> (+1.00%)

@@ -102,7 +102,7 @@ private TableMeta resultSetMetaToSchema(DatabaseMetaData dbmd, String tableName)
* select * from "Sel'ect"
*/
if (null != schemaName) {
schemaName = schemaName.replaceAll("(^\")|(\"$)", "");
schemaName = schemaName.replaceAll("(^\")|(\"$)", "").toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why if schema name not null, lower case the schema name?
How about the situation like below?

CREATE DATABASE "SeAtA"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix:
select * from TEST.test
select * from test.TEST
select * from "Test".test
select * from "Test"."Select"

@jaspercloud jaspercloud changed the title #2435 fix pg schema lowerCase bugfix: pg schema lowerCase Mar 29, 2020
Copy link
Contributor

@l81893521 l81893521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

*/
if (null != schemaName) {
schemaName = schemaName.replaceAll("(^\")|(\"$)", "");
if (schemaName.startsWith("\"") && schemaName.endsWith("\"")) {
schemaName = schemaName.replaceAll("(^\")|(\"$)", "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can quotes exist between characters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been confirmed that it may contain special characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support select * from "Te"'st"."Select"

@slievrly slievrly changed the title bugfix: pg schema lowerCase bugfix: postgresql schema lowerCase Apr 1, 2020
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly merged commit 80b9250 into apache:develop Apr 1, 2020
@slievrly slievrly added this to the 1.2.0 milestone Apr 1, 2020
@slievrly slievrly mentioned this pull request Apr 3, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants