Re: [GENERAL] unsigned types

2005-10-18 Thread Greg Stark
Tom Lane <[EMAIL PROTECTED]> writes: > And it's been looked at a few times, and rejected as being far too > bug-prone. The number of ways to screw up by using physical column > number where you should have used logical, or vice versa, is daunting. One way to make sure there are no such bugs woul

Re: [GENERAL] unsigned types

2005-10-18 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > We could improve on this by reordering fields on-disk to reduce > alignment/padding requirements, during CREATE TABLE. We'd need to be > sure to present the same column order back to the client application, of > course, but that should be possible. The noti

Re: [GENERAL] unsigned types

2005-10-18 Thread Martijn van Oosterhout
On Tue, Oct 18, 2005 at 02:00:57PM -0400, Neil Conway wrote: > We could improve on this by reordering fields on-disk to reduce > alignment/padding requirements, during CREATE TABLE. We'd need to be > sure to present the same column order back to the client application, of > course, but that should

Re: [GENERAL] unsigned types

2005-10-18 Thread Neil Conway
On Mon, 2005-17-10 at 12:25 -0500, Jim C. Nasby wrote: > So, if you have a bunch of int2's all next to each other in a table, > they will happily just consume 2 bytes. The issue comes when you try > and mix them with other fields randomly, since many other fields > require int alignment. We could

Re: [GENERAL] unsigned types

2005-10-17 Thread Jim C. Nasby
On Sun, Oct 16, 2005 at 10:08:41AM -0700, Jeff Davis wrote: > jeff sacksteder wrote: > > > >The sign doesn't concern me. I am storing a value that is unsigned and 16 > >bits wide natively. I'll have to just use an int4 and waste twice the space > >I actually need. > > > > Are you sure you'd really

Re: [GENERAL] unsigned types

2005-10-16 Thread Jeff Davis
jeff sacksteder wrote: The sign doesn't concern me. I am storing a value that is unsigned and 16 bits wide natively. I'll have to just use an int4 and waste twice the space I actually need. Are you sure you'd really save space with a 16 bit type? Often times that savings gets lost in alignme

Re: [GENERAL] unsigned types

2005-10-16 Thread Sim Zacks
You can create a new type based on int2 called uint2. he input function should subtract 32768 and the output function should add 32768. The result should be an int4 so that a number such as 4 can be displayed. The storage space required would still only be an int2. The actual value stored in th

Re: [GENERAL] unsigned types

2005-10-15 Thread jeff sacksteder
You can use a signed type with a CHECK constraint to restrict thecolumn's value to positive integers. The sign doesn't concern me. I am storing a value that is unsigned and 16 bits wide natively. I'll have to just use an int4 and waste twice the space I actually need.

Re: [GENERAL] unsigned types

2005-10-15 Thread Neil Conway
On Sat, 2005-15-10 at 16:42 -0400, jeff sacksteder wrote: > It occurs to me that I don't know how to define unsigned integer > datatypes. I'm making a schema to describe network packets and I need > columns to contain values from 0-255, etc. > > I can't seem to find any documentation on this. What

Re: [GENERAL] unsigned types

2005-10-15 Thread Michael Glaesemann
On Oct 16, 2005, at 5:42 , jeff sacksteder wrote: It occurs to me that I don't know how to define unsigned integer datatypes. I'm making a schema to describe network packets and I need columns to contain values from 0-255, etc. I can't seem to find any documentation on this. What's the bes

[GENERAL] unsigned types

2005-10-15 Thread jeff sacksteder
It occurs to me that I don't know how to define unsigned integer datatypes. I'm making a schema to describe network packets and I need columns to contain values from 0-255, etc. I can't seem to find any documentation on this. What's the best prectice for this situation?

Re: [GENERAL] unsigned types, binary op. and cast pb

2004-03-22 Thread Stephan Szabo
On Mon, 22 Mar 2004, Pierre Didelon wrote: > > On Fri, 19 Mar 2004, Pierre Didelon wrote: > > > >> > >>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,

Re: [GENERAL] unsigned types, binary op. and cast pb

2004-03-19 Thread Stephan Szabo
On Fri, 19 Mar 2004, 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 con

[GENERAL] unsigned types, binary op. and cast pb

2004-03-19 Thread Pierre Didelon
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 a