alter column appears to work, but doesn't? - Mailing list pgsql-general

From Ron Peterson
Subject alter column appears to work, but doesn't?
Date
Msg-id 20110905183126.GA3061@mtholyoke.edu
Whole thread Raw
Responses Re: alter column appears to work, but doesn't?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I just updated a table to have a larger column size as follows.

alter table attributes_log alter column attribute_name type varchar(48);

The size was previously 24.

iddb=> \d attributes
                                               Table "iddb.attributes"
     Column     |         Type          |                                  Modifiers
----------------+-----------------------+-----------------------------------------------------------------------------
 attribute_id   | uuid                  | not null default (encode(pgcrypto.gen_random_bytes(16), 'hex'::text))::uuid
 attribute_name | character varying(48) | not null
 management     | character varying(24) | not null default 'by_value'::character varying

iddb=> insert into attributes ( attribute_name ) values ( 'abcdefghijklmnopqrstuvwxyz' );
ERROR:  value too long for type character varying(24)

I'm using PostgreSQL 9.0.4

I tried to replicate this with a new database and a simple table, but
could not.

I had to drop (and then recreate) three rules and a view on this table
before altering the column.

This is a production database, so I need to treat it gently.

--
Ron Peterson
Network & Systems Administrator
Mount Holyoke College
http://www.mtholyoke.edu/~rpeterso

pgsql-general by date:

Previous
From: MirrorX
Date:
Subject: Re: warm standby - apply wal archives
Next
From: Tom Lane
Date:
Subject: Re: alter column appears to work, but doesn't?