From: Tom Lane <tgl@sss.pgh.pa.us>
To: Haszlakiewicz, Eric <EHASZLA@transunion.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: char columns, space padding, and the "like" operator
Date: Mon, 02 Feb 2009 16:38:55 -0500
Message-ID: <8609.1233610735@sss.pgh.pa.us> (raw)
In-Reply-To: <9D29FD18CBD74A478CBA86E6EF6DBAD403394D9A@CHI4EVS04.corp.transunion.com>
References: <9D29FD18CBD74A478CBA86E6EF6DBAD403394D9A@CHI4EVS04.corp.transunion.com>
"Haszlakiewicz, Eric" <EHASZLA@transunion.com> writes:
> Once I realized that the value in the table actually got extended to
> 'SOMEVALUE ', things started making sense, since the equivalent quick
> select is actually:
> select 'SOMEVALUE ' like 'SOME% %';
> Unfortunately, my app has a whole bunch of places where it uses
> constructs like this against char columns. Other databases (such as
> Informix), automatically strip spaces off char column so queries like
> the above behave in a more intuitive fashion.
Cast the char(n) column to text or varchar, and it should work more
like you're expecting.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, EHASZLA@transunion.com
Subject: Re: char columns, space padding, and the "like" operator
In-Reply-To: <8609.1233610735@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox