Re: coalesce with all nulls can only be assigned to

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Huxton <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: coalesce with all nulls can only be assigned to
Date: 2006-11-29 20:09:43
Message-ID: 20061129200943.GD4654@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2006-11-29 20:11:23 Re: coalesce with all nulls can only be assigned to
Previous Message Andrus 2006-11-29 19:49:47 Re: How to implement backup protocol