title: How to delete a particular label from ltree in Postgres table?
body: <p>How to delete a particular label from <code>ltree</code> in Postgres table? I have a table?</p>
  <p>Test table:</p>
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE tbl (sno int, path ltree, userid int);
  
  INSERT INTO tbl (sno, path, userid)
  VALUES
    (1, '123',             123)
  , (2, '123.101',         123)
  , (3, '123.101.103',     123)
  , (4, '123.101.103.105', 123)
  , (5, '123.101.103.107', 123)
  , (6, '123.102.104.106', 123)
  , (7, '123.102.104.108', 123)
  , (8, '123.102.104',     123)
  , (9, '123.102',         123);
  </code></pre>
  <p>I want to pass a <code>userid</code> to a query, to remove it from every <code>path</code> in the table. For example, if I pass <code>101</code>, then <code>123.101.103</code> should update as <code>123.103</code>.</p>
  <p>Is it possible to do this directly? Or shall I update <code>path</code> using path replace functions?</p>
  <p>I tried the following select query from PHP, but it returns the error below. The same query works properly in phpPgAdmin!?</p>
  <p>Query:</p>
  <pre><code>$selectPathq=pg_query($con,&quot;select path from myschema.test where path @ '101'&quot;)
               or die('could not connect: '. pg_last_error($con));
  </code></pre>
  <p>Error:</p>
  <blockquote>
  <pre><code>could not connect:
  ERROR: operator does not exist: myschema.ltree @ unknown at character 63
  HINT: No operator matches the given name and argument type(s).
        You might need to add explicit type casts.
  </code></pre>
  </blockquote>