From: | Denis Gasparin <denis(at)edistar(dot)com> |
---|---|
To: | Postgresql General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Altering a CHAR(4) column CHAR(5) changing |
Date: | 2002-03-27 08:11:06 |
Message-ID: | 1017216666.2115.3.camel@edspctec12 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)edistar(dot)com
---------------------------
Programmer & System Administrator - Edistar srl
Il mar, 2002-03-26 alle 18:29, Tom Lane ha scritto:
> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)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(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | tsmets | 2002-03-27 08:38:58 | Re: Test data sets |
Previous Message | Rnd | 2002-03-27 07:37:27 | Re: C Function with Arrays Question |