Skip site navigation (1) Skip section navigation (2)

numerics lose scale and precision in views of unions

From: "Brian C(dot) DeRocher" <brian(dot)derocher(at)mitretek(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: numerics lose scale and precision in views of unions
Date: 2006-08-09 21:24:41
Message-ID: 200608091724.41487.brian.derocher@mitretek.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
It appears that when you create a view of a union, numeric data types
loose their scale and precision.

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

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

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


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

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

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


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

Responses

pgsql-hackers by date

Next:From: Shoaib MirDate: 2006-08-09 21:31:58
Subject: Re: WIN32 Build?
Previous:From: korryd@enterprisedb.comDate: 2006-08-09 21:24:28
Subject: Re: Plugins redux (was Re: [PATCHES] PL instrumentation plugin

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-08-09 22:20:08
Subject: Re: numerics lose scale and precision in views of unions
Previous:From: Bruce MomjianDate: 2006-08-09 21:18:22
Subject: Re: [HACKERS] [PATCHES] BUG #2569: statement_timeout bug on

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group