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

From Denis Gasparin
Subject Re: Altering a CHAR(4) column CHAR(5) changing
Date
Msg-id 1017216666.2115.3.camel@edspctec12
Whole thread Raw
In response to Re: Altering a CHAR(4) column CHAR(5) changing pg_attribute  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I have done my tests too and it worked... I think this is a thing to put
in the FAQ or in some other place... This will help all persons who have
to convert "textual" types between them without dropping and recreating
tables, indexes, etc...

Thank you for your help...

--
Doct. Eng. Denis Gasparin: denis@edistar.com
---------------------------
Programmer & System Administrator - Edistar srl


Il mar, 2002-03-26 alle 18:29, Tom Lane ha scritto:
> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> > If you were using varchar, this would be fine. With char, you have
> > issues with the padding spaces if you ever convert them to text
> > (for example using lower or upper).
>
> But you could do
>     update foo set mycol = mycol || '';
> after tweaking the atttypmod as Stephan illustrates.  That should force
> all the values to the correct length.  (The dummy concatenation is just
> to prevent the system from optimizing away the length coercion step.)
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



pgsql-general by date:

Previous
From: Rnd@gatewaynet.com
Date:
Subject: Re: C Function with Arrays Question
Next
From: Dominique ROUSSEAU
Date:
Subject: Re: INSERTs slow