ltree
如何从Postgres 表中删除特定标签?我有桌子吗?
测试表:
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);
我想将 a 传递userid
给查询,以将其从path
表中的每一个中删除。例如,如果我通过101
,123.101.103
则应更新为123.103
.
是否可以直接执行此操作?还是应该path
使用路径替换功能进行更新?
我从 PHP 中尝试了以下选择查询,但它返回以下错误。相同的查询在 phpPgAdmin 中正常工作!?
询问:
$selectPathq=pg_query($con,"select path from myschema.test where path @ '101'")
or die('could not connect: '. pg_last_error($con));
错误:
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.