SQL query - Mailing list pgsql-general

From Vikas Sharma
Subject SQL query
Date
Msg-id CAN6gwKw9jDGk-kiuA21fW=L3HDk7ns7t6FW8XxOaJSDcGgqRFg@mail.gmail.com
Whole thread Raw
Responses SQL query  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: SQL query  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: SQL query  (Ron <ronljohnsonjr@gmail.com>)
Re: SQL query  ("Ravi Krishna" <srkrishna@myself.com>)
List pgsql-general
Hi, 

I have come across a query that a developer wrote to update a few rows in table, the query did update the two desired rows but also updated the rest of the table with the column value as 'false'.

Update tableA set col1 = null and col2 in (1,2);

The query updated col1 to null for the rows where col2 was either 1 or 2, rest of rows were also updated for col1 to 'false'.
 The above was run without where clause.
Could the experts throw some light on this?

Regards
Vikas Sharma

pgsql-general by date:

Previous
From: Michael Lewis
Date:
Subject: Re: Method to pass data between queries in a multi-statement transaction
Next
From: "David G. Johnston"
Date:
Subject: SQL query