moving char() to varchar()

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема moving char() to varchar()
Дата
Msg-id 20010907152132.B29953@mail.libertyrms.com
обсуждение исходный текст
Ответы Re: moving char() to varchar()
Re: moving char() to varchar()
Re: moving char() to varchar()
Список pgsql-general
Hi,

The developers of our application changed a number of fields from
char() to varchar() (which was a Good Thing, for reasons I won't bore
you with).  Now, I thought I could just do a pg_dump -a on the
database, create the new schema, and load the old data into the new
schema, and the new varchar() columns would be trimmed.  They're
not, however: they get blank-padded to the old length.  Obviously,
the answer is to go through and trim() all the columns; not a
problem.  But I have two questions.

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?

2.    I could _swear_ I did something very similar to this some
time ago (version 6.5.x?  something like that?).  Am I just imagining
things?  (I'm perfectly prepared to accept that, by the way.  My
memory is about as reliable these days as the DIMM I took out of my
PC last week.  That's why I need a good DBMS like postgres!)

A
--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.com>                               M6K 3E3
                                         +1 416 646 3304 x110


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: What Is The Firing Order?
Следующее
От: Haroldo Stenger
Дата:
Сообщение: Abort state on duplicated PKey in transactions