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

LIMIT and OFFSET does not user args but hardcoded numbers #186

Open
stavros-k opened this issue Jan 17, 2025 · 1 comment
Open

LIMIT and OFFSET does not user args but hardcoded numbers #186

stavros-k opened this issue Jan 17, 2025 · 1 comment

Comments

@stavros-k
Copy link

While it is safe from sql injection as it uses strconv.Itoa.
I believe having those as args will help db with query plan caching. I might be totally wrong here, but I just noticed it while comparing sql output with sql generated from go-jet.

Feel free to close if you think its fine!

@huandu
Copy link
Owner

huandu commented Jan 19, 2025

The reason for this design is that when concatenating the SQL limit and offset, different expressions need to be formed based on various database systems. For example, MySQL requires LIMIT n OFFSET m, while Informix uses SKIP m FIRST n, and other database systems have their own distinct syntaxes. This has led me to manually handle the values of limit and offset, which in turn has caused difficulties in placing these values into args.

Of course, these technical challenges can always be resolved. I just haven't seen the benefits of changing this detail before. Your proposal of query plan caching is quite enlightening, and I think it's time to consider optimizing this detail. Allow me some time to contemplate the relevant design before continuing the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants