Re: How to alter the size of a column

From: mikeo <mikeo(at)spectrumtelecorp(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to alter the size of a column
Date: 2000-08-01 18:52:19
Message-ID: 3.0.1.32.20000801145219.0096a8f0@pop.spectrumtelecorp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sorry, forgot to include this address...

>Date: Tue, 01 Aug 2000 14:51:03 -0400
>To: "Cheng Kai" <chengk(at)isse(dot)kuis(dot)kyoto-u(dot)ac(dot)jp>
>From: mikeo <mikeo(at)spectrumtelecorp(dot)com>
>Subject: Re: [GENERAL] How to alter the size of a column
>In-Reply-To: <002301bffb6a$63dcc0a0$9b0210ac(at)cembaro>
>References: <200008010045(dot)RAA22022(at)cyberpass(dot)net>
<398625F7(dot)C22A345C(at)nimrod(dot)itg(dot)telecom(dot)com(dot)au>
>
>hi, i changed the size of a column using this method:
>
>tig4=# \d cust
> Table "cust"
> Attribute | Type | Modifier
>-------------------+-------------+------------------------------------------
> cust_id | varchar(15) | not null
> cut_id | varchar(6) | not null
> cust_name | varchar(50) | not null
> cust_division | varchar(6) |
> cust_svc_start_dt | date | not null default now()
> cust_svc_end_dt | date |
> cust_valid | char(1) | not null default 'Y'
> cust_bill_loc_id | varchar(6) | not null
> wu_id | varchar(10) | not null default 'SPECTRUM'
> cust_timestamp | timestamp | not null default now()
> agt_id | varchar(10) | default 'DEFAULT'
> rse_id | integer |
> bd_id | varchar(6) | not null
> cust_email | varchar(50) |
> cust_stream | integer | default nextval('cust_stream_seq'::text)
> br_cycle | integer |
> cust_qr_reports | varchar(20) |
> cust_qr_sent | timestamp |
>Indices: cust_cut_idx,
> cust_pkey,
> cust_stream_idx
>
>update pg_attribute set atttypmod = 19 where attname = 'cut_id' where
attrelid =
>(select oid from pg_class where relname = 'cust');
>
>
>tig4=# \d cust
> Table "cust"
> Attribute | Type | Modifier
>-------------------+-------------+------------------------------------------
> cust_id | varchar(15) | not null
> cut_id | varchar(15) | not null
> cust_name | varchar(50) | not null
> cust_division | varchar(6) |
> cust_svc_start_dt | date | not null default now()
> cust_svc_end_dt | date |
> cust_valid | char(1) | not null default 'Y'
> cust_bill_loc_id | varchar(6) | not null
> wu_id | varchar(10) | not null default 'SPECTRUM'
> cust_timestamp | timestamp | not null default now()
> agt_id | varchar(10) | default 'DEFAULT'
> rse_id | integer |
> bd_id | varchar(6) | not null
> cust_email | varchar(50) |
> cust_stream | integer | default nextval('cust_stream_seq'::text)
> br_cycle | integer |
> cust_qr_reports | varchar(20) |
> cust_qr_sent | timestamp |
>Indices: cust_cut_idx,
> cust_pkey,
> cust_stream_idx
>
>
>
>the number in atttypmod is 4 larger because it's a varchar column that i'm
>working with in this instance and the system uses those 4 bytes to keep
>track of the variable length of the column. i've never changed any other
>type of field, such as date or integer and i've only ever increased a
>varchar field. i'm sure that you'd have a problem if you try to reduce
>it and the table has values in there that are the current max size.
>
>mikeo
>
>
>At 12:41 PM 8/1/00 +0900, you wrote:
>>Hi,
>>
>> I want to alter the size of a column, say from char(40) to char(80),
>>but it seem that
>>the ALTER does not support such operation, nor does it support column
>>removing.
>>
>> How can I do for this ?
>>
>>
>> Thanks
>>

Browse pgsql-general by date

  From Date Subject
Next Message Felipe Alvarez Harnecker 2000-08-01 19:09:19 SQL guru needed
Previous Message hstenger 2000-08-01 18:44:57 Re: auto rollback