Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>> Still, it rates pretty high on my astonishment scale that a
>> COALESCE of two untyped NULLs (or for that matter, any two values
>> of unknown type) returns a text value.
>
> What would you have it do instead, throw an error?
Return a value of unknown type.
> The current behavior is a lot less astonishing for this example:
> COALESCE('a', 'b')
> which is the same from the type system's point of view.
I understand that it is. I see that as a flaw in the implementation.
It would surprise me less if the above resulted in exactly the same
value and type as a bare 'a'.
-Kevin