From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | "John B(dot) Scalia" <jscalia(at)cityblueprinting(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Bug in psql - Postgresql 7.3.1? |
Date: | 2003-10-03 20:16:10 |
Message-ID: | 200310031315.52146.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-10-03 20:27:12 | Re: Bug in psql - Postgresql 7.3.1? |
Previous Message | Bruno Wolff III | 2003-10-03 19:47:16 | Re: Bug in psql - Postgresql 7.3.1? |