Skip to content

Commit

Permalink
Fix insert-relation query.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jun 26, 2022
1 parent 0ec28fc commit ff6bc0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ WITH w AS (
SELECT MAX(weight) + 1 AS weight FROM relations WHERE $6=0 AND from_id=$1
)
INSERT INTO relations (from_id, to_id, types, tags, notes, weight, status)
VALUES($1, $2, $3, $4, $5, COALESCE((SELECT weight FROM w), $6), $7);
VALUES($1, $2, $3, $4, $5, COALESCE((SELECT weight FROM w), $6), $7) RETURNING id;

-- name: reorder-relations
-- Updates the weights from 1 to N given ordered relation IDs in an array.
Expand Down

0 comments on commit ff6bc0e

Please sign in to comment.