Re: LIKE with no wildcards problem

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "John J(dot) Allison" <john(at)joss(dot)ucar(dot)edu>, pgsql-sql(at)postgresql(dot)org
Subject: Re: LIKE with no wildcards problem
Date: 2002-02-28 19:28:37
Message-ID: web-813010@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

John,

> 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?

> catalog^> create table foo ( bar char(8) )
> CREATE
>

You created the column bar as CHAR(8), which means what's actually
being stored is "abc " not "abc". I think you want to use VARCHAR
instead.

-Josh

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Barwick 2002-02-28 19:36:48 Re: LIKE with no wildcards problem
Previous Message John J. Allison 2002-02-28 18:54:02 LIKE with no wildcards problem