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

From Martijn van Oosterhout
Subject Re: coalesce with all nulls can only be assigned to
Date
Msg-id 20061129200943.GD4654@svana.org
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
On Wed, Nov 29, 2006 at 01:45:09PM -0600, Kevin Grittner wrote:
> > 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 null can be of any type, string, text, integer, etc. If you have a
bare null in a query, it gets type "unknown" and the system has to
guess. Looking up possible matching operators and functions can help,
but if none of those possibilites help, it gets assigned type "text".
That's why as soon as one entry has a type, it works because the system
can assume the others are of the same type.

Compare this with pointers in C. There you can have a char ponter and
and an integer pointer, both NULL yet they cannot be used
interchangably, they are of different types.

I'm curious how in such a strongly typed language as Java you represent
a null without any associated type. Or does Java not distinguish
either?

Does this help?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: coalesce with all nulls can only be assigned to
Next
From: Vivek Khera
Date:
Subject: Re: Postgresql data integrity during RAID10 drive rebuild