Re: odd behavior/possible bug - Mailing list pgsql-hackers

From Joe Conway
Subject Re: odd behavior/possible bug
Date
Msg-id 3F205289.1050702@joeconway.com
Whole thread Raw
In response to Re: odd behavior/possible bug  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-hackers
Stephan Szabo wrote:
> On Thu, 24 Jul 2003, Joe Conway wrote:
>>I see your point, but mine was that in this case I'd like a NULL
>>returned and I don't really care about the type. ISTM that NULL should
>>be able to morph into any type it needs to.
> 
> I don't think that's necessarily true.
> As a potentially absurd example, do we want
>  select CAST( CAST( NULL as DATE ) as POINT );
> to succeed when dates aren't convertable to points?

good point -- no pun intended ;)

> 
> The case of func(anyelement, anyelement) returns anyarray could
> potentially return some kind of "array of unknown (but single) type"
> when presented with unknown inputs.  I'm not sure what use that'd be
> unless you are allowed to convert it into something else, though.
> 

Hmm, this sounds like yet another reason for UNKNOWN[]. Specifically 
what I wanted to do was create a function that would give me a NULL if 
any arguments to my ARRAY[] expression were NULL. But the change Tom 
suggested (i.e. ARRAY[NULL,...] evaluates to NULL) gives me that without 
needing the function, so probably that is the best answer.

Joe



pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: odd behavior/possible bug
Next
From: Bruce Momjian
Date:
Subject: Re: php with postgres