summaryrefslogtreecommitdiff
path: root/contrib/ltree/ltree_op.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ltree/ltree_op.c')
-rw-r--r--contrib/ltree/ltree_op.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/contrib/ltree/ltree_op.c b/contrib/ltree/ltree_op.c
index ce9f4caad4f..e3a84db37ff 100644
--- a/contrib/ltree/ltree_op.c
+++ b/contrib/ltree/ltree_op.c
@@ -316,23 +316,15 @@ subpath(PG_FUNCTION_ARGS)
int32 end;
ltree *res;
- end = start + len;
-
- if (start < 0)
- {
- start = t->numlevel + start;
- end = start + len;
- }
if (start < 0)
- { /* start > t->numlevel */
start = t->numlevel + start;
- end = start + len;
- }
if (len < 0)
end = t->numlevel + len;
else if (len == 0)
- end = (fcinfo->nargs == 3) ? start : 0xffff;
+ end = (fcinfo->nargs == 3) ? start : LTREE_MAX_LEVELS;
+ else
+ end = start + len;
res = inner_subltree(t, start, end);