Re: [GENERAL] Smartest way to resize a column?

2009-03-04 Thread Ow Mun Heng
On Mon, 2009-01-12 at 14:42 +0800, Phoenix Kiula wrote: ALTER COLUMN TYPE is intended for cases where actual transformation of the data is involved. Obviously varchar(20) to varchar(35) doesn't really require any per-row effort, but there's no operation in the system that handles that

Re: [GENERAL] Smartest way to resize a column?

2009-02-03 Thread Phoenix Kiula
On Tue, Feb 3, 2009 at 3:33 PM, Alban Hertroys dal...@solfertje.student.utwente.nl wrote: On Feb 3, 2009, at 5:21 AM, Phoenix Kiula wrote: On Mon, Jan 12, 2009 at 1:02 PM, Tom Lane t...@sss.pgh.pa.us wrote: .snip regression=# update pg_attribute set atttypmod = 35+4 where attrelid =

Re: [GENERAL] Smartest way to resize a column?

2009-02-02 Thread Phoenix Kiula
On Mon, Jan 12, 2009 at 1:02 PM, Tom Lane t...@sss.pgh.pa.us wrote: .snip regression=# update pg_attribute set atttypmod = 35+4 where attrelid = 't1'::regclass and attname = 'f1'; UPDATE 1 regression=# \d t1 Table public.t1 Column | Type | Modifiers

Re: [GENERAL] Smartest way to resize a column?

2009-02-02 Thread Tom Lane
Phoenix Kiula phoenix.ki...@gmail.com writes: Tom, this has worked, and a \d TABLENAME shows that the column is varchar(35). But I still have messages in my log saying: ERROR: value too long for type character varying(20) Cached plans maybe? regards, tom lane --

Re: [GENERAL] Smartest way to resize a column?

2009-02-02 Thread Phoenix Kiula
On Tue, Feb 3, 2009 at 1:30 PM, Tom Lane t...@sss.pgh.pa.us wrote: Phoenix Kiula phoenix.ki...@gmail.com writes: Tom, this has worked, and a \d TABLENAME shows that the column is varchar(35). But I still have messages in my log saying: ERROR: value too long for type character varying(20)

Re: [GENERAL] Smartest way to resize a column?

2009-02-02 Thread Alban Hertroys
On Feb 3, 2009, at 5:21 AM, Phoenix Kiula wrote: On Mon, Jan 12, 2009 at 1:02 PM, Tom Lane t...@sss.pgh.pa.us wrote: .snip regression=# update pg_attribute set atttypmod = 35+4 where attrelid = 't1'::regclass and attname = 'f1'; UPDATE 1 regression=# \d t1 Table

Re: [GENERAL] Smartest way to resize a column?

2009-01-11 Thread Ian Barwick
2009/1/12 Phoenix Kiula phoenix.ki...@gmail.com: I am trying to resize a column on a large-ish database (with 5 million rows). The column was 20 characters before, now I want to make it 35 characters. Challenge is: this is the main indexed column in a busy database. I tried looking at the

Re: [GENERAL] Smartest way to resize a column?

2009-01-11 Thread Adrian Klaver
On Sunday 11 January 2009 5:07:31 pm Phoenix Kiula wrote: I am trying to resize a column on a large-ish database (with 5 million rows). The column was 20 characters before, now I want to make it 35 characters. Challenge is: this is the main indexed column in a busy database. I tried

Re: [GENERAL] Smartest way to resize a column?

2009-01-11 Thread Phoenix Kiula
On Mon, Jan 12, 2009 at 9:12 AM, Ian Barwick barw...@gmail.com wrote: 2009/1/12 Phoenix Kiula phoenix.ki...@gmail.com: I am trying to resize a column on a large-ish database (with 5 million rows). ALTER TABLE users ALTER COLUMN name TYPE VARCHAR(35) HTH Thanks! I guess I was missing the

Re: [GENERAL] Smartest way to resize a column?

2009-01-11 Thread Adrian Klaver
On Sunday 11 January 2009 5:21:46 pm Phoenix Kiula wrote: On Mon, Jan 12, 2009 at 9:12 AM, Ian Barwick barw...@gmail.com wrote: 2009/1/12 Phoenix Kiula phoenix.ki...@gmail.com: I am trying to resize a column on a large-ish database (with 5 million rows). ALTER TABLE users ALTER COLUMN

Re: [GENERAL] Smartest way to resize a column?

2009-01-11 Thread Tom Lane
Adrian Klaver akla...@comcast.net writes: On Sunday 11 January 2009 5:21:46 pm Phoenix Kiula wrote: On Mon, Jan 12, 2009 at 9:12 AM, Ian Barwick barw...@gmail.com wrote: 2009/1/12 Phoenix Kiula phoenix.ki...@gmail.com: I am trying to resize a column on a large-ish database (with 5 million

Re: [GENERAL] Smartest way to resize a column?

2009-01-11 Thread Phoenix Kiula
ALTER COLUMN TYPE is intended for cases where actual transformation of the data is involved. Obviously varchar(20) to varchar(35) doesn't really require any per-row effort, but there's no operation in the system that handles that case. But if you're brave, you can do it via manipulation of