Re: Altering a CHAR(4) column CHAR(5) changing pg_attribute

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Altering a CHAR(4) column CHAR(5) changing pg_attribute
Дата
Msg-id 29225.1017163747@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Altering a CHAR(4) column CHAR(5) changing pg_attribute  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: Altering a CHAR(4) column CHAR(5) changing  (Denis Gasparin <denis@edistar.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Sonia Sanchez Diaz
Дата:
Сообщение: Performance in subconsult
Следующее
От: postgresql@fruru.com
Дата:
Сообщение: Re: Performance in subconsult