On Jul 12, 2025, at 00:07, Florents Tselai <florents.tse...@gmail.com> wrote:

> To recap so far; 
> 
> - I like your changes and renames on the parser/lexer; it indeed looks much 
> cleaner now and will help with future improvements.

Thanks!

> - I also like the addition of executeStringInternalMethod ; it'll help us add 
> more stuff in the future (reminder that for the original patch I implemented 
> the methods I'd like more, but string operations are quite more).

Agreed.

> - AFAICT no test cases / results have changed with your versions; is this 
> correct ?

I made some minor changes, notably to test alternate trim values and a negative 
position passed to split_part():

```patch
--- a/src/test/regress/sql/jsonb_jsonpath.sql
+++ b/src/test/regress/sql/jsonb_jsonpath.sql
@@ -627,7 +627,7 @@ rollback;
 select jsonb_path_query('"   hello   "', '$.ltrim(" ")');
 select jsonb_path_query('"   hello   "', '$.ltrim(" ")');
 select jsonb_path_query('"   hello   "', '$.ltrim()');
-select jsonb_path_query('"   hello   "', '$.ltrim()');
+select jsonb_path_query('"zzzytest"', '$.ltrim("xyz")');
 select jsonb_path_query('null', '$.ltrim()');
 select jsonb_path_query('null', '$.ltrim()', silent => true);
 select jsonb_path_query('[]', '$.ltrim()');
@@ -647,13 +647,13 @@ select jsonb_path_query_array('["  maybe  ", "  yes", "  
no"]', '$[*].ltrim().ty
   -- test .rtrim()
 select jsonb_path_query('"   hello   "', '$.rtrim(" ")');
-select jsonb_path_query('"   hello   "', '$.rtrim(" ")');
+select jsonb_path_query('"testxxzx"', '$.rtrim("xyz")');
 select jsonb_path_query('"   hello   "', '$.rtrim()');
 select jsonb_path_query('"   hello   "', '$.rtrim()');
   -- test .btrim()
 select jsonb_path_query('"   hello   "', '$.btrim(" ")');
-select jsonb_path_query('"   hello   "', '$.btrim(" ")');
+select jsonb_path_query('"xyxtrimyyx"', '$.btrim("xyz")');
 select jsonb_path_query('"   hello   "', '$.btrim()');
 select jsonb_path_query('"   hello   "', '$.btrim()');
  @@ -723,6 +723,7 @@ select jsonb_path_query('"hello world"', 
'$.replace("hello","bye") starts with "
   -- Test .split_part()
 select jsonb_path_query('"abc~@~def~@~ghi"', '$.split_part("~@~", 2)');
+select jsonb_path_query('"abc,def,ghi,jkl"', '$.split_part(",", -2)');
   -- Test string methods play nicely together
 select jsonb_path_query('"hello world"', '$.replace("hello","bye").upper()');
```

Best,

David

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to