From: | "Paolo Negri" <hungrylist(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | ALTER column TYPE varying question |
Date: | 2007-03-12 15:02:52 |
Message-ID: | b242f69c0703120802j74edbd9eq9c3203a4fd2870d1@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need to increase the length of a string field using version 8.1
I was thinking to use ALTER TABLE since now altering a column type
should be supported by pg.
The column is currently varying(60) and I want to have it varying(120)
After executing
ALTER TABLE mytable ALTER COLUMN mycolumn TYPE varchar(120)
I can see the column definition correctly changes and I can insert
rows with longer data in mycolumn.
But when I try to update data which were in the table before the ALTER
TABLE I get
"ERROR: value too long for type character varying(60)"
It's like the old rows didn't update correctly keeping the old maximum length.
I can see there's an optional USING clause for the ALTER TYPE, but is
not really clear to me what should i add in this case, since basically
I'd need no convertion...
Thanks
Paolo
From | Date | Subject | |
---|---|---|---|
Next Message | Joost Kraaijeveld | 2007-03-12 15:20:45 | Re: [GENERAL] PostgreSQL crashes on Windows 2003 |
Previous Message | Tom Lane | 2007-03-12 14:41:21 | Re: Is This A Set Based Solution? |