Re: Modify column type

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Scott David Walter" <sdw1(at)geneseo(dot)edu>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Modify column type
Date: 2002-08-20 01:56:53
Message-ID: GNELIHDDFBOCMGBFGEFOMEMFCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Scott,

I believe you can hack the catalogs: (disclaimer)

update pg_attribute set atttypmod=104 where attname='email' and
attrelid=(select oid from pg_class where relname='student');

Do this in a transaction and then \d the table to check that it has worked
before committing.

Chris

> -----Original Message-----
> From: pgsql-sql-owner(at)postgresql(dot)org
> [mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Scott David Walter
> Sent: Tuesday, 20 August 2002 12:46 AM
> To: pgsql-sql(at)postgresql(dot)org
> Subject: [SQL] Modify column type
>
>
> Is there a way to modify the type of an existing column? All I actually
> want to do is extend the length of the type from a VARCHAR(6) to
> VARCHAR(100).
>
>
> Column | Type | Modifiers
> ------------------------+-----------------------+------------------------
> email | character varying(6) | not null
>
>
> gold_program=> ALTER TABLE student MODIFY email varchar(100);
> ERROR: parser: parse error at or near "modify"
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Graeme Merrall 2002-08-20 02:47:29 Re: how to refer to tables in another database( or schema as oracle refers to)
Previous Message Christopher Kings-Lynne 2002-08-20 01:35:51 Re: how to refer to tables in another database( or schema as oracle refers to)