Re: trying to pattern match to a value contained in a column

From: "Joel Burton" <jburton(at)scw(dot)org>
To: Beth Gatewood <bethg(at)mbt(dot)washington(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: trying to pattern match to a value contained in a column
Date: 2000-12-08 03:01:16
Message-ID: 3A2FDE7C.23324.552F36@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> This makes perfect sense...unfortunately it isn't working...
>
> I hope this isn't because I am using 6.3 (yes...I know it is very very
> old but this is currently where the data is!)
>
> here is the query:
>
> select * from av34s1 where chromat ~~ ('%' || sample || '%');
>
>
> ERROR: parser: syntax error at or near "||"
>
> I have also tried using LIKE....
>
> samething..
>
> NOW..
> select * from av34s1 where chromat~sample;
>
> ERROR: There is no operator '~' for types 'bpchar' and 'bpchar'
> You will either have to retype this query using an explicit
> cast,
> or you will have to define the operator using CREATE OPERATOR
>

The suggestion works fine w/recent versions; perhaps it's a '6.3
thing'

Perhaps

SELECT * FROM tbl WHERE chromat::TEXT ~~ ('%' || sample || '%'
)::TEXT;

?

Also, upgrading isn't difficult in most cases; you can pg_dumpall and
upgrade and restore your files. 7.0 has many nice features over the
6.x series.
--
Joel Burton, Director of Information Systems -*- jburton(at)scw(dot)org
Support Center of Washington (www.scw.org)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joseph Shraibman 2000-12-08 04:23:07 FOREIGN KEY errors.
Previous Message Tom Lane 2000-12-08 01:01:51 Re: [SQL] Unable to convert null timestamp to date. Bug?