Re: Casting, again
От | Tom Lane |
---|---|
Тема | Re: Casting, again |
Дата | |
Msg-id | 27225.958405825@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Casting, again (Thomas Lockhart <lockhart@alumni.caltech.edu>) |
Список | pgsql-hackers |
Thomas Lockhart <lockhart@alumni.caltech.edu> writes: > Actually, I'm not sure a change *was* put in! I haven't yet looked, > but it may be that this is a result of my adding a "number to text" > conversion function. The type conversion code took that and ran! Ah, I think you are right --- I was through the type-resolution code not too long ago, and I don't recall seeing any special cases for numeric->text either. It must be as you say, that the addition of this apparently harmless conversion function caused an unexpected change in the overall behavior. After reflecting on this example for a little bit, I like my proposal for explicit "promotability" links between types even better. The example illustrates that it's dangerous to have promotability decisions made on the basis of whether there happens to be a conversion function available or not. Offering a text(int4) function that users can call when they want to force a conversion is fine, but that should not automatically mean that the system can *silently* call it to cause an implicit conversion. Another example is that if we were to offer an int(bool) conversion function, as was suggested for the Nth time in a nearby thread, the current system would not allow us to control whether that conversion can happen implicitly --- it would, period. If implicit conversions can only follow specific "promotability" links then we don't have this risk. regards, tom lane
В списке pgsql-hackers по дате отправления: