Re: moving char() to varchar()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: moving char() to varchar()
Дата
Msg-id 4422.999895034@sss.pgh.pa.us
обсуждение исходный текст
Ответ на moving char() to varchar()  (Andrew Sullivan <andrew@libertyrms.com>)
Ответы Re: moving char() to varchar()
Список pgsql-general
Andrew Sullivan <andrew@libertyrms.com> writes:
> 1.    I thought the SQL spec required varchar() not to pad.  Is it
> just that, because of the way pg_dump saved the char() data (as
> blank-padded) that the varchar() field preserves the padded data?

Right.  Trailing blanks in the presented data *should* be preserved
by varchar; they're valid data, not pad, as far as the DB knows.

You could possibly make an argument that trailing blanks in a char()
column (which ARE known to be padding) should be stripped during dumping,
primarily for convenience in reloading into varchar columns.  But this
seems a tad weird and unexpected to me.  An explicit trim() operation
sounds like a better idea.

> 2.    I could _swear_ I did something very similar to this some
> time ago (version 6.5.x?  something like that?).

Could be.  I think we've tweaked the behavior a few times to get closer
to the SQL92 spec.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: What Is The Firing Order?
Следующее
От: David Ford
Дата:
Сообщение: Problem w/ dumping huge table and no disk space