numerics lose scale and precision in views of unions

Поиск
Список
Период
Сортировка
От Brian C. DeRocher
Тема numerics lose scale and precision in views of unions
Дата
Msg-id 200608091724.41487.brian.derocher@mitretek.org
обсуждение исходный текст
Ответы Re: numerics lose scale and precision in views of unions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
It appears that when you create a view of a union, numeric data types
loose their scale and precision.

db=3D> create table t1 (c1 numeric(4,2));
CREATE TABLE

db=3D> create view v1 as select c1 from t1;
CREATE VIEW

db=3D> \d v1
          View "brian.v1"
 Column |     Type     | Modifiers
--------+--------------+-----------
 c1     | numeric(4,2) |
View definition:
 SELECT t1.c1
   FROM t1;


db=3D> create view v2 as select c1 from t1 union select c1 from t1;
CREATE VIEW
db=3D> \d v2
       View "brian.v2"
 Column |  Type   | Modifiers
--------+---------+-----------
 c1     | numeric |
View definition:
 SELECT t1.c1
   FROM t1
UNION
 SELECT t1.c1
   FROM t1;

db=3D> create view v3 as select c1::numeric(4,2) from t1 union select c1::n=
umeric(4,2) from t1;
CREATE VIEW

db=3D> \d v3
       View "brian.v3"
 Column |  Type   | Modifiers
--------+---------+-----------
 c1     | numeric |
View definition:
 SELECT t1.c1
   FROM t1
UNION
 SELECT t1.c1
   FROM t1;


--=20
Brian C. DeRocher @ Mitretek Systems
This email was signed using OpenPGP.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] [PATCHES] BUG #2569: statement_timeout bug on
Следующее
От: Tom Lane
Дата:
Сообщение: Re: numerics lose scale and precision in views of unions