Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Right, because assigning to a table column is an "assignment" cast ---
> which has more liberal rules, because either you can coerce the value
> to the table column's type or you're going to fail anyway. So the
> system will take the integer literal and try to downcast to smallint,
> and if that doesn't work then the query was doomed anyhow.
This one sank in last night when I re-read the docs for CREATE CAST.
> Coercion of a value to match a function argument is a different matter;
> the system will not choose a coercion that is "surprising" in any way
> or has the potential to fail due to issues such as range limitations.
> The reason for the difference in behavior is probably not very obvious
> when you have only one possible function to match, but we need this
> restriction in order for things to behave sanely with overloaded
> functions (or operators). The text in chapter 10 expands on that a
This is exactly what was confusing us; we aren't using function overloading so at the time it seemed like it should just work. I think I finally understand it again re-reading chapter 10 again.
In response to
pgsql-novice by date
|Next:||From: Ioannis Anagnostopoulos||Date: 2012-07-19 12:24:34|
|Subject: Re: Index slow down insertions...|
|Previous:||From: Rob Richardson||Date: 2012-07-17 15:12:59|
|Subject: Re: How do I convert four table columns into a box?|