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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Beth Gatewood <bethg(at)mbt(dot)washington(dot)edu>
Cc: Francis Solomon <francis(at)stellison(dot)co(dot)uk>, pgsql-sql(at)postgresql(dot)org
Subject: Re: trying to pattern match to a value contained in a column
Date: 2000-12-07 23:31:54
Message-ID: 28352.976231914@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Beth Gatewood <bethg(at)mbt(dot)washington(dot)edu> writes:
> 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 seem to recall that || (and most other operators) wasn't
considered associative by the grammar way back when.
Try a fully parenthesized expression:

select * from av34s1 where chromat ~~ (('%' || sample) || '%');

regards, tom lane

PS: And do think about updating soon, hmm?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2000-12-07 23:32:24 Re: trying to pattern match to a value contained in a column
Previous Message Edmar Wiggers 2000-12-07 23:08:09 Unable to convert null timestamp to date. Bug?