Thanks for asking.  I have been diverted to other tasks and won't be 
able to get back to this for a short while.  The basics work (i.e. 
population and simple compares) but I know for sure that certain 
functions will not work now that we allow what were previously 
operators to be part of the node name.  In short, the code needs to 
allow for operators to be escaped if they are part of the node name.

On 5 Dec 2002 at 0:54, Bruce Momjian wrote:

> 
> Dan, is this ready to be applied to CVS?
> 
> ----------------------------------------------------------------------
> -----
> 
> Dan Langille wrote:
> > I have been looking at contrib/ltree in the PostgreSQL repository. 
> > I've modified the code to allow / as a node delimiter instead of .
> > which is the default.
> > 
> > Below are the patches to make this change.  I have also moved the
> > delimiter to a DEFINE so that other customizations are easily done. 
> > This is a work in progress.
> > 
> > My thanks to DarbyD for assistance.
> > 
> > cheers
> > 
> > 
> > --- ltree.h.orig    Tue Nov 26 18:57:58 2002
> > +++ ltree.h Tue Nov 26 20:16:40 2002
> > @@ -6,6 +6,8 @@
> >  #include "utils/palloc.h"
> >  #include "utils/builtins.h"
> > 
> > +#define    NODE_DELIMITER  '/'
> > +
> >  typedef struct
> >  {
> >     uint8           len;
> > @@ -88,7 +90,7 @@
> >  #ifndef abs
> >  #define abs(a)                                     ((a) <  (0) ? -(a) : (a))
> >  #endif
> > -#define ISALNUM(x) ( isalnum((unsigned int)(x)) || (x) == '_' )
> > +#define ISALNUM(x) ( isalnum((unsigned int)(x)) || (x) == '_' ||
> > +#(x) == NODE_DELIMITER )
> > 
> >  /* full text query */
> > 
> > --- ltree_io.c      Tue Nov 26 20:23:45 2002
> > +++ ltree_io.c.orig Tue Nov 26 18:57:26 2002
> > @@ -48,7 +48,7 @@
> >     ptr = buf;
> >     while (*ptr)
> >     {
> > -           if (*ptr == NODE_DELIMITER)
> > +           if (*ptr == '.')
> >                     num++;
> >             ptr++;
> >     }
> > @@ -69,7 +69,7 @@
> >             }
> >             else if (state == LTPRS_WAITDELIM)
> >             {
> > -                   if (*ptr == NODE_DELIMITER)
> > +                   if (*ptr == '.')
> >                     {
> >                             lptr->len = ptr - lptr->start;
> >                             if (lptr->len > 255)
> > @@ -131,7 +131,7 @@
> >     {
> >             if (i != 0)
> >             {
> > -                   *ptr = NODE_DELIMITER;
> > +                   *ptr = '.';
> >                     ptr++;
> >             }
> >             memcpy(ptr, curlevel->name, curlevel->len);
> > @@ -181,7 +181,7 @@
> >     ptr = buf;
> >     while (*ptr)
> >     {
> > -           if (*ptr == NODE_DELIMITER)
> > +           if (*ptr == '.')
> >                     num++;
> >             else if (*ptr == '|')
> >                     numOR++;
> > @@ -265,7 +265,7 @@
> >                                              lptr->len, (int) (lptr->start - buf));
> >                             state = LQPRS_WAITVAR;
> >                     }
> > -                   else if (*ptr == NODE_DELIMITER)
> > +                   else if (*ptr == '.')
> >                     {
> >                             lptr->len = ptr - lptr->start -
> >                                     ((lptr->flag & LVAR_SUBLEXEM) ? 1 : 0) -
> > @@ -289,7 +289,7 @@
> >             {
> >                     if (*ptr == '{')
> >                             state = LQPRS_WAITFNUM;
> > -                   else if (*ptr == NODE_DELIMITER)
> > +                   else if (*ptr == '.')
> >                     {
> >                             curqlevel->low = 0;
> >                             curqlevel->high = 0xffff;
> > @@ -347,7 +347,7 @@
> >             }
> >             else if (state == LQPRS_WAITEND)
> >             {
> > -                   if (*ptr == NODE_DELIMITER)
> > +                   if (*ptr == '.')
> >                     {
> >                             state = LQPRS_WAITLEVEL;
> >                             curqlevel = NEXTLEV(curqlevel);
> > @@ -471,7 +471,7 @@
> >     {
> >             if (i != 0)
> >             {
> > -                   *ptr = NODE_DELIMITER;
> > +                   *ptr = '.';
> >                     ptr++;
> >             }
> >             if (curqlevel->numvar)
> > 
> > 
> > ---------------------------(end of
> > broadcast)--------------------------- TIP 4: Don't 'kill -9' the
> > postmaster
> > 
> 
> -- 
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   [EMAIL PROTECTED]               |  (610) 359-1001 +  If your
>   life is a hard drive,     |  13 Roberts Road +  Christ can be your
>   backup.        |  Newtown Square, Pennsylvania 19073
> 


-- 
Dan Langille : http://www.langille.org/


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to