Bug #513: union all changes char(3) column definition

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #513: union all changes char(3) column definition
Date: 2001-11-10 16:59:20
Message-ID: 200111101659.fAAGxKX06044@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Rae Stiening (stiening(at)cannon(dot)astro(dot)umass(dot)edu) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
union all changes char(3) column definition

Long Description
Rae Stiening stiening(at)cannon(dot)astro(dot)umass(dot)edu 11/10/2001
This script demonstrates the incorrect restoration of a
table created by a union under postgresql version 7.1.3.
CHANGE
DROP
CREATE
INSERT 2468415409 1
INSERT 2468415410 1
VACUUM
CHANGE
DROP
SELECT
rd_flg | cntr
--------+------
ABC | 1
DEF | 2
(2 rows)

rd_flg | cntr
--------+------
ABC | 1
DEF | 2
ABC | 1
DEF | 2
(4 rows)

DROP
You are now connected as new user postgres.
CREATE
rd_flg | cntr
--------+------
A | 1
D | 2
A | 1
D | 2
(4 rows)

The column rd_flg has not been restored properly. Note that
the column definition has changed from char(3) to character

Sample Code
echo Rae Stiening stiening(at)cannon(dot)astro(dot)umass(dot)edu 11/10/2001
echo This script demonstrates the incorrect restoration of a
echo table created by a union under postgresql version 7.1.3.
psql -c "revoke select on xyzzy from public" wsdb
psql -c "drop table xyzzy" wsdb
psql -c "create table xyzzy (rd_flg char(3),cntr integer)" wsdb
psql -c "insert into xyzzy values('ABC',1)" wsdb
psql -c "insert into xyzzy values('DEF',2)" wsdb
psql -c "vacuum analyze xyzzy" wsdb
psql -c "revoke select on zzxxyy from public" wsdb
psql -c "drop table zzxxyy" wsdb
psql -c "create table zzxxyy as
select * from xyzzy
union all
select * from xyzzy" wsdb
psql -c "select * from xyzzy" wsdb
psql -c "select * from zzxxyy" wsdb
pg_dump -t zzxxyy wsdb > zzxxyy.tbl
psql -c "drop table zzxxyy" wsdb
cat zzxxyy.tbl | psql wsdb
psql -c "select * from zzxxyy" wsdb
echo The column rd_flg has not been restored properly. Note that
echo the column definition has changed from char'('3')' to character

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-11-10 18:39:19 Re: Bug #513: union all changes char(3) column definition
Previous Message parksik 2001-11-10 14:29:25 run-time error!

Browse pgsql-hackers by date

  From Date Subject
Next Message Jean-Michel POURE 2001-11-10 17:29:56 Diff/Patch integration -> SQL cvs clone
Previous Message Bruce Momjian 2001-11-10 16:11:16 Re: RelationFlushRelation() or RelationClearRelation()