type-casting and LIKE queries

From: valerian <valerian2(at)hotpop(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: type-casting and LIKE queries
Date: 2003-03-14 06:26:12
Message-ID: 20030314062602.GA32380@hotpop.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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%"

Obviously, that's not correct, but I'm confused as to how the % and ?
characters can be used along with type-casting. Or can they?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christian Frabel 2003-03-14 06:43:27 pg_dumpall
Previous Message shreedhar 2003-03-14 06:25:28 Is there any tool to set up database automatically