Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 5D5F9476098 for ; Wed, 29 May 2002 13:27:24 -0400 (EDT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by postgresql.org (Postfix) with ESMTP id 33DF0475D5F for ; Wed, 29 May 2002 13:23:57 -0400 (EDT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.9.3/8.9.3) with ESMTP id UAA06570; Wed, 29 May 2002 20:23:38 +0300 (GMT) Date: Wed, 29 May 2002 20:23:38 +0300 (GMT) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: achill@matrix.gatewaynet.com Cc: pgsql-sql@postgresql.org Subject: Re: contrib/tree issues In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200205/309 X-Sequence-Number: 7944 On Wed, 29 May 2002 achill@matrix.gatewaynet.com wrote: > > I have been playing with the tree package, and so far > it seems fast. > > But i have some questions: > > How can we find "maximum" direct child of a node? > > e.g. > The table has as: > > dynatree=# SELECT node from achtree ; > node > ------- > 1 > 2 > 1.1 > 1.1.1 > 1.2 > (5 rows) > > dynatree=# > > Now we find the children of '1' of level 2: > > dynatree=# SELECT node from achtree where node <* '1.*.0'; > node > ------ > 1.1 > 1.2 > (2 rows) > > dynatree=# > > Now if we want to insert another level 2 child of '1', > how can we get the current maximum value of level 2 children of node '1'?? > (in this case 2), so that we can insert '1.3' to the table??? Just use functions entree_next(entree), bitree_next(bitree) - return next free node. > > Also, i want to ask if somebody has extended postgresql's jdbc > implemantation to include support for bitrees,entrees. > > One maybe slow solution for both of the above would be to > be able to cast e.g. entree to text, so that > > a) taking the lexicographically maximum bitree value would give the > maximum current child, and > b) java intergration would be trivial through java.lang.String. > > Thanx > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83