INSERT INTO nodes (name, address, status)
SELECT $1, $2, $3
WHERE NOT EXISTS (
    SELECT 1 FROM nodes WHERE id = $4
)
RETURNING id;