Re: domain cast in parameterized vs. non-parameterized query - Mailing list pgsql-hackers

From David Kamholz
Subject Re: domain cast in parameterized vs. non-parameterized query
Date
Msg-id CAKuxgJ75svgj9zWOfVGKFx10EBuCo8dvueeY2FKhZdv49Z_8rA@mail.gmail.com
Whole thread Raw
In response to Re: domain cast in parameterized vs. non-parameterized query  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: domain cast in parameterized vs. non-parameterized query
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: force parallel mode vs CTAS
Next
From: Tom Lane
Date:
Subject: Re: domain cast in parameterized vs. non-parameterized query