Skip to content

Commit 3515af3

Browse files
committed
refactor: replacement on ltree_text isnt needed
1 parent fd41c66 commit 3515af3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/query/children.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule Hierarch.Query.Children do
1414

1515
uuids_query =
1616
from t in queryable,
17-
select: %{__ancestry__: fragment("text2ltree(replace(ltree2text(?), '-', '_')) || replace(text(?), '-', '_')", field(t, ^path_column), field(t, ^pk_column))}
17+
select: %{__ancestry__: fragment("? || replace(text(?), '-', '_')", field(t, ^path_column), field(t, ^pk_column))}
1818

1919
uuids_array_query =
2020
from t in subquery(uuids_query),

lib/query/descendants.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule Hierarch.Query.Descendants do
1414

1515
uuids_query =
1616
from t in queryable,
17-
select: %{__ancestry__: fragment("text2ltree(replace(ltree2text(?), '-', '_')) || replace(text(?), '-', '_')", field(t, ^path_column), field(t, ^pk_column))}
17+
select: %{__ancestry__: fragment("? || replace(text(?), '-', '_')", field(t, ^path_column), field(t, ^pk_column))}
1818

1919
uuids_array_query =
2020
from t in subquery(uuids_query),

0 commit comments

Comments
 (0)