bitfromint4() in v7.2.3 to bit() in v8.1?

Started by Björn Þór Jónssonalmost 17 years ago2 messagesbugs
Jump to latest

Hi,
In version 7.2.3 this works fine:

select substring(bitfromint4(cast (-2^31 + 22 as int4)), 1, 32);

and now I'm porting the legacy code, that this line is part of, to version
8.1 but am having no luck updating it - have tried something like:

select substring(bit(cast (-2^31 + 22 as int4)), 1, 32);
and
select substring("bit"(cast (-2^31 + 22 as int4)), 1, 32);
and
select substring(1::"bit"(cast (-2^31 + 22 as int4)), 1, 32);

with no luck.

How can this be solved?

/Björn

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Björn Þór Jónsson (#1)
Re: bitfromint4() in v7.2.3 to bit() in v8.1?

=?ISO-8859-1?B?Qmr2cm4g3vNyIErzbnNzb24=?= <bangsi@bthj.is> writes:

In version 7.2.3 this works fine:

select substring(bitfromint4(cast (-2^31 + 22 as int4)), 1, 32);

and now I'm porting the legacy code, that this line is part of, to version
8.1 but am having no luck updating it - have tried something like:

Use a cast, eg

regression=# select cast (-2^31 + 22 as int4)::bit(32);
bit
----------------------------------
10000000000000000000000000010110
(1 row)

regards, tom lane