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

In Dao When use alias table name, use WherePrefixNotIn get sql error #2907

Closed
qq413434162 opened this issue Aug 28, 2023 · 0 comments
Closed
Labels
bug It is confirmed a bug, but don't worry, we'll handle it. done This issue is done, which may be release in next version.

Comments

@qq413434162
Copy link

1. What version of Go and system type/arch are you using?

go version go1.20.3 darwin/amd64

2. What version of GoFrame are you using?

GoFrame CLI Tool v2.5.1, https://goframe.org
GoFrame Version: v2.5.2 in current go.mod
CLI Installed At: /usr/local/bin/gf
CLI Built Detail:
Go Version: go1.20.4
GF Version: v2.5.1
Git Commit: 2023-07-26 21:27:58 e0e0043
Build Time: 2023-07-26 21:32:56

3. Can this issue be re-produced with the latest release?

Yes

4. What did you do?

In alias table name case, When I use The function

Source:

convey.Convey("test orm dao alias bug", t, func() {
		var (
			ctx   = context.TODO()
			orm   = dao.Order.Ctx(ctx)
			table = "`" + dao.Order.Table() + "`"
			err   error
			total int
		)

		orm = orm.WherePrefixNotIn(
			table,
			"order_status",
			[]int{
				10,
				15,
			},
		)
		total, err = orm.Count()
		convey.So(err, convey.ShouldBeNil)
		convey.So(total, convey.ShouldBeGreaterThan, 1)
	})

Stack

SELECT COUNT(1) FROM `order` WHERE (`order`.`order_status` != 10,15) AND `delete_at` IS NULL
Error: Error 1241 (21000): Operand should contain 1 column(s)

5. What did you expect to see?

SELECT COUNT(1) FROM `order` WHERE (`order`.`order_status` not in  (10,15)) AND `delete_at` IS NULL

6. What did you see instead?

@gqcn gqcn added the bug It is confirmed a bug, but don't worry, we'll handle it. label Oct 9, 2023
gqcn added a commit that referenced this issue Oct 9, 2023
@gqcn gqcn added the done This issue is done, which may be release in next version. label Oct 9, 2023
@gqcn gqcn closed this as completed Oct 9, 2023
gqcn added a commit that referenced this issue Oct 11, 2023
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. done This issue is done, which may be release in next version.
Projects
None yet
Development

No branches or pull requests

2 participants