PG: toPathForJson complex path
Author: jbnoblotCreated Aug 27, 2026Updated Aug 27, 2026
Hello,
I think i find a bug in toPathForJson for pg dialect cause in my code i try to
this.knexConn.jsonSet("status", "$.object1.object2.object3.property", 2);
but result in my jsonb column after update i don't have
object1: {
object2: {
object3: {
property: 2
}
}
}BUT
object1: {
object2: {
object3: {
property: 0
}
}
"object2.object3.property": 2
}AFTER look in code i think this line is an error
in js doc:
If pattern is a string, only the first occurrence will be replaced.
so maybe use a regex like
.replace(/\./g, ',')
thanks a lot for your amazing library
Source: knex/knex