From: Justin Pryzby <pryzby@telsasoft.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: MERGE and parsing with prepared statements
Date: Fri, 15 Jul 2022 15:43:41 -0500
Message-ID: <20220715204341.GO18011@telsasoft.com> (raw)
In-Reply-To: <CAKFQuwb4X_WMoV_k=ybPWYybz+=T1JhPqkOY=xdoJNzMHEiBwg@mail.gmail.com>
References: <20220715175854.GM18011@telsasoft.com>
<20220715184019.rour3mk33ngc76y6@alvherre.pgsql>
<CAKFQuwbtQk52zWLYsXvO2+ZGTPu+MPvWgaCS7jQKuGhrwn0-rA@mail.gmail.com>
<20220715194013.GN18011@telsasoft.com>
<CAKFQuwb4X_WMoV_k=ybPWYybz+=T1JhPqkOY=xdoJNzMHEiBwg@mail.gmail.com>
On Fri, Jul 15, 2022 at 12:59:34PM -0700, David G. Johnston wrote:
> On Fri, Jul 15, 2022 at 12:40 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
>
> >
> | If the expression for any column is not of the correct data type, automatic type conversion will be attempted.
> > That appears to be copied from the INSERT page.
> > What does that mean, if not that data types will be resolved as needed ?
>
> Yep, and the system needs to resolve the type at a point where there is no
> contextual information and so it chooses text.
I don't know if that's a viable interpretation. The parser "resolved the type"
by assuming a default, which caused an error before finishing parsing.
In the case of INSERT, "conversion will be attempted" means it looks for a cast
from the source type to the target type, and its "automatic type conversion"
will fail if (for example) you try to insert a timestamp into an int.
In the case of MERGE, that same sentence evidently means that it assumes a
default source type (rather than looking for a cast) and then fails if it
doesn't exactly match the target type.
Should that sentence be removed from MERGE ?
--
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, david.g.johnston@gmail.com, alvherre@alvh.no-ip.org, boekewurm+postgres@gmail.com
Subject: Re: MERGE and parsing with prepared statements
In-Reply-To: <20220715204341.GO18011@telsasoft.com>
References: <20220715175854.GM18011@telsasoft.com> <20220715184019.rour3mk33ngc76y6@alvherre.pgsql> <CAKFQuwbtQk52zWLYsXvO2+ZGTPu+MPvWgaCS7jQKuGhrwn0-rA@mail.gmail.com> <20220715194013.GN18011@telsasoft.com> <CAKFQuwb4X_WMoV_k=ybPWYybz+=T1JhPqkOY=xdoJNzMHEiBwg@mail.gmail.com> <20220715204341.GO18011@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox