From: | Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> |
---|---|
To: | Jan Wieck <jwieck(at)debis(dot)com>, t-ishii(at)sra(dot)co(dot)jp, hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] numeric data type on 6.5 |
Date: | 1999-04-28 03:25:15 |
Message-ID: | 37267F9B.FC9DE090@alumni.caltech.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > The problem is that the yacc parser already tries to convert
> > it into an integer or float if you omit the quotes.
> ... I'm going to try changing the code to leave a
> failed INTx token as a string of unspecified type, which would be
> typed and converted later using the automatic coersion mechanism.
OK, this seems to work:
postgres=> create table t1 (n numeric(20,0));
CREATE
postgres=> insert into t1 values ('10000000000000000000');
INSERT 18552 1
postgres=> insert into t1 values (20000000000000000000);
INSERT 18553 1
postgres=> select * from t1;
n
--------------------
10000000000000000000
20000000000000000000
postgres=> select n * 5000000000000000000000000000000 from t1;
---------------------------------------------------
50000000000000000000000000000000000000000000000000
100000000000000000000000000000000000000000000000000
But, there are some cases which aren't transparent:
postgres=> select 10000000000000000000000000*2;
ERROR: pg_atoi: error reading "10000000000000000000000000": Numerical
result out of range
postgres=> select 10000000000000000000000000*2::numeric;
--------------------------
20000000000000000000000000
And, if a long numeric string is entered, it actually stays a string
all the way through (never being converted to anything internal):
postgres=> select 400000000000000000000000000000000000000000000000000;
---------------------------------------------------
400000000000000000000000000000000000000000000000000
Comments?
btw, I've got some float8->numeric conversion troubles on my
i686/Linux box:
postgres=> insert into t1 values ('30000000000000000000'::float8);
INSERT 18541 1
postgres=> select * from t1;
n
------------------
3
Any ideas on this last one?
I'm running from this morning's development tree...
- Tom
--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California
From | Date | Subject | |
---|---|---|---|
Next Message | Vadim Mikheev | 1999-04-28 03:37:27 | Re: [HACKERS] Lock freeze ? in MVCC |
Previous Message | Chris Bitmead | 1999-04-28 00:39:49 | Re: [HACKERS] HSavage bug in Postgresql beta? |