Re: coalesce with all nulls can only be assigned to - Mailing list pgsql-general

From Richard Huxton
Subject Re: coalesce with all nulls can only be assigned to
Date
Msg-id 456DE96B.8030806@archonet.com
Whole thread Raw
In response to Re: coalesce with all nulls can only be assigned to  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-general
Kevin Grittner wrote:
>>>> On Wed, Nov 29, 2006 at  1:38 PM, in message
> <21909.1164829090@sss.pgh.pa.us>,
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>>> Richard Huxton <dev@archonet.com> wrote:
>>>> It's the coalesce that has the problem, not the insert. The
> coalesce is
>>>> deciding that it's working on text, and so returns text.
>>
>>> It seems like maybe it would be worth overloading the coalesce
> method
>>> to handle this particular case differently.
>> And do what?  The only information you have is that all the inputs
> are
>> of unknown type.
>
> I know this is naive, but, what is the type information of the bare
> null?  Could that be used?

A literal null is "unknown", other literals are "unknown" or
"unknown-numeric" based on quoting iirc.

Hmm - Tom would it be possible to create a cast to unknown, explicitly
cast this coalesce to unknown and let it implicitly cast back to
whatever the column needs?

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: Re: How to implement backup protocol
Next
From: Martijn van Oosterhout
Date:
Subject: Re: coalesce with all nulls can only be assigned to