Which type do I have to use for this ltree query?

Viewed 113

I have a LTREE Field, called house_path, this query works for me:

WHERE house_path ~ '*.35.*';

However this query doesn't work for me:

WHERE house_path ~ '*.35.*'::text;

-> operator does not exist: ltree ~ text

Which type has the second argument to have? So that it works? I'm asking because I would like to write a function where I can pass the second argument as variable. And I don't know what type the second variable should be.

1 Answers

Use lquery type.

WHERE house_path ~ '*.35.*'::lquery;
Related