Skip site navigation (1) Skip section navigation (2)

Re: character type modification

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jodi Kanter <jkanter(at)virginia(dot)edu>
Cc: Postgres Admin List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: character type modification
Date: 2003-12-17 08:02:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Jodi Kanter <jkanter(at)virginia(dot)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

In response to

pgsql-admin by date

Next:From: Paul PowerDate: 2003-12-17 08:39:49
Subject: createuser problem in 7.3.4 on Linux
Previous:From: Bruce MomjianDate: 2003-12-17 06:19:12
Subject: Re: Postgresql on software RAID

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group