Re: varchar => int - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: varchar => int
Date
Msg-id Pine.LNX.4.30.0101280048140.1492-100000@peter.localdomain
Whole thread Raw
In response to varchar => int  ("Mitch Vincent" <mitch@venux.net>)
List pgsql-general
Mitch Vincent writes:

> I can't cast varchar to int (according to the error I'm getting..), any
> ideas on how I can accomplish a ranged search on a varchar field (taking
> into acount the value of the numbers, not the character's ascii code)?

Try casting it to text first:

cast(cast(value as text) as integer)

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


pgsql-general by date:

Previous
From: Frank Joerdens
Date:
Subject: Re: Setting logfile location with pg_ctl and postgres.conf
Next
From: Tom Lane
Date:
Subject: Re: someone please explain this regex behaviour