Skip site navigation (1) Skip section navigation (2)

Re: LIKE, CHAR(), and trailing spaces

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: LIKE, CHAR(), and trailing spaces
Date: 2011-02-03 00:48:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Brendan Jurd wrote:
> On 3 February 2011 10:54, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > It seems LIKE is considering the trailing CHAR(10) field spaces as
> > significant, even though our documentations says:
> >
> -- snip --
> >
> > It says trailing spaces are not significant for character comparisons
> > --- the real question is whether LIKE is a comparison. ?Obvioiusly '='
> > is a comparison, but the system does not treat LIKE as a comparison in
> > terms of trailing spaces. ?Is that desired behavior?
> Interesting.  I would have to say that from the user point of view,
> LIKE is definitely a comparison, and if the rest of the operators on
> bpchar ignore whitespace then LIKE ought to as well.
> Is the situation the same for regex matches (~ operators)?

Yes, I think so:

	test=> SELECT 'a'::char(10) ~ 'a$';
	(1 row)
	test=> SELECT 'a'::char(10) ~ 'a  *$';
	(1 row)

  Bruce Momjian  <bruce(at)momjian(dot)us>

  + It's impossible for everything to be true. +

In response to


pgsql-hackers by date

Next:From: Itagaki TakahiroDate: 2011-02-03 01:16:21
Subject: Re: log_checkpoints and restartpoint
Previous:From: Brendan JurdDate: 2011-02-03 00:40:51
Subject: Re: LIKE, CHAR(), and trailing spaces

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group