BUG #5237: strange int->bit and bit->int conversions

From: "Roman Kononov" <kononov(at)ftml(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5237: strange int->bit and bit->int conversions
Date: 2009-12-09 20:06:19
Message-ID: 200912092006.nB9K6JvK091485@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


The following bug has been logged online:

Bug reference: 5237
Logged by: Roman Kononov
Email address: kononov(at)ftml(dot)net
PostgreSQL version: 8.4.1
Operating system: GNU/Linux x86_64
Description: strange int->bit and bit->int conversions
Details:

test=# select (11::int4<<23 | 11::int4)::bit(32);
00000101100000000000000000001011

test=# select (11::int4<<23 | 11::int4)::bit(33);
000001011100000000000000000001011

test=# select (11::int4<<23 | 11::int4)::bit(39);
000001010000101100000000000000000001011

test=# select (11::int4<<23 | 11::int4)::bit(40);
0000000000000101100000000000000000001011

The ::bit(33) and ::bit(39) conversions seem wrong.

test-std=# select 1::int4::bit(32)::int4;
1

test-std=# select 1::int4::bit(33)::int4;
ERROR: integer out of range

Why is it out of range?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Nagy 2009-12-09 21:12:08 BUG #5238: frequent signal 11 segfaults
Previous Message Mike Landis 2009-12-09 19:35:56 getting libpqd.lib and libpqd.dll for postgesql 8.4.1 on Vista with VS8 or cygwin g++

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-12-09 21:06:08 Re: explain output infelicity in psql
Previous Message Andrew Dunstan 2009-12-09 19:37:49 explain output infelicity in psql