Re: unsigned types, binary op. and cast pb - Mailing list pgsql-general

From Tino Wildenhain
Subject Re: unsigned types, binary op. and cast pb
Date
Msg-id 405C9098.30405@wildenhain.de
Whole thread Raw
In response to unsigned types, binary op. and cast pb  (Pierre Didelon <pdidelon@cea.fr>)
List pgsql-general
Pierre Didelon wrote:
> I post this mail yesterday to the hacker list as a reply/following,
> but it has been stalled, so I re-post it here...
>
> Hi postgresql experts,
>
> I am new to the group so forgive any misunderstanding or repetition.
>
> I noticed a previous mail concerning unsigned types, claiming
> several solutions, which are not satisfactory (at least for me).
> I need a 4 bytes unsigned integer to store  a 32 bit mask,
> accepting binary operators (&, |, ~, ...) to perform selections
> in "standard" SQL, as simple as possible.
> I want to work, as transparently as possible, with as much DBMS
> as possible, starting and testing with Mysql and Postgresql.
> Appli is Java + JDBC.
>

What about just using the types inet or cidr for your task?
Oth, instead of (mis-) using OID datatype as unsigned int,
and converting it each time into int8 when you want
operations with it - why not using int8 for all?
It has 7*8+7 bits in the positive range, which should be
sufficient for values never bigger then 2^32.
But according to your task, its probably really better
to use inet/cidr types. Much lesser work I guess. And
ipv6 for grant :)

Regards
Tino Wildenhain


pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: How reliable are the stats collector stats?
Next
From: Jan Wieck
Date:
Subject: Re: Triggers After INSERT