Altering a CHAR(4) column CHAR(5) changing pg_attribute - Mailing list pgsql-general

From Denis Gasparin
Subject Altering a CHAR(4) column CHAR(5) changing pg_attribute
Date
Msg-id 1017137208.4772.11.camel@edspctec12
Whole thread Raw
Responses Re: Altering a CHAR(4) column CHAR(5) changing pg_attribute
List pgsql-general
I have a table with a column of type CHAR(4) and I want to change the
column type to CHAR(5). This table is referenced by many other tables
and dropping it and recreating will be a massacre...

So I have had this idea:
why do not change the row of that column in the pg_attribute system
table?

In particular my idea is to change the atttypmod from 8 to 9 (I have
thought char(5) is larger 1 byte than char(4)...then...).

Is this possible? There will be bad consequences for my table?
If anyone has any tip...

The related row is:

attrelid      = 18865
attname       = channel
atttypid      = 1042
attdispersion = 0.0022182
attlen        = -1
attnum        = 7
attnelems     = 0
attcacheoff   = -1
atttypmod     = 8
attbyval      = f
attstorage    = x
attisset      = f
attalign      = i
attnotnull    = t
atthasdef     = f

Thank to everyone for your replies...
--
Doct. Eng. Denis Gasparin: denis@edistar.com
---------------------------
Programmer & System Administrator - Edistar srl



pgsql-general by date:

Previous
From: Ferruccio Zamuner
Date:
Subject: Data integrity and sanity check
Next
From: "Gyorgy Molnar"
Date:
Subject: PL/pgsql return more than one values