On Nov 13, 2010, at 3:32 , Donald Kerr wrote:
> Thank you, Tom.
>
> I have tried what you suggest but it does not seem to work:
> 'x'||substring(col,3,2)::text::bit(8)::int returns - "9" is not a valid
> binary digit.
Try with parens:
postgres=# select ('x' || 99::text)::bit(8)::int;
int4
------
153
(1 row)
postgres=# select version();
version
------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.1 on x86_64-apple-darwin10.4.0, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc.
build5664), 64-bit
(1 row)
Michael Glaesemann
grzm seespotcode net