Re: type-casting and LIKE queries - Mailing list pgsql-general

From James Gregory
Subject Re: type-casting and LIKE queries
Date
Msg-id 1047666344.4241.1.camel@pirate.bridge.anchor.net.au
Whole thread Raw
In response to type-casting and LIKE queries  (valerian <valerian2@hotpop.com>)
Responses Re: type-casting and LIKE queries  (valerian <valerian2@hotpop.com>)
List pgsql-general
On Fri, 2003-03-14 at 06:26, valerian wrote:
> I have an indexed column called home_phone, which is of type bigint.
> How can I search this column efficiently, using LIKE queries?  For
> example:
>
>    test=> SELECT id FROM user WHERE home_phone LIKE '407%'::bigint;
>    ERROR:  Bad int8 external representation "407%"

try something like

where home_phone::text like '407%'

or alternatively harness the immense power of algebra to achieve your
devious ends :)

HTH,

James.



pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: type-casting and LIKE queries
Next
From: merlyn@stonehenge.com (Randal L. Schwartz)
Date:
Subject: constant scalar subselect no longer equivalent to constant?