From: Joel Burton <jburton@scw.org>
To: Beth Gatewood <bethg@mbt.washington.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: trying to pattern match to a value contained in a column
Date: Thu, 7 Dec 2000 19:01:16 -0800
Message-ID: <3A2FDE7C.23324.552F36@localhost> (raw)
In-Reply-To: <3A3004DC.4FF7CB37@mbt.washington.edu>
> 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@scw.org
Support Center of Washington (www.scw.org)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jburton@scw.org, bethg@mbt.washington.edu
Subject: Re: trying to pattern match to a value contained in a column
In-Reply-To: <3A2FDE7C.23324.552F36@localhost>
References: <3A3004DC.4FF7CB37@mbt.washington.edu> <3A2FDE7C.23324.552F36@localhost>
* 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