Re: Bad (null) varchar() external representation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Clift <aa2(at)bigpond(dot)net(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Bad (null) varchar() external representation
Date: 2001-01-11 18:53:14
Message-ID: 12169.979239194@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Justin Clift <aa2(at)bigpond(dot)net(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-01-11 19:19:38 Re: Possible bug? WAS :Bad (null) varchar() external representation.
Previous Message Sharmad Naik 2001-01-11 18:22:40 postmaster