Edges
Table Structure:
id | from_node | to_node
Performing the operation:
node.id = 1
await getManager().delete(Edge, [{ from_node: node.id }, { to_node: node.id }]);
Generates the following query:
DELETE FROM "edges" WHERE (("from_node" = $1 AND "to_node" = $2) OR ("from_node" = $3 AND "to_node" = $4)) -- PARAMETERS: [1,null,null,1]
However, the desired query is:
query: DELETE FROM "edges" WHERE ("from_node" = $1) OR ("to_node" = $2) -- PARAMETERS: [1,1]
The issue of the additional AND
clause in the resulting query is puzzling.
In contrast, the following code functions correctly:
getManager()
.createQueryBuilder()
.delete()
.from(Edge)
.where([{ from_node: node.id }, { to_node: node.id }])
.execute();
Could someone offer an explanation for the discrepancy between the actual and intended outcomes of the getManager().delete
operation?
Database: Postgres
Typeorm version: latest (0.2.24)