Re: Comparing text field

From: "chris smith" <dmagick(at)gmail(dot)com>
To: Nik <XLPizza(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Comparing text field
Date: 2006-04-15 14:10:21
Message-ID: 3c1395330604150710r2e4803c9uf2cec327676a7f07@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 13 Apr 2006 12:20:08 -0700, Nik <XLPizza(at)gmail(dot)com> wrote:
> I am trying to compare a large string (that has new line characters in
> it) to the contents of the text field (which also has new line
> characters in it) and it is not behaving as expected.
>
> For example I have the following record in the database:
> id=83
> message=VAC153-683-685-131830-
> /O.NEW.KLWX.SV.W.0022.060413T1742Z-060413T1830Z/
> BULLETIN - EAS ACTIVATION REQUESTED
> SEVERE THUNDERSTORM WARNING
> NATIONAL WEATHER SERVICE BALTIMORE MD/WASHINGTON DC
> 142 PM EDT THU APR 13 2006
> THE NATIONAL WEATHER SERVICE IN STERLING VIRGINIA HAS ISSUED A
> * SEVERE THUNDERSTORM WARNING
>
> If I do the following query
> SELECT id FROM table1 WHERE message='VAC153-683-685-131830-
> /O.NEW.KLWX.SV.W.0022.060413T1742Z-060413T1830Z/
> BULLETIN - EAS ACTIVATION REQUESTED
> SEVERE THUNDERSTORM WARNING
> NATIONAL WEATHER SERVICE BALTIMORE MD/WASHINGTON DC
> 142 PM EDT THU APR 13 2006
> THE NATIONAL WEATHER SERVICE IN STERLING VIRGINIA HAS ISSUED A
> * SEVERE THUNDERSTORM WARNING'
>
> I get no results back, even though the message is equivalent. How
> should I perform this comparison so that the above query returns id=83?

Could one have \r\n and the other have \n ?

Are you doing the comparison in psql or through a language (php, ruby,
python, other) ?

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2006-04-15 14:31:26 Re: Asking advice on speeding up a big table
Previous Message Martijn van Oosterhout 2006-04-15 13:51:44 Re: HUGE Stack space is gettiing consumed