pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oleg Bartunov <oleg@sai.msu.su>
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: contrib/tree issues
Date: Wed, 29 May 2002 23:06:28 +0300 (GMT)
Message-ID: <Pine.GSO.4.44.0205292303370.4042-100000@ra.sai.msu.su> (raw)
In-Reply-To: <Pine.LNX.4.44.0205292029230.18431-100000@matrix.gatewaynet.com>

On Wed, 29 May 2002, Achilleus Mantzios wrote:

> On Wed, 29 May 2002, Oleg Bartunov wrote:
>
> > > How can we find  "maximum" direct child of a node?
> > >
> > > 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.
>
> Ok, entree_next(1.2) is fine, but how can we know this particular
> 1.2
>   ^
> ??


tree=# select * from tree where node <* '1.*.0';
 node
------
 1.1
 1.2
(2 rows)

tree=# select entree_next(node) from tree where node <* '1.*.0' order by node desc limit 1;
 entree_next
-------------
 1.3
(1 row)



>
> Think of a sequence for example that increments itself.
>
> Now, if we have a unique index on a entree column, how can we guarantie
> the next one will be the previous max child + 1??
>
> >
> >
> >
> >
> > >
> > > 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
> >
>
>

	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




view thread (5+ messages)

Message-ID: <Pine.GSO.4.44.0205292303370.4042-100000@ra.sai.msu.su>
Permalink:  ../Pine.GSO.4.44.0205292303370.4042-100000@ra.sai.msu.su/
Also on:    postgresql.org/message-id/Pine.GSO.4.44.0205292303370.4042-100000@ra.sai.msu.su

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: oleg@sai.msu.su, achill@matrix.gatewaynet.com
  Subject: Re: contrib/tree issues
  In-Reply-To: <Pine.GSO.4.44.0205292303370.4042-100000@ra.sai.msu.su>
  References: <Pine.LNX.4.44.0205292029230.18431-100000@matrix.gatewaynet.com> <Pine.GSO.4.44.0205292303370.4042-100000@ra.sai.msu.su>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox