alter column appears to work, but doesn't?

From: Ron Peterson <rpeterso(at)mtholyoke(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: alter column appears to work, but doesn't?
Date: 2011-09-05 18:31:26
Message-ID: 20110905183126.GA3061@mtholyoke.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2011-09-05 18:44:11 Re: [GENERAL] pg_upgrade problem
Previous Message Bruce Momjian 2011-09-05 18:18:18 Re: [GENERAL] pg_upgrade problem