Re: Bad (null) varchar() external representation - Mailing list pgsql-sql

From Tom Lane
Subject Re: Bad (null) varchar() external representation
Date
Msg-id 12169.979239194@sss.pgh.pa.us
Whole thread Raw
In response to Bad (null) varchar() external representation  (Justin Clift <aa2@bigpond.net.au>)
List pgsql-sql
Justin Clift <aa2@bigpond.net.au> writes:
> "Bad (null) varchar() external representation"

This is a known stupidity in 7.0.* and before: length(varchar) doesn't
like NULLs:

play=> select length(null::varchar);
ERROR:  Bad (null) varchar() external representation

It's fixed for 7.1.  If it's really bothering you in 7.0.*, find that
error string in src/backend/utils/adt/varchar.c and change the code to
return 0 instead of raising an error for NULL input.

But, as someone else pointed out, the constraint expressions you are
using are redundant anyway, given the declared column length limits.
Getting rid of the constraints might be your easiest workaround for now.
        regards, tom lane


pgsql-sql by date:

Previous
From: "Sharmad Naik"
Date:
Subject: postmaster
Next
From: Tom Lane
Date:
Subject: Re: Possible bug? WAS :Bad (null) varchar() external representation.