OK, I give up :) How do I use the numeric type?

postgres=> create table n1 (n numeric(10,5), d decimal(10,5));
CREATE
postgres=> insert into n1 values ('1.23456', '1.23456');
ERROR:  overflow on numeric
        ABS(value) >= 10^0 for field with precision 2087 scale 31828
postgres=> insert into n1 values ('12345.23456', '1.23456');
ERROR:  overflow on numeric
        ABS(value) >= 10^4 for field with precision 2087 scale 50860

                 - Tom

Wed, 06 Jan 1999 02:29:15 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Numeric type
> OK, I give up :) How do I use the numeric type?
> 
> postgres=> create table n1 (n numeric(10,5), d decimal(10,5));
> CREATE
> postgres=> insert into n1 values ('1.23456', '1.23456');
> ERROR:  overflow on numeric
>         ABS(value) >= 10^0 for field with precision 2087 scale 31828
> postgres=> insert into n1 values ('12345.23456', '1.23456');
> ERROR:  overflow on numeric
>         ABS(value) >= 10^4 for field with precision 2087 scale 50860
> 

Works here.  Don't you hate when that happens:
	
	test=> create table n1 (n numeric(10,5), d decimal(10,5));
	CREATE
	test=> insert into n1 values ('1.23456', '1.23456');
	INSERT 18602 1
	test=> insert into n1 values ('12345.23456', '1.23456');
	INSERT 18603 1
	test=> select * from n1;
	          n|      d
	-----------+-------
	    1.23456|1.23456
	12345.23456|1.23456
	(2 rows)


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Tue, 5 Jan 1999 21:33:28 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Numeric type
> > OK, I give up :) How do I use the numeric type?
> Works here.  Don't you hate when that happens:

postgres=> create table n1 (n numeric(10,5), d decimal(10,5));
CREATE
postgres=> insert into n1 values ('1.23456', '1.23456');
ERROR:  overflow on numeric
        ABS(value) >= 10^0 for field with precision 2086 scale 53380

*sigh* 

Any hints on where to look? I did a CVSup update, then a "cvs -PdA" on
my development tree, a "make clean install" and an initdb. I did not try
a full clean checkout, but would think that it wouldn't help.

Anyone else running on Linux/i686/libc5 having success? If so, I'll go
back to working on outer joins...

                   - Tom

Wed, 06 Jan 1999 15:15:11 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] Numeric type
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu> writes:
>>>> OK, I give up :) How do I use the numeric type?
>> Works here.  Don't you hate when that happens:

> Any hints on where to look? I did a CVSup update, then a "cvs -PdA" on
> my development tree, a "make clean install" and an initdb.

Maybe you need to repeat the "configure" step?  If Jan made any changes
in Makefile.in's, config.h.in, etc, then failing to reconfigure would
mean building with old files.

I tend to do "make distclean" before any CVS update and "configure"
afterwards...

			regards, tom lane

Wed, 06 Jan 1999 10:26:34 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Numeric type 
>
> > > OK, I give up :) How do I use the numeric type?
> > Works here.  Don't you hate when that happens:
>
> postgres=> create table n1 (n numeric(10,5), d decimal(10,5));
> CREATE
> postgres=> insert into n1 values ('1.23456', '1.23456');
> ERROR:  overflow on numeric
>         ABS(value) >= 10^0 for field with precision 2086 scale 53380
>
> *sigh*
>
> Any hints on where to look? I did a CVSup update, then a "cvs -PdA" on
> my development tree, a "make clean install" and an initdb. I did not try
> a full clean checkout, but would think that it wouldn't help.

    Seems to me like the typmod value given to

        Numeric numeric(Numeric num, int dummy, int32 typmod)

    got  mangled  up  somewhere.  First you should check that the
    atttypmod in pg_attribute for n1.n and n1.d  is  correct.  It
    should have the value

        ((precision << 16) | scale) + 4

    and must be 655369 for a numeric(10,5).

    If   that   isn't   the  case,  you  might  take  a  look  at
    include/nodes/parsenodes.h.   The  typmod  field  of   struct
    TypeName  should  be  of int32 (I changed that shortly before
    moving numeric into the backend).

    If that isn't the error, it would be good if you're a  little
    familiar  with  gdb.  If  so,  set  a  breakpoint on function
    numeric()  and  try  to  find  where   on   it's   way   from
    pg_attribute.atttypmod  to  the  call  to  numeric()  it  got
    mangled up.

>
> Anyone else running on Linux/i686/libc5 having success? If so, I'll go
> back to working on outer joins...
>
>                    - Tom
>


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #



Wed, 6 Jan 1999 16:48:50 +0100 (MET)
jwieck@debis.com (Jan Wieck)
Re: [HACKERS] Numeric type
> 
> *sigh* 
> 
> Any hints on where to look? I did a CVSup update, then a "cvs -PdA" on
> my development tree, a "make clean install" and an initdb. I did not try
> a full clean checkout, but would think that it wouldn't help.
> 
> Anyone else running on Linux/i686/libc5 having success? If so, I'll go
> back to working on outer joins...

I assume it is some OS thing.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 6 Jan 1999 11:01:50 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Numeric type
On Wed, 6 Jan 1999, Thomas G. Lockhart wrote:

> Date: Wed, 06 Jan 1999 15:15:11 +0000
> From: "Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
> To: Bruce Momjian <maillist@candle.pha.pa.us>
> Cc: jwieck@debis.com, hackers@postgreSQL.org
> Subject: Re: [HACKERS] Numeric type
> 
> > > OK, I give up :) How do I use the numeric type?
> > Works here.  Don't you hate when that happens:
> 
> postgres=> create table n1 (n numeric(10,5), d decimal(10,5));
> CREATE
> postgres=> insert into n1 values ('1.23456', '1.23456');
> ERROR:  overflow on numeric
>         ABS(value) >= 10^0 for field with precision 2086 scale 53380
> 
> *sigh* 
> 
> Any hints on where to look? I did a CVSup update, then a "cvs -PdA" on
> my development tree, a "make clean install" and an initdb. I did not try
> a full clean checkout, but would think that it wouldn't help.
> 
> Anyone else running on Linux/i686/libc5 having success? If so, I'll go
> back to working on outer joins...
> 

On my Linux box/i586/libc5, postgresql 6.4.2:

test=> create table n1 (n numeric(10,5), d decimal(10,5));
ERROR:  NUMERIC precision 10 must be 9
test=>

Something weird ! I compiled postgres 6.4.2 after applying Jan's feature
patch and configure --enable-locale

	Oleg

>                    - Tom
> 

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


Wed, 6 Jan 1999 19:28:56 +0300 (MSK)
Oleg Bartunov <oleg@sai.msu.su>
Re: [HACKERS] Numeric type
Oleg Bartunov wrote:

> On my Linux box/i586/libc5, postgresql 6.4.2:
>
> test=> create table n1 (n numeric(10,5), d decimal(10,5));
> ERROR:  NUMERIC precision 10 must be 9
> test=>
>
> Something weird ! I compiled postgres 6.4.2 after applying Jan's feature
> patch and configure --enable-locale

    Not  weird.  The  new  NUMERIC  datatype (arbitrary precision
    numeric format) isn't part of the v6.4 tree and will not  be.

    It's  only  in the current development tree which will become
    v6.5.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #



Wed, 6 Jan 1999 18:09:48 +0100 (MET)
jwieck@debis.com (Jan Wieck)
Re: [HACKERS] Numeric type