Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqiBg-0000Xe-8b for pgsql-general@arkaria.postgresql.org; Fri, 26 Nov 2021 20:51:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mqiBd-000699-PT for pgsql-general@arkaria.postgresql.org; Fri, 26 Nov 2021 20:51:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqiBc-00068z-PJ for pgsql-general@lists.postgresql.org; Fri, 26 Nov 2021 20:51:13 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqiBX-0001Gm-Iy for pgsql-general@lists.postgresql.org; Fri, 26 Nov 2021 20:51:12 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 32A883201EB4; Fri, 26 Nov 2021 15:51:03 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 26 Nov 2021 15:51:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=Q K2MwAoJfsWvEqliBPO6C3HZPoGst8nIyupGt00cugw=; b=nb02ecxx/9ZrEp4/S 2qd4TrvLG8Xo072GjLkI00whJpk/KLLbTQpNBeKMq6AH8s23e9PBlp6Dtbn30P0z ZzbuAQhWhN3Sswp4x2EjOS5rXRPAWCQamBHvIvlSUn5KgXrt4uwYld6z9PrBz8X+ AvPhs968MbKAeXNe5nt87TOhp1dZCL5Bs/n+IxbadBo5OSsGmcMuceGaY6zdZPqy zasJNC4yPD7YJdcrInHNtSydcU2dsmLiB2v06GMZTLk2/Dw52iHKFU7JVz15TlVh kgjIiauWWYHj+WyrJaiBSKGW+y7evgYS8Rzpkgp5zQjoxvvvIX97hksjavtAxX9+ xkBaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=QK2MwAoJfsWvEqliBPO6C3HZPoGst8nIyupGt00cu gw=; b=RZ9lF+NTbcV+s0Rv+6XNzFiwF/+cU5WzYSJxazrtHtSkmWvXXIjscG7fe hbvkYZHDqJC4P68O0fOeX7y0gO9VvA6Fp9LOzGrHn1HHRiOL4sE9ePKf+iIm1h6h AQakLaZLs7OTPJeBmo9GVhYR3nbmGtwuW1xgzFli/dQQ57OcxTQdxBR77VEGWE4K M0grzn8T/p6sanv14mtDySgm5pH3d/Ch/a/BvB234S5bWRUy+cQBKqFlj/IMukxJ S5NYZk25JnifyJePfVQdyngrv+uIz4nQ+Z1MKnz/mjtDa4Gs6d/sizeWx2RojV7d zldUr2q+NkiPUfG17b78VjabLRPfw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrhedvgddugeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeekleekleekkeduvedtkeffuefffeehteffhfeikeeh heeigeejjedtkedvhedutdenucffohhmrghinhepphhoshhtghhrrdgvshdpphhoshhtgh hrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Nov 2021 15:51:01 -0500 (EST) Message-ID: <33716356-dcf4-41fa-d053-058997bb652b@aklaver.com> Date: Fri, 26 Nov 2021 12:51:00 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: Merge into does not work Content-Language: en-US To: Alvaro Herrera Cc: Shaozhong SHI , pgsql-general References: <202111262010.ceg5ebzus4f5@alvherre.pgsql> From: Adrian Klaver In-Reply-To: <202111262010.ceg5ebzus4f5@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/26/21 12:10, Alvaro Herrera wrote: > On 2021-Nov-26, Adrian Klaver wrote: > >> On 11/26/21 11:44, Alvaro Herrera wrote: >>> On 2021-Nov-26, Shaozhong SHI wrote: >>> >>> I am using the MERGE patch I posted here[1], on top of Postgres 15. >>> >>> https://postgr.es/m/202111152245.byerxxac444d@alvherre.pgsql >> >> A patch that as AFAIK is not even committed to what is at best an alpha >> version would in my opinion not qualify as ready much less supported. I look >> forward to seeing it make it in, but I would hardly recommend it for general >> use. > > All true. I'm recruiting testers. Which is great, that was not how it was presented though: 'It does work for me ...' The issue being there are already folks that come across: https://wiki.postgresql.org/wiki/SQL_MERGE https://wiki.postgresql.org/wiki/SQL_MERGE_Patch_Status and do a partial read on the pages and leap to the conclusion the MERGE exists in Postgres. I fully expect people to see: " It does work for me: 55479 15devel 680346=# MERGE INTO Stock USING Buy ON Stock.item_id = Buy.item_id WHEN MATCHED THEN UPDATE SET balance = balance + Buy.volume WHEN NOT MATCHED THEN INSERT VALUES (Buy.item_id, Buy.volume); MERGE 2 Duración: 3,879 ms 55479 15devel 680346=# select * from stock; item_id │ balance ─────────┼───────── 20 │ 1900 10 │ 3200 30 │ 300 (3 filas) " quit reading and then ask why MERGE does not exist in their instance? My two cents worth. -- Adrian Klaver adrian.klaver@aklaver.com