Search Postgresql Archives

Re: [HACKERS] Error calling PG_RETURN_NULL()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ Moved to pgsql-general. pgsql-hackers is for development of PostgreSQL
itself. ]

On Mon, 2011-07-25 at 20:06 -0300, Alexandre Savaris wrote:
> ********** Error **********
> 
> ERRO: input function 49344 returned NULL
> SQL state: XX000
> Character: 45
> 
> It seems like the call to PG_RETURN_NULL() on the input function is 
> causing the error. Is this the correct behaviour? There's another way to 
> return a NULL value as the result of a data type's input function?

The docs say:

"The input function must return a value of the data type itself."

http://www.postgresql.org/docs/9.0/static/sql-createtype.html

Which means you can't return a NULL from the input function when there
is non-NULL input. The context around that statement is a little more
informative, but perhaps it could be more clear.

I assume that postgresql has that requirement because it needs to know
whether something is NULL without necessarily knowing what type it is.
For instance:
  ' ' IS NULL
Should that be true or false? If it depends on the type of the
left-hand-side, how do you figure out what type it is? I'm not sure if
this is the exact reason it's prohibited, but it seems like there would
be a problem somewhere along these lines.

Interesting idea though.

Regards,
	Jeff Davis


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux