John,

> Yeah, I figured out my SQL was bad and had switched to the comma
> separated version, instead. In my mind, the first form should have
> caused an error. I've attached a cut-and-pasted session from psql where
> I used this syntax on a test table. While edited for brevity and to
> obscure passwords, this is how the output appeared.

Here's your problem:

accounting=# update all_user set usr_current = True AND usr_location = 1002;
UPDATE 3

PostgreSQL interpreted the expression "True AND usr_location = 1002" as a 
single, unitary, boolean expression.   AND is the boolean AND operator.  
Since none of the users on your list had "usr_location = 1002", you got:

user_current = (True AND (usr_location = 1002))
user_current = (True AND False)
user_current = False

Since all 3 rows already had false, they did not appear to get updated, but in 
fact they were.

Time to look up your order of operations!

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to