coalesce не работает
Пытаюсь обновить пользователя:
const queryForUpdatePerson = `
UPDATE person
SET user_name=COALESCE($1, person.user_name),
full_name=COALESCE($2, person.full_name),
email=COALESCE($3, person.email),
password=COALESCE($4, person.password),
avatar=COALESCE($5, person.avatar),
description=COALESCE($6, person.description)
WHERE id = $7 RETURNING *
`;
const updatePerson = db.query(queryForUpdatePerson, [userName, fullName, email, password, avatar, description, id]);
Данные приходят такие:
{
id: -1,
user_name: 'alexey',
full_name: null,
email: null,
avatar: null,
description: null,
password: null,
oldPassword: null,
newPassword: null,
roles: [ '' ]
}
По этим данным должно измениться только имя, а все остальное остаться старым, но ничего не изменяется и остается старым