pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Koczan <pjkoczan@gmail.com>
To: Kostis Mentzelos <mentzelos@gmx.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: convert char to varchar
Date: Thu, 18 Oct 2007 10:35:40 -0500
Message-ID: <4544e0330710180835h70aae76cm149bb671fed086ae@mail.gmail.com> (raw)
In-Reply-To: <4716EDD7.7010104@gmx.net>
References: <4716EDD7.7010104@gmx.net>

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

If you're running 8.x, you can do this in place:

ALTER TABLE c1 ALTER COLUMN name varchar(20) USING rtrim(name), ALTER
COLUMN date varchar(20) USING rtrim(date);

This could take a long time if the table is large or has a lot of indexes on it.

Peter



view thread (4+ messages)  latest in thread

Message-ID: <4544e0330710180835h70aae76cm149bb671fed086ae@mail.gmail.com>
Permalink:  ../4544e0330710180835h70aae76cm149bb671fed086ae@mail.gmail.com/
Also on:    postgresql.org/message-id/4544e0330710180835h70aae76cm149bb671fed086ae@mail.gmail.com

 · 

reply

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: pjkoczan@gmail.com, mentzelos@gmx.net
  Subject: Re: convert char to varchar
  In-Reply-To: <4544e0330710180835h70aae76cm149bb671fed086ae@mail.gmail.com>

* 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