Skip to content

Commit 9b991c4

Browse files
committed
fix
1 parent 1c639cc commit 9b991c4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/common/jsonb/src/functions.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ pub fn parse_json_path(path: &[u8]) -> Result<Vec<JsonPath>, Error> {
816816
}
817817
let s = std::str::from_utf8(&path[prev_idx..idx - 2])?;
818818
let json_path = JsonPath::String(Cow::Borrowed(s));
819+
819820
json_paths.push(json_path);
820821
} else {
821822
prev_idx = idx - 1;
@@ -849,7 +850,7 @@ pub fn parse_json_path(path: &[u8]) -> Result<Vec<JsonPath>, Error> {
849850
} else if c != b'"' {
850851
idx += 1;
851852
} else {
852-
// Try to read to check if has another '"ab"', if has return err
853+
// Try to read to check if has extra strings, string value can only have one.
853854
let c = read_char(path, &mut idx);
854855
match c {
855856
Ok(_) => return Err(Error::InvalidToken),
@@ -859,7 +860,9 @@ pub fn parse_json_path(path: &[u8]) -> Result<Vec<JsonPath>, Error> {
859860
}
860861
let s = std::str::from_utf8(&path[prev_idx..idx - 1])?;
861862
let json_path = JsonPath::String(Cow::Borrowed(s));
862-
json_paths.push(json_path);
863+
if json_paths.len() == 0 {
864+
json_paths.push(json_path);
865+
}
863866
} else {
864867
if c == b':' || c == b'.' {
865868
if idx == 1 {

0 commit comments

Comments
 (0)