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

sql generated in log is wrong #3244

Open
jswxstw opened this issue Jan 3, 2024 · 3 comments
Open

sql generated in log is wrong #3244

jswxstw opened this issue Jan 3, 2024 · 3 comments
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.

Comments

@jswxstw
Copy link
Contributor

jswxstw commented Jan 3, 2024

What version of Go and system type/arch are you using?
go1.20.10 darwin/amd64

What version of GoFrame are you using?
v2.6.1

Can this bug be re-produced with the latest release?
yes

What did you do?
query with in filter, sql generated in log is wrong.

What did you expect to see?
image

What did you see instead?

@jswxstw jswxstw added the bug It is confirmed a bug, but don't worry, we'll handle it. label Jan 3, 2024
@hailaz
Copy link
Member

hailaz commented May 24, 2024

没有复现,请提供复现代码。

github.com/gogf/gf/v2 v2.6.1
dao.EventTask.Ctx(ctx).WhereIn(dao.EventTask.Columns().TaskStatus, g.SliceStr{consts.TaskStatusUnprocessed, consts.TaskStatusProcessing}).All()
SELECT * FROM `event_task` WHERE `task_status` IN ('unprocessed','processing')

@jswxstw
Copy link
Contributor Author

jswxstw commented May 27, 2024

没有复现,请提供复现代码。

github.com/gogf/gf/v2 v2.6.1
dao.EventTask.Ctx(ctx).WhereIn(dao.EventTask.Columns().TaskStatus, g.SliceStr{consts.TaskStatusUnprocessed, consts.TaskStatusProcessing}).All()
SELECT * FROM `event_task` WHERE `task_status` IN ('unprocessed','processing')

The SQL that is actually executed is fine, but the SQL printed in the logs is problematic.
You can try to generate a query with two in filters and then check the log generated in logs.

@jswxstw
Copy link
Contributor Author

jswxstw commented May 30, 2024

We add some trace info into the sql hint, something like /* p=Eros,i=d0e3d7953427d4174bb17f2d3d0b9c95,f=GET /api/v1/oss/task?statuses=[%22Failed%22,%22Closed%22] */.
There is a placeholder ? in it which cause this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.
Projects
None yet
Development

No branches or pull requests

2 participants