Re: Is this safe to perform on PostgreSQL 8.3.7 -> Resize a column in a PostgreSQL table without changing data

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reid Thompson <Reid(dot)Thompson(at)ateb(dot)com>
Cc: "gryzman(at)gmail(dot)com" <gryzman(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is this safe to perform on PostgreSQL 8.3.7 -> Resize a column in a PostgreSQL table without changing data
Date: 2011-11-30 18:05:53
Message-ID: 24174.1322676353@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Reid Thompson <Reid(dot)Thompson(at)ateb(dot)com> writes:
> My assumption is that converting varchar(n) to text would still force a
> re-write of the table? i.e. currently there's no officially 'safe' way
> to convert the field type w/o incurring a table re-write.

If you do it through ALTER TABLE, yes. Since text and varchar are the
same thing on disk, you could get away with just manually updating the
pg_attribute row for the column ... but I'd counsel practicing on a
scratch database ;-)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message panam 2011-11-30 21:19:44 Re: Extending the volume size of the data directory volume
Previous Message Reid Thompson 2011-11-30 17:30:14 Re: Is this safe to perform on PostgreSQL 8.3.7 -> Resize a column in a PostgreSQL table without changing data