It is possible in pg that I can see if this query can return true or false that I know If the query executed successfully or not :
const TrueOrFalse = await db.query('INSERT INTO users (email,password) VALUES ($1, $2);', [email, password]);
This is from the documentation:
try {
const res = await client.query(text, values)
console.log(res.rows[0])
// { name: 'brianc', email: 'brian.m.carlson@gmail.com' }
} catch (err) {
console.log(err.stack)
}
So yes, it succeeded if it didn't throw an exception.