chore: ignore unnecessary char type cast in GetColumns #2278

Merged
lunny merged 2 commits from flyingpigge/xorm:chore/ignore-char-tranform into master 2023-07-03 09:15:49 +00:00
Contributor

PostgreSQL有两种char类型:character"char": https://www.postgresql.org/docs/current/datatype-character.html.

pg_class里的relkind"char"类型,所以GetColumns这里应该转成::"char"或者和本PR里请求的一样去掉转换。这样对于PostgreSQL以及其他兼容PostgreSQL的数据库容错性更好,在做比较时它们通常都会被隐式转换。

postgres=# select pg_typeof(relkind), pg_typeof('a'::char), pg_typeof('a'::"char") from pg_class limit 1;
 pg_typeof | pg_typeof | pg_typeof
-----------+-----------+-----------
 "char"    | character | "char"
(1 row)
PostgreSQL有两种char类型:`character`和`"char"`: https://www.postgresql.org/docs/current/datatype-character.html. `pg_class`里的`relkind`是`"char"`类型,所以`GetColumns`这里应该转成`::"char"`或者和本PR里请求的一样去掉转换。这样对于PostgreSQL以及其他兼容PostgreSQL的数据库容错性更好,在做比较时它们通常都会被隐式转换。 ```sql postgres=# select pg_typeof(relkind), pg_typeof('a'::char), pg_typeof('a'::"char") from pg_class limit 1; pg_typeof | pg_typeof | pg_typeof -----------+-----------+----------- "char" | character | "char" (1 row) ```
flyingpigge added 1 commit 2023-06-21 07:32:03 +00:00
chore: ignore unnecessary char type transform in GetColumns
All checks were successful
test mariadb / test mariadb (pull_request) Successful in 5m4s
test mssql / test mssql (pull_request) Successful in 5m55s
test mysql / test mysql (pull_request) Successful in 4m39s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m50s
test tidb / test tidb (pull_request) Successful in 5m26s
test mysql8 / test mysql8 (pull_request) Successful in 7m24s
test postgres / test postgres (pull_request) Successful in 5m31s
test cockroach / test cockroach (pull_request) Successful in 16m15s
e75511eff0
flyingpigge requested review from lunny 2023-06-26 06:13:50 +00:00
Owner

Could you write a test for that?

Could you write a test for that?
Author
Contributor

Could you write a test for that?

Well, the type casting involved in this piece are basically some of the internal behavior of the db side, and I'm not sure what kind of test would be appropriate to add in this PR. Since the affected function GetColumns is called in almost all test cases in ci job test postgres, I think it's okay to leave this PR without any test here. Does it LGTY?

> Could you write a test for that? Well, the type casting involved in this piece are basically some of the internal behavior of the db side, and I'm not sure what kind of test would be appropriate to add in this PR. Since the affected function `GetColumns` is called in almost all test cases in ci job `test postgres`, I think it's okay to leave this PR without any test here. Does it LGTY?
lunny approved these changes 2023-06-29 10:24:46 +00:00
lunny added 1 commit 2023-06-29 10:25:09 +00:00
Merge branch 'master' into chore/ignore-char-tranform
All checks were successful
test mariadb / test mariadb (pull_request) Successful in 4m49s
test mssql / test mssql (pull_request) Successful in 4m2s
test mysql / test mysql (pull_request) Successful in 3m38s
test mysql8 / test mysql8 (pull_request) Successful in 3m31s
test cockroach / test cockroach (pull_request) Successful in 16m24s
test postgres / test postgres (pull_request) Successful in 4m8s
test sqlite / unit test & test sqlite (pull_request) Successful in 6m16s
test tidb / test tidb (pull_request) Successful in 3m20s
d6598deb7a
Author
Contributor

Hi @lunny , can we merge this PR now? 😃

Hi @lunny , can we merge this PR now? 😃
lunny merged commit 52b01ce67f into master 2023-07-03 09:15:49 +00:00
Sign in to join this conversation.
No description provided.