fix: pg invalid query #2324

Closed
vishal-bihani wants to merge 1 commits from bug-pg-invalid-query into master
First-time contributor

For postgres dialect when GetColumn is used, and when schema is not empty then the resulting interpolated query is invalid.

Attaching the screenshots of the resulting query and the error below.

For postgres dialect when [GetColumn](https://gitea.com/xorm/xorm/src/branch/master/dialects/postgres.go#L1081) is used, and when schema is not empty then the resulting interpolated query is invalid. Attaching the screenshots of the resulting query and the error below.
vishal-bihani added 1 commit 2023-08-14 14:18:18 +00:00
fix: pg invalid query
All checks were successful
test cockroach / test cockroach (pull_request) Successful in 7m44s
test mariadb / test mariadb (pull_request) Successful in 4m28s
test mysql / test mysql (pull_request) Successful in 5m4s
test mssql / test mssql (pull_request) Successful in 6m4s
test mysql8 / test mysql8 (pull_request) Successful in 5m11s
test postgres / test postgres (pull_request) Successful in 5m54s
test tidb / test tidb (pull_request) Successful in 5m30s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m25s
c3e6e94f88
vishal-bihani requested review from lunny 2023-08-14 14:19:59 +00:00
vishal-bihani requested review from Maintainers 2023-08-15 08:22:14 +00:00
lunny reviewed 2023-08-15 08:31:49 +00:00
@ -1079,3 +1079,3 @@
LEFT JOIN pg_class AS g ON p.confrelid = g.oid
LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name
WHERE n.nspname= s.table_schema AND c.relkind = 'r' AND c.relname = $1%s AND f.attnum > 0 ORDER BY f.attnum;`
WHERE n.nspname= s.table_schema AND c.relkind = 'r' AND c.relname = $1 %s AND f.attnum > 0 ORDER BY f.attnum;`
Owner

It's wired because there is a space before AND in line 1085

It's wired because there is a space before ` AND` in line 1085
Author
First-time contributor

Oh wait, I noticed my version of xorm does not have space in line 1085. Will check and close this PR

Oh wait, I noticed my version of xorm does not have space in line 1085. Will check and close this PR
Author
First-time contributor

This issue was related to an older version.

This issue was related to an older version.
vishal-bihani closed this pull request 2023-08-15 08:53:09 +00:00
All checks were successful
test cockroach / test cockroach (pull_request) Successful in 7m44s
test mariadb / test mariadb (pull_request) Successful in 4m28s
test mysql / test mysql (pull_request) Successful in 5m4s
test mssql / test mssql (pull_request) Successful in 6m4s
test mysql8 / test mysql8 (pull_request) Successful in 5m11s
test postgres / test postgres (pull_request) Successful in 5m54s
test tidb / test tidb (pull_request) Successful in 5m30s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m25s

Pull request closed

Sign in to join this conversation.
No description provided.