From: | "Tamsin" <tg_mail(at)bryncadfan(dot)co(dot)uk> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: Modify Column |
Date: | 2000-12-01 17:05:31 |
Message-ID: | NEBBKHBOBMJCHDMGKCNJGEPMCGAA.tg_mail@bryncadfan.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
This worked for me:
update pg_attribute set atttypmod = 104 where attname = 'column_name' and
attrelid = (select oid from pg_class where relname = 'tablename');
to set a varchar column 'columnname' in 'tablename' to a size of 100.
Tamsin
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of
> martin(dot)chantler(at)convergys(dot)com
> Sent: 01 December 2000 16:32
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Modify Column
>
>
>
>
> I don't know if you can use ALTER TABLE to do this
> but you could rename the old column, add a new column with
> the right name and size and use an UPDATE statement to
> copy the data in.
>
> Unfortunately I had problems dropping the old column since
> ALTER TABLE xxx DROP COLUMN zzzz is not implemented in
> the version on p-sql I'm using - I wonder if its in a later release???
> If not you might have to create a whole new table and copy the data
> in with a INSERT INTO xxx SELECT * from zzz;
>
> Hope this helps, maybe someone else knows the ultimate way of
> doing this :)
>
> MC
>
>
>
>
>
> joe(at)jwebmedia(dot)com on 01/12/2000 15:23:03
>
> Please respond to joe(at)jwebmedia(dot)com
>
> To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
> cc: (bcc: Martin Chantler/CIMG/CVG)
> Subject: [GENERAL] Modify Column
>
>
>
>
> This seems like a simple enough thing, and I'm sure it's been answered,
> but I couldn't find anything that helped in the archives. Basically, I
> have a column in my table that was, once upon a time, large enough, but
> now, I need to increase the site of the column. How can I do that?
> Thanks,
>
> Joe
>
>
>
>
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Valter Mazzola | 2000-12-01 17:11:21 | Re: Database cluster? |
Previous Message | joe | 2000-12-01 16:54:38 | Re: Modify Column |