Thread: Domain bit cast

Domain bit cast

From
Martin Sládek
Date:
Cast int to domaim based on bit(n) works quite strange.

CREATE DOMAIN kat bit(40) NOT NULL;
SELECT 7::bit(40), 7::kat;


--on Win (7.5devel) and Linux (8.0.0b4)
bit | kat
0000000000000000000000000000000000000111 |
1000000000000000000000000000000000000000

--on Linux (7.4.6)
bit | kat
0000000000000000000000000000011100000000 |
0000000000000000000000000000011100000000

On 7.5 and 8.0 it seems that ::kat is ::bit::bit(40)



Re: Domain bit cast

From
Kris Jurka
Date:
On Fri, 5 Nov 2004, [ISO-8859-2] Martin Sl=E1dek wrote:

> Cast int to domaim based on bit(n) works quite strange.
>=20
> CREATE DOMAIN kat bit(40) NOT NULL;
> SELECT 7::bit(40), 7::kat;

I didn't realize you were going to report this (as this post got held for=
=20
moderator approval), so I reported it and Tom Lane fixed it:

http://archives.postgresql.org/pgsql-bugs/2004-11/msg00066.php

Kris Jurka