Re: MERGE and parsing with prepared statements

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: MERGE and parsing with prepared statements
Date: 2022-07-15 18:40:19
Message-ID: 20220715184019.rour3mk33ngc76y6@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-07-15 18:52:45 Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)
Previous Message Maciek Sakrejda 2022-07-15 18:21:51 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?