-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
text: string_part
smushes repeated separator instances
#19
Comments
After reading the documentation for
sqlite> select split_part('one/two\three', '/\', 2);
two By "possibly expected", I mean that I expect this: sqlite> select split_part('one/\two/\three', '/\', 2);
two Still, it's really surprising behavior. If it is expected behavior, would it be possible to add a If it is not expected behavior, ... well, I'm trying to trace |
As best I can tell, The following patch works for me upon testing, but I haven't tested for any bugs: diff --git a/src/sqlite3-text.c b/src/sqlite3-text.c
index 25bacfb..25f5538 100644
--- a/src/sqlite3-text.c
+++ b/src/sqlite3-text.c
@@ -163,9 +163,6 @@ static char *split_part(char *source, const char *sep, int64_t part) {
char *token;
int64_t index = 1;
while ((token = str_sep(&source, sep)) != NULL) {
- if (strcmp(token, "") == 0) {
- continue;
- }
if (index == part) {
break;
} |
After some more use, still no bugs with the above patch. I'm comfortable with the new behavior of PR forthcoming eventually. |
Thank you very much for this investigation! I agree - squashing multiple separators into one is unexpected behavior. I've applied your patch, don't see a real need for the separate function. |
The text was updated successfully, but these errors were encountered: