Here are my configurations:
DB type: postgresql
(9.3 if that's necessary)
Table name: product_sections
Column names: section_id (integer)
& section_path (ltree)
Detail:
I have one reference value: section_id: 15
& section_path: Automation_Solutionz
. So, when I want to rename Automation_Solutionz
to, say Chrome
, I want all references of Automation_Solutionz
to be updated.
FROM:
Automation_Solutionz
Automation_Solutionz.Test_Case_Creation
Automation_Solutionz.Test_Case_Creation.Automation
Automation_Solutionz.Test_Case_Creation.Manual
TO:
Chrome
Chrome.Test_Case_Creation
Chrome.Test_Case_Creation.Automation
Chrome.Test_Case_Creation.Manual
Similarly, when I update a value which is in the middle, it should rename those too. In the case above, Test_Case_Creation
should be renamed to something like TestCase
or anything else. The same goes for any item which is either in the middle, end or at the start.
Hope, I explained things correctly. Thanks in advance :)
text
, do a replace and then cast back toltree
? LikeSELECT replace('a.b.c'::ltree::text, 'b', 'd')::ltree;
Test_Case_Create.Case
. When you replaceCase
with something else, the row will have the value:Test_X_Create.X
which is not what I want. I want it to becomeTest_Case_Create.X
x.y.x.z
ltree it does not make much sense to replace bothx
. Typically you'd want to replace a subpath anchored at left by another subpath, for examplex.y.x.*
byx.y.t.*
(as opposed tox
byt
)x.y.x.z
tree. Its just that, one label i.ex
maybe inside of the word (or more specifically a label)y