ancestors error
Closed this issue · 2 comments
getong commented
My table is in other schema, let's say "network", not the public.
the ancestors function output:
SELECT u0."id", u0."name", u0."superior_id" FROM "network"."user" AS u0 INNER JOIN (
WITH RECURSIVE user_tree AS (
SELECT id,
superior_id,
0 AS depth
FROM user
WHERE id = 4
UNION ALL
SELECT user.id,
user.superior_id,
user_tree.depth + 1
FROM user
JOIN user_tree
ON user_tree.superior_id = user.id
)
SELECT *
FROM user_tree
)
AS f1 ON u0."id" = f1."superior_id"
but the sql should be:
SELECT u0."id", u0."name", u0."superior_id" FROM "network"."user" AS u0 INNER JOIN (
WITH RECURSIVE user_tree AS (
SELECT id,
superior_id,
0 AS depth
FROM "network".user
WHERE id = 4
UNION ALL
SELECT id,
superior_id,
user_tree.depth + 1
FROM user
JOIN user_tree
ON user_tree.superior_id = id
)
SELECT *
FROM user_tree
)
AS f1 ON u0."id" = f1."superior_id"
But I don't know how to add the schema name to the table.
coryodaniel commented
This may be related to: #23
coryodaniel commented
I can't reproduce this, can you make a minimal example in a github that does and share it?