X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E1637D1B976 for ; Tue, 16 Dec 2003 17:45:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 80053-01 for ; Tue, 16 Dec 2003 13:45:02 -0400 (AST) Received: from ar-sd.net (unknown [81.196.32.112]) by svr1.postgresql.org (Postfix) with ESMTP id CA04CD1B8C2 for ; Tue, 16 Dec 2003 13:44:59 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id 012E61DC64; Tue, 16 Dec 2003 19:49:07 +0200 (EET) Received: from andyy (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id C82591BDE2; Tue, 16 Dec 2003 19:49:06 +0200 (EET) Message-ID: <004301c3c3fc$590f0f80$0b00a8c0@andyy> From: "Andrei Bintintan" To: "Jodi Kanter" , "Postgres Admin List" References: <3FDF4195.6040804@virginia.edu> Subject: Re: character type modification Date: Tue, 16 Dec 2003 19:45:08 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0040_01C3C40D.1C125BD0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.1 tagged_above=0.0 required=5.0 tests=ASCII_FORM_ENTRY, BAYES_30, DEAR_SOMETHING, HTML_40_50, QUOTED_EMAIL_TEXT, REFERENCES X-Spam-Level: ** X-Archive-Number: 200312/224 X-Sequence-Number: 11730 This is a multi-part message in MIME format. ------=_NextPart_000_0040_01C3C40D.1C125BD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable This is another discuttion about this problem. Please read these mails. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I cannot write here all the syntax: I'll give an example: you have a table called "person" and you have a column called "name" varchar(10) and you want to change it into varchar(25). alter person add column name_temp varchar(25); update person set name_temp =3D name; alter person drop column name; alter person rename column name_temp to name; This is it. Now depending on you database complexity if you have a complex database and a lot of indexes or triggers, you will have to drop these items and rebuild them. Have fun. Andy. ----- Original Message -----=20 From: "Chitta Ranjan Mishra" To: "Andrei Bintintan" Sent: Friday, December 12, 2003 5:46 AM Subject: [ADMIN] Help---- Urgent > Dear Sir, > Thanks for your reply. Kindly send me the syntax > for all this. > > Thanking you, > Regds > C.R.Mishra > > > > --- Andrei Bintintan wrote: > > Create a new column > > > > alter add column > > varchar(25); > > > > Then copy the old column into the new column: > > update set =3D ; > > > > Drop the last column: > > alter drop column ; > > > > Rename the column: > > alter rename column to > > ; > > > > Take care for INDEXES if there are any. > > > > This should do it. > > > > Best regards. > > > > > > ----- Original Message -----=20 > > From: "Chitta Ranjan Mishra" > > > > To: > > Sent: Thursday, December 11, 2003 7:19 AM > > Subject: [ADMIN] Help---- Urgent > > > > > > > Dear Sir, > > > I wnat to alter the size of one of the column > > of a > > > table. How to do this in Postgres ? Plz help me. > > > It's very urgent... > > > > > > I tried with the following syntax : > > > but it failed.... > > > > > > alter table tablename modify(coumnname > > varchar(25)); > > > > > > it's very urgnet...plz reply soon.. > > > > > > Thanking you, > > > Regds > > > C.R.Mishra > > > > > > > > > > > > > > > > > > ________________________________________________________________________ > > > Yahoo! India Mobile: Download the latest > > polyphonic ringtones. > > > Go to http://in.mobile.yahoo.com > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > > TIP 1: subscribe and unsubscribe commands go to > majordomo@postgresql.org > > ________________________________________________________________________ > Yahoo! India Mobile: Download the latest polyphonic ringtones. > Go to http://in.mobile.yahoo.com ----- Original Message -----=20 From: Jodi Kanter=20 To: Postgres Admin List=20 Sent: Tuesday, December 16, 2003 7:32 PM Subject: [ADMIN] character type modification Can I alter a column from character varying(128) to text without having t= o create a temp table? I am running 7.3.3. Thanks --=20 _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu ------=_NextPart_000_0040_01C3C40D.1C125BD0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
This is another discuttion about this=20 problem.
 
Please read these mails.
 
>>>>>>>>>>>>>>>>&g= t;>>>>>>>>>>>>>>>>>>&= gt;>>>>>>>>>>>>>>>>>>= >>>>
>>>>>>>>>>>>>>>>&g= t;>>>>>>>>>>>>>>>>>>&= gt;>>>>>>>>>>>>>>>>>>= >>>>
 
 
 
I cannot write here all the syntax:
I'll give an example: you have = a=20 table called "person" and you have a column
called "name" varchar(10) an= d you=20 want to change it into varchar(25).

alter person add column name_tem= p=20 varchar(25);
update person set name_temp =3D name;
alter person drop = column=20 name;
alter person rename column name_temp to name;

This is it. N= ow=20 depending on you database complexity if you have a complex
database and = a lot=20 of indexes or triggers, you will have to drop these items
and rebuild=20 them.

Have fun.
Andy.


----- Original Message -----=20
From: "Chitta Ranjan Mishra" <c_r_mishra@yahoo.co.in>
To= :=20 "Andrei Bintintan" <klodoma@ar-sd.net>
Sent: Friday= ,=20 December 12, 2003 5:46 AM
Subject: [ADMIN] Help---- Urgent


&g= t;=20 Dear Sir,
>     Thanks for your reply. Kindly sen= d me=20 the syntax
> for all this.
>
> Thanking you,
>=20 Regds
> C.R.Mishra
>
>
>
>  --- Andrei= =20 Bintintan <klodoma@ar-sd.net>= ;=20 wrote: >
> Create a new column
> >
> > alter=20 <tablename> add column <newcolname>
> >=20 varchar(25);
> >
> > Then copy the old column into the ne= w=20 column:
> > update <tablename> set <newcolname> =3D=20 <oldcolname>;
> >
> > Drop the last column:
>= >=20 alter <tablename> drop column <oldcolname>;
> >
>= ;=20 > Rename the column:
> > alter <tablename> rename column= =20 <newcolname> to
> > <oldcolname>;
> >
>= >=20 Take care for INDEXES if there are any.
> >
> > This shou= ld do=20 it.
> >
> > Best regards.
> >
> >
&g= t;=20 > ----- Original Message -----
> > From: "Chitta Ranjan=20 Mishra"
> > <c_r_mishra@yahoo.co.in>
&g= t; >=20 To: <pgsql-admin@postgresql.org&g= t;
>=20 > Sent: Thursday, December 11, 2003 7:19 AM
> > Subject: [ADMIN= ]=20 Help---- Urgent
> >
> >
> > > Dear Sir,
&g= t;=20 > >     I wnat to alter the size of one of the=20 column
> > of a
> > > table. How to do this in Postgre= s ?=20 Plz help me.
> > > It's very urgent...
> > >
>= ;=20 > > I tried with the following syntax :
> > > but it=20 failed....
> > >
> > > alter table tablename=20 modify(coumnname
> > varchar(25));
> > >
> > = >=20 it's very urgnet...plz reply soon..
> > >
> > > Tha= nking=20 you,
> > > Regds
> > > C.R.Mishra
> >=20 >
> > >
> > >
> > >
> >=20 >
> >
>=20 ________________________________________________________________________>=20 > > Yahoo! India Mobile: Download the latest
> > polyphonic= =20 ringtones.
> > > Go to http://in.mobile.yahoo.com
> = >=20 >
> > > ---------------------------(end of
> >=20 broadcast)---------------------------
> > > TIP 1: subscribe an= d=20 unsubscribe commands go to
> majordomo@postgresql.org
&g= t;
>=20 ________________________________________________________________________>=20 Yahoo! India Mobile: Download the latest polyphonic ringtones.
> Go t= o http://in.mobile.yahoo.com
----- Original Message -----
Fro= m:=20 Jodi= =20 Kanter
Sent: Tuesday, December 16, 2003 7= :32=20 PM
Subject: [ADMIN] character type=20 modification

Can I alter a column from character varying(128) to text= =20 without having to create a temp table? I am running 7.3.3.
Thanks
<= BR>
--

____________________________= ___
Jodi L Kanter
BioInformatics Database=20 Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu
<= SPAN=20 style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Arial">
<!--[if=20 !supportLineBreakNewLine]-->
<!--[endif]-->=

<!--[if=20 !supportEmptyParas]--> <!--[endif]-->

<!--[if=20 !supportEmptyParas]--> <!--[endif]-->=

<!--[if=20 !supportEmptyParas]--> <!--[endif]-->=

------=_NextPart_000_0040_01C3C40D.1C125BD0--