Re: COALESCE doccumentation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: t(dot)dnil(at)yahoo(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: COALESCE doccumentation
Date: 2019-04-30 01:33:46
Message-ID: 19231.1556588026@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> On Sat, Apr 27, 2019 at 08:26:57PM +0000, PG Doc comments form wrote:
>> Try, for example.
>>
>> SELECT COALESCE(NULL, '12', 3, 1, 1); -- OK!
>> SELECT COALESCE(NULL, '12.2', 3.2, '1', 1.1); -- OK!
>> SELECT COALESCE(NULL, '1d2', 3, 1, 1); -- error
>> SELECT COALESCE(NULL, '12', 3, '1d', 1); -- cast error

> What is wrong about the existing description? That it doesn't mention
> mixing data types?

The place where that behavior is described is

https://www.postgresql.org/docs/current/typeconv-union-case.html

It doesn't mention COALESCE explicitly, though ... and I imagine
digging in the code for coerce_to_common_type callers might find
some other cases that aren't listed there.

regards, tom lane

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Daniil Treshchin 2019-04-30 02:01:55 Re: COALESCE doccumentation
Previous Message Daniil Treshchin 2019-04-30 01:31:16 Re: COALESCE doccumentation