我有PostgreSQL的ltree擴展9.6.5 我有一個名爲具有以下DDL類別表(我簡化了一點)一個問題: CREATE TABLE dictionary.category
(
id serial not null constraint category_pkey primary key,
name text not null,
parent_id integer
我有以下查詢,並且正在使用postgres插件ltree。我試圖做一些概念上類似於沿着你可以想象的樹的y軸切割樹的方法。 我可以很容易地用下面的查詢實現這個目標: testdb2=# SELECT * FROM test WHERE yaxis >= 3 ORDER BY yaxis;
path | yaxis | leaf
------------------------