Re: Substring auto trim

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Charles O'Farrell" <charleso(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Substring auto trim
Date: 2010-01-13 17:14:07
Message-ID: 14774.1263402847@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> What's the data type of the value being compared to? I get, for
>> instance,
>>
>> postgres=# select substr('ab '::char(4), 1, 4) = 'ab '::char(4);

> This looks like another situation where we're running into trouble
> because of non-standard behavior when people might be expecting
> something consistent with other products and the explicit language
> in the standard.

If we were to change that so that 'ab ' were implicitly typed as
char(4), then we'd start getting bug reports from people complaining
that "select 'ab' = 'ab '" yields true. I remain of the opinion that
char(n) is so hopelessly brain-damaged that we should be very careful
to NOT bring it into our mainstream behavior.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2010-01-13 17:21:00 Re: Substring auto trim
Previous Message Tom Lane 2010-01-13 16:58:48 Re: BUG #5269: postgres backend terminates with SIGSEGV