Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-28 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > "Decibel!" <[EMAIL PROTECTED]> writes: >> Do we really want to be making it easier for people to wrap numbers in >> quotes? > Currently wrapping numbers in quotes is really the way Postgres expects to get > them. Really? regression=# select '2' + '2'

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-28 Thread Gregory Stark
"Decibel!" <[EMAIL PROTECTED]> writes: > On Jul 25, 2008, at 11:44 AM, Alvaro Herrera wrote: >> However, it would be neat if this behaved the same as >> >> alvherre=# select '0.42' + 1; >> ERROR: invalid input syntax for integer: "0.42" >> STATEMENT: select '0.42' + 1; > > > Do we really want to

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-28 Thread Decibel!
On Jul 25, 2008, at 11:44 AM, Alvaro Herrera wrote: However, it would be neat if this behaved the same as alvherre=# select '0.42' + 1; ERROR: invalid input syntax for integer: "0.42" STATEMENT: select '0.42' + 1; Do we really want to be making it easier for people to wrap numbers in quot

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-26 Thread Kenneth Marshall
Hi Ryan, I agree, I have had applications use uint types to avoid using a larger data type. I have actually had to patch an application developed for MySQL uint8 to signed int8 on PostgreSQL. In that case, the only operations that were performed where assignment and lookup. If we need to use the n

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Ryan Bradetich
Tom, On Fri, Jul 25, 2008 at 12:32 PM, Tom Lane <[EMAIL PROTECTED]> wrote: > Consider the idea of not having any uint4-specific arithmetic operators, > but instead providing the following: > >* assignment casts from int4 and int8 to uint4 > (these throw error if out of range, of

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Tom Lane
"Ryan Bradetich" <[EMAIL PROTECTED]> writes: > ... I did have the following > concern looking through src/backend/utils/adt/int8.c: There is code that is > optionally compiled based on the INT64_IS_BUSTED pre-processor define. > Is this pre-processor define something I should worry about for porta

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Ryan Bradetich
Hello Dann, On Fri, Jul 25, 2008 at 1:06 PM, Dann Corbit <[EMAIL PROTECTED]> wrote: > At the cost of one bit of storage, you have compatible types using Thanks for your review and feedback! Unfortunately, I do need the full range of the unsigned types for the project I am looking at. The reaso

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Dann Corbit
> -Original Message- > From: Andrew Dunstan [mailto:[EMAIL PROTECTED] > Sent: Friday, July 25, 2008 1:28 PM > To: Dann Corbit > Cc: Tom Lane; Ryan Bradetich; Gregory Stark; pgsql- > [EMAIL PROTECTED] > Subject: Re: [HACKERS] [RFC] Unsigned integer support. > &

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Andrew Dunstan
Dann Corbit wrote: -Original Message- From: Andrew Dunstan [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2008 1:11 PM To: Dann Corbit Cc: Tom Lane; Ryan Bradetich; Gregory Stark; pgsql- [EMAIL PROTECTED] Subject: Re: [HACKERS] [RFC] Unsigned integer support. Dann Corbit wrote

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Dann Corbit
> -Original Message- > From: Andrew Dunstan [mailto:[EMAIL PROTECTED] > Sent: Friday, July 25, 2008 1:11 PM > To: Dann Corbit > Cc: Tom Lane; Ryan Bradetich; Gregory Stark; pgsql- > [EMAIL PROTECTED] > Subject: Re: [HACKERS] [RFC] Unsigned integer support. > &

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Andrew Dunstan
Dann Corbit wrote: CREATE DOMAIN usmallint AS SMALLINT CHECK(VALUE > 0); CREATE DOMAIN uinteger AS INTEGER CHECK(VALUE > 0); CREATE DOMAIN ubigint AS BIGINT CHECK(VALUE > 0); CREATE DOMAIN unumeric AS NUMERIC CHECK(VALUE > 0); s/>/>=/g cheers andrew -- Sent via pgsql-hackers mailing

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Dann Corbit
> -Original Message- > From: [EMAIL PROTECTED] [mailto:pgsql-hackers- > [EMAIL PROTECTED] On Behalf Of Tom Lane > Sent: Friday, July 25, 2008 12:32 PM > To: Ryan Bradetich > Cc: Gregory Stark; pgsql-hackers@postgresql.org > Subject: Re: [HACKERS] [RFC] Unsigned intege

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Tom Lane
"Ryan Bradetich" <[EMAIL PROTECTED]> writes: > On Fri, Jul 25, 2008 at 3:57 AM, Gregory Stark <[EMAIL PROTECTED]> wrote: >> "Ryan Bradetich" <[EMAIL PROTECTED]> writes: >>> My plans for the example above would be: >>> >>> 1. SELECT 15 + 15 --> Throws overflow error. >>> 2. SELECT

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Alvaro Herrera
Kevin Grittner escribió: > >>> Alvaro Herrera <[EMAIL PROTECTED]> wrote: > > > consider > > > > alvherre=# select 0.42 + 1; > > ?column? > > -- > > 1.42 > > (1 ligne) > > > > However, it would be neat if this behaved the same as > > > > alvherre=# select '0.42' + 1; > > ERROR:

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Kevin Grittner
>>> Alvaro Herrera <[EMAIL PROTECTED]> wrote: > consider > > alvherre=# select 0.42 + 1; > ?column? > -- > 1.42 > (1 ligne) > > However, it would be neat if this behaved the same as > > alvherre=# select '0.42' + 1; > ERROR: invalid input syntax for integer: "0.42" > STATEMENT

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Alvaro Herrera
Gregory Stark escribió: > "Alvaro Herrera" <[EMAIL PROTECTED]> writes: > > > Hmm, if we do that, how would the system resolve something like this? > > > > select 1000 + 1000 > > Well we have the same problem with 'foo' || 'bar'. The question I think is > whether the solution there scales to havin

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Gregory Stark
"Alvaro Herrera" <[EMAIL PROTECTED]> writes: > Hmm, if we do that, how would the system resolve something like this? > > select 1000 + 1000 Well we have the same problem with 'foo' || 'bar'. The question I think is whether the solution there scales to having two different fallback types. > There

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Alvaro Herrera
Gregory Stark escribió: > One other idea that's been mentioned before is treating integral constants > like 15 as type "unknown" like the quoted '15' constant is. That way > the parser would see uint4+unknown and could pick the uint4 operator. But that > would be a pretty massive semantics

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Ryan Bradetich
Hello Peter, On Fri, Jul 25, 2008 at 5:14 AM, Peter Eisentraut <[EMAIL PROTECTED]> wrote: > Am Friday, 25. July 2008 schrieb Ryan Bradetich: >> PgFoundry already has an uint project: >> http://pgfoundry.org/projects/uint/ >> >> Unfortunately this project seems to have not gone anywhere

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Ryan Bradetich
Hello Greg, On Fri, Jul 25, 2008 at 3:57 AM, Gregory Stark <[EMAIL PROTECTED]> wrote: > "Ryan Bradetich" <[EMAIL PROTECTED]> writes: > >> My plans for the example above would be: >> >> 1. SELECT 15 + 15 --> Throws overflow error. >> 2. SELECT 15::uint4 + 15 -->

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Peter Eisentraut
Am Friday, 25. July 2008 schrieb Ryan Bradetich: > PgFoundry already has an uint project: >         http://pgfoundry.org/projects/uint/ > >     Unfortunately this project seems to have not gone anywhere.  Last > activity was late 2006 and there are not any files checked into the > SCM repository. >

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-25 Thread Gregory Stark
"Ryan Bradetich" <[EMAIL PROTECTED]> writes: > My plans for the example above would be: > > 1. SELECT 15 + 15 --> Throws overflow error. > 2. SELECT 15::uint4 + 15 --> Returns 30::uint4. I think that wouldn't actually work. Postgres's parser immediatel

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-24 Thread Ryan Bradetich
Hello Tom, On Thu, Jul 24, 2008 at 10:10 PM, Tom Lane <[EMAIL PROTECTED]> wrote: > "Ryan Bradetich" <[EMAIL PROTECTED]> writes: >> I am looking to take advantage of PostgreSQL extensible type system >> and implement unsigned integer support. > > This has been proposed before, and foundered before

Re: [HACKERS] [RFC] Unsigned integer support.

2008-07-24 Thread Tom Lane
"Ryan Bradetich" <[EMAIL PROTECTED]> writes: > I am looking to take advantage of PostgreSQL extensible type system > and implement unsigned integer support. This has been proposed before, and foundered before on the question of implicit coercions. If you're willing to make all coercions *to* unsi

[HACKERS] [RFC] Unsigned integer support.

2008-07-24 Thread Ryan Bradetich
Hello hackers, I know the development community is in the middle of the July 2008 commit-fest, so I apologize if this design proposals are in appropriate at this time. I am looking to take advantage of PostgreSQL extensible type system and implement unsigned integer support. The data I am deali