append all columns in where-clause - Mailing list pgsql-general

From Peter Pilsl
Subject append all columns in where-clause
Date
Msg-id 20010418232654.C91421@i3.atat.at
Whole thread Raw
Responses Re: append all columns in where-clause
List 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@goldfisch.at
sms  : pilsl@max.mail.at

pgp-key available

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Passing a row (NEW) as function argument
Next
From: "Oliver Elphick"
Date:
Subject: Re: Inheritance question