Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 9759A9FA52F for ; Thu, 18 Oct 2007 02:24:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 24368-04-2 for ; Thu, 18 Oct 2007 02:23:55 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 2FDF79FA4B7 for ; Thu, 18 Oct 2007 02:23:54 -0300 (ADT) Received: (qmail invoked by alias); 18 Oct 2007 05:23:49 -0000 Received: from static062038240172.dsl.hol.gr (EHLO [192.168.173.54]) [62.38.240.172] by mail.gmx.net (mp026) with SMTP; 18 Oct 2007 07:23:49 +0200 X-Authenticated: #16251240 X-Provags-ID: V01U2FsdGVkX1+/JdFVyIa/aX1uS+lf09qEKTdXaojwfHlGR6Qtx0 8iRs0ka6QIU7M7 Message-ID: <4716EDD7.7010104@gmx.net> Date: Thu, 18 Oct 2007 08:23:35 +0300 From: Kostis Mentzelos User-Agent: Thunderbird 1.5.0.13 (Windows/20070809) MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: convert char to varchar Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200710/161 X-Sequence-Number: 27075 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.