Re: type-casting and LIKE queries

From: James Gregory <james(at)anchor(dot)net(dot)au>
To: valerian <valerian2(at)hotpop(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: type-casting and LIKE queries
Date: 2003-03-14 18:25:44
Message-ID: 1047666344.4241.1.camel@pirate.bridge.anchor.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gavin M. Roy 2003-03-14 18:30:23 Re: PostgreSQL and XML
Previous Message scott.marlowe 2003-03-14 18:16:20 Re: PostgreSQL and XML