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.