Fix the logic of calculating the length of the named procedure to consider characters position instead of bytes
Description
Previously, string.length() method was being used to calculate the length of named procedure inside makeExecuteProcedure. This method calculates length in terms of bytes. For example, length of "ZERO WIDTH SPACE" with unicode point U+200B will be computed as 3 which was causing certain assertion failure makeExecuteProcedure resulting in crash. But as far as parser and token's position concerns, we should really care of character position instead of bytes position.
This commit aims to fix this issue by fixing logic of calculating the length of named procedure by using getStartIndex() and getStopIndex() of the procedure token.
Task: BABEL-4961 Signed-off-by: Dipesh Dhameliya [email protected]
Check List
- [x] Commits are signed per the DCO using --signoff
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Pull Request Test Coverage Report for Build 9123019705
Details
- 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.006%) to 72.775%
| Totals | |
|---|---|
| Change from base Build 9111092279: | 0.006% |
| Covered Lines: | 41816 |
| Relevant Lines: | 57459 |