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.
What is the reason for changing delimiter?
>
> 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.
It's good.
>
> 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 )
It seems to me that it's mistake. ISALNUM shoud define correct character in
name of node (level). Try to test
with incorrect ltree value 'a..b'.
--
Teodor Sigaev
teodor@stack.net