You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When performing path queries, the path is cast as bigint while the array of ids is cast as integer
Example query explain from our codebase:
WITH RECURSIVE traverse(parent_id, child_id, depth, PATH) AS
(SELECT first.parent_id,
first.child_id,
1 AS depth, ARRAY[first.parent_id] AS PATH
FROM flow_networks_networkedge AS FIRST
WHERE parent_id = 4269
UNION ALL SELECT first.parent_id,
first.child_id,
second.depth + 1 AS depth,
PATH || first.parent_id AS PATH
FROM flow_networks_networkedge AS FIRST,
traverse AS SECOND
WHERE first.parent_id = second.child_id
AND (first.parent_id <> ALL(second.path)) )
SELECT UNNEST(ARRAY[pkid]) AS pkid
FROM
(SELECT PATH || ARRAY[4215], depth
FROM traverse
WHERE child_id = 4215
AND depth <= 20
LIMIT 1) AS x(pkid);
Result:
ERROR: operator does not exist: bigint[] || integer[]
LINE 17: (SELECT PATH || ARRAY[4215], depth
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 657
The text was updated successfully, but these errors were encountered:
This is due to new Django versions allowing a default auto field of various types. In the past it was only an AutoField (::integer), but now the user can set it as a BigAutoField (::bigint), or UUIDField (::uuid).
When performing path queries, the path is cast as
bigint
while the array of ids is cast asinteger
Example query explain from our codebase:
Result:
The text was updated successfully, but these errors were encountered: