Re: LIKE, CHAR(), and trailing spaces

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kenneth Marshall <ktm(at)rice(dot)edu>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Brendan Jurd <direvus(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: LIKE, CHAR(), and trailing spaces
Date: 2011-02-03 17:07:59
Message-ID: 24381.1296752879@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kenneth Marshall <ktm(at)rice(dot)edu> writes:
> On Wed, Feb 02, 2011 at 07:48:38PM -0500, Bruce Momjian wrote:
>>> It seems LIKE is considering the trailing CHAR(10) field spaces as
>>> significant, even though our documentations says:

> +10 for leaving the behavior as is.

Yeah, we've been around on this before if memory serves. I don't think
there's a case for changing it that's strong enough to outweigh
backwards-compatibility considerations.

Also, anyone who does want the spaces to be stripped can just add an
explicit cast to text first: char_variable::text LIKE ...
If we change it then we'll have to provide some other weird notation
to allow people to get at the old behavior (I suppose there are some
people out there relying on it).

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shaun Thomas 2011-02-03 17:10:06 Re: [HACKERS] Slow count(*) again...
Previous Message Bruce Momjian 2011-02-03 16:57:30 Re: [HACKERS] Slow count(*) again...