Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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

Does this help?

Have a nice day,
Martijn van Oosterhout   <kleptog(at)svana(dot)org>
> From each according to his ability. To each according to his ability to litigate.

In response to

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group