Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHBJJ-00066X-U4 for pgsql-general@arkaria.postgresql.org; Thu, 18 Apr 2019 17:58:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hHBJI-0000dz-A6 for pgsql-general@arkaria.postgresql.org; Thu, 18 Apr 2019 17:58:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHBJH-0000cY-SK for pgsql-general@lists.postgresql.org; Thu, 18 Apr 2019 17:58:55 +0000 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHBJF-0008Kt-NI for pgsql-general@lists.postgresql.org; Thu, 18 Apr 2019 17:58:55 +0000 Received: by mail-oi1-x22b.google.com with SMTP id v10so2293151oib.1 for ; Thu, 18 Apr 2019 10:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=TtHJmPc4NBcmBHqa03V+lYo0yAQS7hYvI1SFDgDnJ0U=; b=Nm2gSZk1o6uFG7RnTmrlZGQyOsheoyKmr5GN6X3jqjPqGzsjN1eHaV+MrbH2I/tRhA obJFbWG3zly++awSBzWDBDaT2GHvdrR3NHq8RjQ/W7VyiRSPA7PSD1ZjWBmGT+2SYApV i5Kkt6wvK8wiP9m6xyoqK79L9ZsZKR0vdhS4rJZbEI0lnB9bTaoSXMFrd9kEaWAfmniQ NmXawED7GfcHtF+8rt8mGJxmZ4TJ2kmQvw/TBndtu1483SIbmBXO36ScTSjhVqBIXirv WdzBhLaGB6YGccz7u7egtMDgqs+kZIkDsUpUO0MitcO7htASuggTU67aCCyUKtjTVWpx 6GYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=TtHJmPc4NBcmBHqa03V+lYo0yAQS7hYvI1SFDgDnJ0U=; b=EO43j0qiw7CFHB5BBdB++3xoysWkkgxuqkW93bfpYgL7BDYp+4ep/sQr4/tPA0+vRl RWm9R1vbDTq5FzAXjcnWwlSzLIeYXpJhtSdJK4k9dRp6fdrUCeeYi+zNLIg2zrc1cRDP +60GD2twzZ1Md/iJP2+dJF+rZqk5fmyZToJjJ9s8jhIg4S0Xgu00v3dOBK8JZTO2Rnvh SOHjKliy7RtSCcFqjtKonAGjbj1VNOUpxpV095UZBGuzoAV16IxSKmw3H0lEPJ0dSrr6 o9mKMfGn0ZS6ZahFNKLfQFPLTQEuxpA7zt5y88I6+3nqP7R4PoxcFWMCP3Ya0OfY5BZF mGIQ== X-Gm-Message-State: APjAAAU3BQMeWiABF88RYAzuYgSD+6X23j3PhqyBml0HxT+hukX910kO /TgO3S2ML/8lT5ECT5YndFqrVuwGVno= X-Google-Smtp-Source: APXvYqxHvPxpyez2PMQCW5K/n9n8igf5zgJsAFTTxUadZTdrcFUfP2V9X1pkIHlV3EG9cfa0XgcW4Q== X-Received: by 2002:aca:4dc2:: with SMTP id a185mr2977703oib.167.1555610330468; Thu, 18 Apr 2019 10:58:50 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id q82sm1142464oif.28.2019.04.18.10.58.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 10:58:49 -0700 (PDT) Subject: Re: SQL query To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <771509b6-9002-99c5-8e23-8e4164bc8c4a@gmail.com> Date: Thu, 18 Apr 2019 12:58:49 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/18/19 11:43 AM, Vikas Sharma wrote: > 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. On the QA server, right? -- Angular momentum makes the world go 'round.