Received: from post.webmailer.de (natpost.webmailer.de [192.67.198.65]) by postgresql.org (Postfix) with ESMTP id 8A6F8475AF0 for ; Thu, 28 Feb 2002 14:37:05 -0500 (EST) Received: from there (pD9EB1FB9.dip.t-dialin.net [217.235.31.185]) by post.webmailer.de (8.9.3/8.8.7) with SMTP id UAA10702; Thu, 28 Feb 2002 20:37:03 +0100 (MET) Message-Id: <200202281937.UAA10702@post.webmailer.de> Content-Type: text/plain; charset="iso-2022-jp" From: Ian Barwick To: "John J. Allison" , pgsql-sql@postgresql.org Subject: Re: LIKE with no wildcards problem Date: Thu, 28 Feb 2002 20:36:48 +0100 X-Mailer: KMail [version 1.3.1] References: <200202281854.LAA13770@virga.joss.ucar.edu> In-Reply-To: <200202281854.LAA13770@virga.joss.ucar.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archive-Number: 200202/455 X-Sequence-Number: 6876 On Thursday 28 February 2002 19:54, John J. Allison wrote: > When doing a select with a LIKE in the where clause, > I always get 0 rows if I do not use a wildcard [_%]. > LIKE should act like = in this case (and the docs say so). > A select without a from correctly returns 't'. > I am using PostgreSQL 7.1.3 on Solaris. > What am I missing? > > Thanks, > > John Allison > john@joss.ucar.edu > > > catalog^> create table foo ( bar char(8) ) > CREATE > > catalog^> insert into foo values ( 'abc' ) > INSERT 38413 1 > > catalog^> insert into foo values ( '2.20' ) > INSERT 38414 1 > > catalog^> select * from foo > bar > ---------- > abc > 2.20 > (2 rows) How about: catalog^> SELECT bar, length(bar) from foo; bar | length ----------+-------- abc | 8 2.20 | 8 (2 rows) The CHARACTER type is always padded to the maximum length, viz: http://www.postgresql.org/idocs/index.php?datatype-character.html Ian Barwick