Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-hackers by date

Next:From: Robert HaasDate: 2009-12-09 21:06:08
Subject: Re: explain output infelicity in psql
Previous:From: Andrew DunstanDate: 2009-12-09 19:37:49
Subject: explain output infelicity in psql

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group