Re: BUG #4007: chr(0) doesn't work anymore

From: Steve Clark <sclark(at)netwolves(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4007: chr(0) doesn't work anymore
Date: 2008-03-03 16:21:10
Message-ID: 47CC2576.9090609@netwolves.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Tom Lane wrote:
> "Steve Clark" <sclark(at)netwolves(dot)com> writes:
>
>>Until 8.3.0 the following worked:
>>SELECT coalesce(param_value,chr(0)) from t_system_params where param_name =
>>'default_unit_key';
>
>
> It would have "worked" only for rather small values of "work", since
> most of the support for type TEXT isn't null-safe. Try something like
> "select chr(0) || 'foo';" for example. Wouldn't an empty string do what
> you want better?
>
>
>>it now fails with:
>>ERROR: null character not permitted
>
>
> This is an intentional change and won't be undone, at least not until
> TEXT is null-safe, which isn't likely to happen in the foreseeable future.
>
> regards, tom lane
>
>
Hi Tom,

I'm not sure. This was written in 2001/2002 timeframe and I inherited
it. I am not even sure what he was
trying to accomplish.

I'm not sure I understand what you mean about TEXT being null-safe.
What are the issues, and why was
it supported for years and now abruptly changed.

All I know is the code used to work from 7.3.x up through 8.2.5 and
now it doesn't.

If it not going the made to work according to the documentation then
the documentation should be
fixed.

Steve

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-03-03 16:28:11 Re: BUG #4007: chr(0) doesn't work anymore
Previous Message Tom Lane 2008-03-03 15:54:24 Re: BUG #4006: pg_ctl assumes that all config files lie in data_directory

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-03 16:28:11 Re: BUG #4007: chr(0) doesn't work anymore
Previous Message Tom Lane 2008-03-03 15:49:39 Re: BUG #4007: chr(0) doesn't work anymore