pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jodi Kanter <jkanter@virginia.edu>
Cc: Postgres Admin List <pgsql-admin@postgresql.org>
Subject: Re: character type modification
Date: Wed, 17 Dec 2003 03:02:18 -0500
Message-ID: <25915.1071648138@sss.pgh.pa.us> (raw)
In-Reply-To: <3FDF4195.6040804@virginia.edu>
References: <3FDF4195.6040804@virginia.edu>

Jodi Kanter <jkanter@virginia.edu> writes:
> Can I alter a column from character varying(128) to text without having 
> to create a temp table? I am running 7.3.3.

Yeah, if you're brave enough: change the column's atttypid to 'text'
(25, I think, but check it) and atttypmod to -1 in pg_attribute.
This is sufficient since the two datatypes have the same representation
--- in general you can't just hack atttypid at random, but it will
work in this case.

Highly advisable to practice this maneuver in a scratch database.

BTW, if you're running 7.3.3 and not 7.3.4 (even better 7.3.5), you are
not being brave but foolish.  7.3.3's WAL-startup-failure bug will get
you sooner or later.

			regards, tom lane



view thread (5+ messages)

Message-ID: <25915.1071648138@sss.pgh.pa.us>
Permalink:  ../25915.1071648138@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25915.1071648138@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jkanter@virginia.edu
  Subject: Re: character type modification
  In-Reply-To: <25915.1071648138@sss.pgh.pa.us>
  References: <3FDF4195.6040804@virginia.edu> <25915.1071648138@sss.pgh.pa.us>

* 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