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 1oCQEn-0005C6-5g for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Jul 2022 18:40:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oCQEm-0001RB-3P for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Jul 2022 18:40:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oCQEl-0001HQ-RD for pgsql-hackers@lists.postgresql.org; Fri, 15 Jul 2022 18:40:27 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oCQEi-0006m0-4G for pgsql-hackers@postgresql.org; Fri, 15 Jul 2022 18:40:25 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 8AAB83200B9F; Fri, 15 Jul 2022 14:40:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 15 Jul 2022 14:40:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1657910422; x=1657996822; bh=Z snA/u1da7RqJlgSNH2CTIsUfgH3i4xzDjRutyrEhRQ=; b=1zOkDkrhUuZy4R2/L 0DDn7thuPunKrqfWF6DpB0nbgHpEYN2fArr2Jg53NlvCETgdKZTH0/ULhyuEMcOH K5P5ccIVcpYx7/Qqm5f3iPSiCFcUJC/zMHgSS69qeiaHSdWJRqMX2xHuzTnLsFce N9PiWVz05ehVlBxipJQAytffQbOrzSI1jO+jtiyxzIgyRUbPZ3rh9WhQz9Uo0+yl vOkON96YtUWl64Fimq9c4aplysH4AOrelyifWq9JRtL4BGOojBHFkjOta9FUxwSt YeA2p2R4IkD0HlWJDO2lGHXMBOr846E65rcGqb6njb3HkRB+/HLuZOeVtuazt2tu gBa5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudekuddgudefudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 15 Jul 2022 14:40:21 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id EF36D36E; Fri, 15 Jul 2022 20:40:19 +0200 (CEST) Date: Fri, 15 Jul 2022 20:40:19 +0200 From: Alvaro Herrera To: Justin Pryzby Cc: Matthias van de Meent , pgsql-hackers@postgresql.org Subject: Re: MERGE and parsing with prepared statements Message-ID: <20220715184019.rour3mk33ngc76y6@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220715175854.GM18011@telsasoft.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jul-15, Justin Pryzby wrote: > On Fri, Jul 15, 2022 at 11:25:35AM +0200, Matthias van de Meent wrote: > Thanks for looking into it. Definitely! Thanks, Matthias. > I see now that the same thing can happen with "ON CONFLICT" if used with a > subselect. > > PREPARE p AS INSERT INTO t SELECT a FROM (SELECT $1 AS a)a > ON CONFLICT (i) DO UPDATE SET i=excluded.i; > ERROR: column "i" is of type integer but expression is of type text Right, I didn't think that MERGE was doing anything peculiar in this respect. > It seems a bit odd that it's impossible to use merge with prepared statements > without specifically casting the source types (which I did now to continue my > experiment). I have no comments on this. Maybe it can be improved, but I don't know how. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/