Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHhmy-00ADeM-K3 for pgsql-general@arkaria.postgresql.org; Thu, 13 Jun 2024 10:34:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sHhmu-00GxRr-CQ for pgsql-general@arkaria.postgresql.org; Thu, 13 Jun 2024 10:34:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHhmt-00GxRh-Lx for pgsql-general@lists.postgresql.org; Thu, 13 Jun 2024 10:34:36 +0000 Received: from fhigh3-smtp.messagingengine.com ([103.168.172.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHhmn-0016fY-EI for pgsql-general@lists.postgresql.org; Thu, 13 Jun 2024 10:34:35 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 25EE31140148; Thu, 13 Jun 2024 06:34:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 13 Jun 2024 06:34:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718274868; x= 1718361268; bh=SLB7aAjwPfiQnn6MPYh1e4IWM7O6sc+N25VdHVyodQg=; b=i Fc1n3DX4Q2/FGJ12AxjNB4fGg05Y0E91tKn1n8kQk6/2IYhnUM6cLvHPN4PsmyKz mBmiHZu2ff8SeM43vPwhczyKFoNYc495XudZJswCCEYam4z9gR3UbGCPLXcMxfK+ 2b28qdgv0ykC1hR92ZbU6SThia245UNjE5NBwwnfOEH+/J4Ii56xRDcnR6s2VL1K VIiigOE51Qc86QNrD7+mlNNrHlyYjDGNzWjizwYj3bSn13fBGnR6FRmslyy9KF3X Ilqz80FA1NPjNIhj4tA2G/1bqB5r2JCGbRin/28pGN6rwhSw9JKUZxYB4mewihwZ 5ITwYCAq2tOs+UqmZNRgQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedujedgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jun 2024 06:34:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1718274865; bh=a+g83hnkYjFNDegJlJnbHdYQ8ICbAz0lOFSEwYGByN8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=NEp0Co+wbwaZSqlp+TxmxmicyX5kgdoqFpAOyGBH9eiNPTYAaNiksSuf9SbTZh3QQ wx3diE/Fc1+habYuQqvQOBLycTvd7ATMLTDjeEmgS98Fx6LPMytgc+93XHiL4mm7vF TS/s/Izbub4dgOS0K3ULfgpjRnNtw0R+NPov4Ql4MSb3uYO1tI7lAFSFHMvotit7kd tbJ8fsggplfo98f/QlN5lmlDwrdzF27341A32GVI5xQV5xbmNA2YkjMctzdzyucSk4 e0lPz/8gTdUjXRTvlv1jCr38/HM3XdMsYnGl5QBX33ubJLXY3WSbZFTuJZKb7RdgAF tcCr45TpXcHmQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 877AE527; Thu, 13 Jun 2024 03:34:25 -0700 (PDT) Date: Thu, 13 Jun 2024 12:34:25 +0200 From: Alvaro Herrera To: "David G. Johnston" Cc: Rich Shepard , pgsql-general@lists.postgresql.org Subject: Re: UPDATE with multiple WHERE conditions Message-ID: <202406131034.pfckaz3va2bb@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Jun-12, David G. Johnston wrote: > On Wed, Jun 12, 2024 at 2:28 PM Rich Shepard > wrote: > > > I have a table with 3492 rows. I want to update a boolean column from > > 'false' to 'true' for 295 rows based on the value of another column. > > I'll often just use a spreadsheet to build the 295 update commands and > copy-paste them into psql or whatnot. A closely related technique: if you have a query that generates the UPDATE commands you need, you can run it under \gexec in psql, and they'll be executed. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ Al principio era UNIX, y UNIX habló y dijo: "Hello world\n". No dijo "Hello New Jersey\n", ni "Hello USA\n".