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

Expose ValueBracketReg #660

Closed
wants to merge 1 commit into from
Closed

Expose ValueBracketReg #660

wants to merge 1 commit into from

Conversation

hexadecy
Copy link

Fix #659

@coveralls
Copy link

coveralls commented Oct 20, 2020

Pull Request Test Coverage Report for Build 159

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+4.9%) to 73.304%

Totals Coverage Status
Change from base Build 155: 4.9%
Covered Lines: 1178
Relevant Lines: 1607

💛 - Coveralls

@arp242
Copy link
Contributor

arp242 commented Jan 24, 2021

I'm not sure if I follow what this fixes exactly; your issue doesn't really mention what the problem is? It would be helpful if you could expand on that.

I also wonder if this is something that can't be fixed better instead of letting people override some mysterious regexp? Your solution is also racy and people will run in to problems if they use sqlx in more than on goroutine.

@hexadecy
Copy link
Author

hexadecy commented Jan 24, 2021

With the current regexp

var valueBracketReg = regexp.MustCompile(`\([^(]*\?+[^)]*\)`)

and with this sql request:

INSERT INTO data (map_id, coordinates) VALUES (:map_id, GeomFromEWKB(:coordinates))

we have this error:

pq: syntax error at end of input

Possible solution

Another possible fix is to have a more permissive regexp for any functions not just GeomFromEWKB(), but I not sure of the security issue (sql injection). So I think, we can at least go back to the previous behavior, cause right now we are stuck using an older version or making a fork with this small fix.

@hexadecy
Copy link
Author

@arp242 I updated the issue to give more info.

@hexadecy
Copy link
Author

Fix in #734

@hexadecy hexadecy closed this Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot replace EndBracketsReg
3 participants