From: Kostis Mentzelos <mentzelos@gmx.net>
To: pgsql-admin@postgresql.org
Subject: convert char to varchar
Date: Thu, 18 Oct 2007 08:23:35 +0300
Message-ID: <4716EDD7.7010104@gmx.net> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: mentzelos@gmx.net
Subject: Re: convert char to varchar
In-Reply-To: <4716EDD7.7010104@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox