pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
contrib/tree issues
5+ messages / 3 participants
[nested] [flat]

* contrib/tree issues
@ 2002-05-29 16:35 achill@matrix.gatewaynet.com
  2002-05-29 17:23 ` Re: contrib/tree issues Oleg Bartunov <oleg@sai.msu.su>
  0 siblings, 1 reply; 5+ messages in thread

From: achill@matrix.gatewaynet.com @ 2002-05-29 16:35 UTC (permalink / raw)
  To: pgsql-sql


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???

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: contrib/tree issues
  2002-05-29 16:35 contrib/tree issues achill@matrix.gatewaynet.com
@ 2002-05-29 17:23 ` Oleg Bartunov <oleg@sai.msu.su>
  2002-05-29 17:33   ` Re: contrib/tree issues Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2002-05-29 17:38   ` Re: contrib/tree issues Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Oleg Bartunov @ 2002-05-29 17:23 UTC (permalink / raw)
  To: achill@matrix.gatewaynet.com; +Cc: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: contrib/tree issues
  2002-05-29 16:35 contrib/tree issues achill@matrix.gatewaynet.com
  2002-05-29 17:23 ` Re: contrib/tree issues Oleg Bartunov <oleg@sai.msu.su>
@ 2002-05-29 17:33   ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2002-05-29 20:06     ` Re: contrib/tree issues Oleg Bartunov <oleg@sai.msu.su>
  1 sibling, 1 reply; 5+ messages in thread

From: Achilleus Mantzios @ 2002-05-29 17:33 UTC (permalink / raw)
  To: Oleg Bartunov <oleg@sai.msu.su>; +Cc: pgsql-sql

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
  ^
??

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
> 

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  achill@matrix.gatewaynet.com
        mantzios@softlab.ece.ntua.gr




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: contrib/tree issues
  2002-05-29 16:35 contrib/tree issues achill@matrix.gatewaynet.com
  2002-05-29 17:23 ` Re: contrib/tree issues Oleg Bartunov <oleg@sai.msu.su>
  2002-05-29 17:33   ` Re: contrib/tree issues Achilleus Mantzios <achill@matrix.gatewaynet.com>
@ 2002-05-29 20:06     ` Oleg Bartunov <oleg@sai.msu.su>
  0 siblings, 0 replies; 5+ messages in thread

From: Oleg Bartunov @ 2002-05-29 20:06 UTC (permalink / raw)
  To: Achilleus Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: contrib/tree issues
  2002-05-29 16:35 contrib/tree issues achill@matrix.gatewaynet.com
  2002-05-29 17:23 ` Re: contrib/tree issues Oleg Bartunov <oleg@sai.msu.su>
@ 2002-05-29 17:38   ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Achilleus Mantzios @ 2002-05-29 17:38 UTC (permalink / raw)
  To: Oleg Bartunov <oleg@sai.msu.su>; +Cc: pgsql-sql


Also Oleg,
i would like to ask you for the casting problem.

It seems that entree doesn't cast but only to entree!!
(The same applies to bitrees).

How can someone interface entree's from outside sql,pg/plsql??
(C functions returning text for example, java etc).

Your help is really valuable.

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  achill@matrix.gatewaynet.com
        mantzios@softlab.ece.ntua.gr




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2002-05-29 20:06 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-05-29 16:35 contrib/tree issues achill@matrix.gatewaynet.com
2002-05-29 17:23 ` Oleg Bartunov <oleg@sai.msu.su>
2002-05-29 17:33   ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2002-05-29 20:06     ` Oleg Bartunov <oleg@sai.msu.su>
2002-05-29 17:38   ` Achilleus Mantzios <achill@matrix.gatewaynet.com>

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