Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Dimitri Fontaine Newsgroups: comp.databases.postgresql Subject: Re: Postgres 9.6 - ltree extension - (re)build a tree on a table Date: Tue, 17 Apr 2018 23:31:00 +0200 Organization: A noiseless patient Spider Lines: 11 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="881920d662254fbbfce1ccb4db5a1998"; logging-data="22755"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hSpWQXVdOXtc97zhcndZa" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (darwin) Cancel-Lock: sha1:X370/1r2FObbOBXLFAtK279O+NE= sha1:ijwbWVKd/hoiDSAhc+6SCFfCtZI= Xref: csiph.com comp.databases.postgresql:822 lordluke80@gmail.com writes: > Any suggestion to achieve that or snippets about how to do that? havent foud any valid example for 'rebuild a tree in postgres' in the official docs. Have a look at WITH RECURSIVE: https://www.postgresql.org/docs/current/static/queries-with.html https://tapoueh.org/blog/2018/01/exporting-a-hierarchy-in-json-with-recursive-queries/ Regards, -- Dimitri Fontaine