Skip to content
Advertisement

How to check if a node is repeated in a ltree – PostgreSQL

How to check if a node is repeated (exits more than one) in a ltree?

Something like this:

Advertisement

Answer

Convert it to a string, split that into a table and check if there are duplicate entries:

A better option may be a smart regular expression, based on your comment:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement