decimal & numeric report bug

Поиск
Список
Период
Сортировка
Искать
От
José Soares
Тема
decimal & numeric report bug
Дата
Msg-id
3767A88D.A06E9097@sferacarta.com
Список
Дерево обсуждения
Re: [HACKERS] decimal & numeric report bug Thomas Lockhart <lockhart@alumni.caltech.edu>
DECIMA/NUMERCI Report bug:

CREATE TABLE Test (num DEC(7,2), flt8 FLOAT(15));
ERROR:  Unable to locate type name 'dec' in catalog

    The required syntax for DECIMAL is:
    DEC[IMAL] [ ( precision [ ,scale ] ) ]

    from SQL/92 draft:
        <exact numeric type> ::=
                NUMERIC [ <left paren> <precision> [ <comma> <scale> ] <right pa
              | DECIMAL [ <left paren> <precision> [ <comma> <scale> ] <right pa
              | DEC [ <left paren> <precision> [ <comma> <scale> ] <right paren>

       Remarks:   DECIMAL can be abbreviated as DEC.
 

CREATE TABLE Test (num DECimal(7,2), flt8 FLOAT(15));
CREATE
INSERT INTO Test VALUES (1,1);
INSERT 207242 1
INSERT INTO Test VALUES (2.343,2.343);
INSERT 207243 1
INSERT INTO Test VALUES (-3.0,-3.0);
INSERT 207244 1
select * from test;
  num| flt8
-----+-----
 1.00|    1
 2.34|2.343
-3.00|   -3
(3 rows)
 

--numeric and decimal doesn't support arithmetic operations with floats...

SELECT num-flt8 FROM Test;
ERROR:  Unable to identify an operator '-' for types 'numeric' and 'float8'
        You will have to retype this query using an explicit cast
SELECT num+flt8 FROM Test;
ERROR:  Unable to identify an operator '+' for types 'numeric' and 'float8'
        You will have to retype this query using an explicit cast
SELECT num*flt8 FROM Test;
ERROR:  Unable to identify an operator '*' for types 'numeric' and 'float8'
        You will have to retype this query using an explicit cast
SELECT num/flt8 FROM Test;
ERROR:  Unable to identify an operator '/' for types 'numeric' and 'float8'
        You will have to retype this query using an explicit cast
SELECT * FROM Test WHERE num < flt8;
ERROR:  Unable to identify an operator '<' for types 'numeric' and 'float8'
        You will have to retype this query using an explicit cast
 

--create operator doesn't know numeric/decimal type:

create operator < (
        leftarg=numeric,
        rightarg=float8,
        procedure=dec_float8_lt
        );
ERROR:  parser: parse error at or near "numeric"
--
___________________________________________________________________
PostgreSQL 6.5.0 on i586-pc-linux-gnulibc1, compiled by gcc 2.7.2.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jose'
 

В списке pgsql-hackers по дате отправления
От: José Soares
Дата:
Сообщение: having bug report
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Savepoints...
FAQ