Re: MERGE and parsing with prepared statements

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: MERGE and parsing with prepared statements
Дата
Msg-id 20220715204341.GO18011@telsasoft.com
обсуждение исходный текст
Ответ на Re: MERGE and parsing with prepared statements  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jonathan S. Katz"
Дата:
Сообщение: Re: PG15 beta1 sort performance regression due to Generation context change
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PG15 beta1 sort performance regression due to Generation context change