convert char to varchar

Поиск
Список
Период
Сортировка
От Kostis Mentzelos
Тема convert char to varchar
Дата
Msg-id 4716EDD7.7010104@gmx.net
обсуждение исходный текст
Ответы Re: convert char to varchar  ("Rodrigo De León" <rdeleonp@gmail.com>)
Re: convert char to varchar  ("Peter Koczan" <pjkoczan@gmail.com>)
Список pgsql-admin
Hi all,
is it possible to convert character fields to character varying using
pg_dump/pg_restore?

this is my case:
I have a table with character fields:
CREATE TABLE c1 (name char(20), date char(20));
INSERT INTO c1 VALUES ('a',a');
INSERT INTO c1 VALUES ('b',b');

and another table with character varying fields:
CREATE TABLE v1 (name varchar(20), date varchar(20));

when I dump c1 and restore it to v1 my selections on v1 are failed
because the data on v1 table contains trailing spaces.
SELECT * FROM v1 WHERE name ='a'; (failed)

if I alter types on v1 to character and then back to character varying
the trailing spaces disappears and the above selection is ok.

Is there any other way to clear trailing spaces when I restore the table?

regards,
kostis.


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

Предыдущее
От: Jesper Krogh
Дата:
Сообщение: Re: Upgrade time, dump+restore trouble.
Следующее
От: yogesh
Дата:
Сообщение: Drop Not Null