Search if a value exists in postgresql ltree

212 Views Asked by At

I am trying to check if a particular value exists in a list of ltree column. For example path column contains values {1.2.270, 1.270.3, 1.302.270.70}. I am trying to find if the value 270 exists in any of these 3 paths. But it is not working if I am using IN or ANY keywords.

1

There are 1 best solutions below

0
Alex Bran On BEST ANSWER

Use documentation

SELECT '{1.2.270, 1.270.3, 1.302.270.70}'::ltree[] ~ lquery('*.270.*')