Re: domain cast in parameterized vs. non-parameterized query

Поиск
Список
Период
Сортировка
От David Kamholz
Тема Re: domain cast in parameterized vs. non-parameterized query
Дата
Msg-id CAKuxgJ75svgj9zWOfVGKFx10EBuCo8dvueeY2FKhZdv49Z_8rA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: domain cast in parameterized vs. non-parameterized query  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: domain cast in parameterized vs. non-parameterized query  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> Why the rewrite doesn't reduce it? Or why parser does it?

Because ALTER DOMAIN can change what would be a valid value.

In the view case that makes sense, but I don't see how ALTER DOMAIN is relevant to my original example. You can't alter a domain between the time the query is parsed and executed, can you?

I also don't understand why prepared statements are different. The future values are not known to pass the domain check at the time the statement is prepared, and at the time it's executed, I'd think the value is known exactly to the extent that a literal (non-parameterized) value is known. That is, I'd expect the ability to run CoerceToDomain and fold to a constant to be identical in both cases -- either possible in both or impossible in both. Why the difference?

Dave

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: force parallel mode vs CTAS
Следующее
От: Tom Lane
Дата:
Сообщение: Re: domain cast in parameterized vs. non-parameterized query