Why is this query deleting all users when the user_id
column does not exist at the profile
table?
The initial query:
DELETE FROM users
WHERE user_id IN (
SELECT user_id FROM profile
)
AND user_id != 35
AND user_id != 6;
To be more specific.
The IN statement query returns:
SELECT user_id FROM profile;
ERROR: column "user_id" does not exist
LINE 1: SELECT user_id FROM profile;
Running the initial query returns
DELETE 100
Why is that happening?
Shouldn't it have stopped the execution upon error or return false or null?
Running PostgreSQL Server 9.0