append all columns in where-clause

From: Peter Pilsl <pilsl(at)goldfisch(dot)at>
To: pgsql-general(at)postgresql(dot)org
Subject: append all columns in where-clause
Date: 2001-04-18 21:26:54
Message-ID: 20010418232654.C91421@i3.atat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

for doing a simple full text-search I add the following where-clause:

select c1,c2,c3...,c9 from table where c1||c2||c3 .. ||c9 ~ 'searchtext';

This seems to work even with integers or timestamps. Unfortunately it does not work with char-fields:

author | varchar(100) |
valid | char(1) |

#select author||valid from table;
ERROR: Unable to identify an operator '||' for types 'varchar' and 'bpchar'
You will have to retype this query using an explicit cast

Is there any way to ship around this problem or any more correct way
to avoid such errors in the future with different types.

thnx,

peter

--
mag. peter pilsl

phone: +43 676 3574035
fax : +43 676 3546512
email: pilsl(at)goldfisch(dot)at
sms : pilsl(at)max(dot)mail(dot)at

pgp-key available

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2001-04-18 21:59:39 Re: Inheritance question
Previous Message Tom Lane 2001-04-18 20:59:31 Re: corrupted database?