From jkanter@virginia.edu Fri Jan 18 14:53:54 2002 Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by postgresql.org (8.11.3/8.11.4) with SMTP id g0IErqV57080 for ; Fri, 18 Jan 2002 09:53:54 -0500 (EST) (envelope-from jkanter@virginia.edu) Received: from smtp.mail.virginia.edu by mail.virginia.edu id aa07351; 18 Jan 2002 9:53 EST Received: from jlk3xpc (d-128-19-222.bootp.Virginia.EDU [128.143.19.222]) by smtp.mail.Virginia.EDU (8.9.3/8.9.3) with SMTP id JAA34550 for ; Fri, 18 Jan 2002 09:53:52 -0500 Message-ID: <00a401c1a030$3dfd0130$de138f80@virginia.edu> From: Jodi Kanter To: Postgres Admin List Subject: adding fields Date: Fri, 18 Jan 2002 09:55:59 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00A1_01C1A006.5506EE10" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200201/117 X-Sequence-Number: 3004 This is a multi-part message in MIME format. ------=_NextPart_000_00A1_01C1A006.5506EE10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I need to add a field to an existing table that contains a good amount of d= ata. Do I need to drop table, recreate, and then reload data to do this? I = cannot seem to find any documentation to say otherwise. Thanks Jodi=20 _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu =20 =20 =20 ------=_NextPart_000_00A1_01C1A006.5506EE10 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I need to add a field to an existing table that contains a good amount= of=20 data. Do I need to drop table, recreate, and then reload data to do this? I= =20 cannot seem to find any documentation to say otherwise.
Thanks
Jodi

_______________________________
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu

 

 

 

<= /DIV> ------=_NextPart_000_00A1_01C1A006.5506EE10-- From f.helmberger@uptime.at Fri Jan 18 15:15:23 2002 Received: from dl380.matrixware.at ([62.116.87.11]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0IFFNV65279 for ; Fri, 18 Jan 2002 10:15:23 -0500 (EST) (envelope-from f.helmberger@uptime.at) Received: from florianpc (fw.uptime.at [62.116.87.2]) by dl380.matrixware.at (8.11.6/8.11.0) with SMTP id g0IFFOh18298; Fri, 18 Jan 2002 16:15:24 +0100 From: "Florian Helmberger" To: "Jodi Kanter" Cc: Subject: Re: adding fields Date: Fri, 18 Jan 2002 16:14:39 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0038_01C1A03B.3AACEAD0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <00a401c1a030$3dfd0130$de138f80@virginia.edu> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal X-Archive-Number: 200201/120 X-Sequence-Number: 3007 This is a multi-part message in MIME format. ------=_NextPart_000_0038_01C1A03B.3AACEAD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi. You should use ALTER TABLE ADD COLUMN ; instead. Also, take a look at the docs: http://www.postgresql.org/idocs/index.php?sql-altertable.html Cheers, Florian -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Jodi Kanter Sent: Friday, January 18, 2002 3:56 PM To: Postgres Admin List Subject: [ADMIN] adding fields I need to add a field to an existing table that contains a good amount of data. Do I need to drop table, recreate, and then reload data to do this? I cannot seem to find any documentation to say otherwise. Thanks Jodi _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu ------=_NextPart_000_0038_01C1A03B.3AACEAD0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi.
 
You should use
 
  ALTER TABLE <table> ADD COLUMN <column>=20 <datatyp>;
 
instead. Also, take a look at the=20 docs:
 
  http= ://www.postgresql.org/idocs/index.php?sql-altertable.html=
 
Cheers,
Florian
-----Original Message-----
From:=20 pgsql-admin-owner@postgresql.org=20 [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Jodi=20 Kanter
Sent: Friday, January 18, 2002 3:56 PM
To: Pos= tgres=20 Admin List
Subject: [ADMIN] adding fields

I need to add a field to an existing table that contains a good amou= nt of=20 data. Do I need to drop table, recreate, and then reload data to do this?= I=20 cannot seem to find any documentation to say otherwise.
Thanks
Jodi

_______________________________
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu
<= SPAN=20 style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt;= mso-fareast-font-family: 'MS Mincho'">

 

 

 

------=_NextPart_000_0038_01C1A03B.3AACEAD0-- From jkanter@virginia.edu Fri Jan 18 15:18:06 2002 Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by postgresql.org (8.11.3/8.11.4) with SMTP id g0IFI6V65438 for ; Fri, 18 Jan 2002 10:18:06 -0500 (EST) (envelope-from jkanter@virginia.edu) Received: from smtp.mail.virginia.edu by mail.virginia.edu id aa04162; 18 Jan 2002 10:18 EST Received: from jlk3xpc (d-128-19-222.bootp.Virginia.EDU [128.143.19.222]) by smtp.mail.Virginia.EDU (8.9.3/8.9.3) with SMTP id KAA24444; Fri, 18 Jan 2002 10:18:05 -0500 Message-ID: <00b601c1a033$a026acf0$de138f80@virginia.edu> From: Jodi Kanter To: Florian Helmberger Cc: pgsql-admin@postgresql.org MMDF-Warning: Parse error in original version of preceding line at mail.virginia.edu References: Subject: Re: adding fields Date: Fri, 18 Jan 2002 10:20:13 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00B3_01C1A009.B73072C0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200201/118 X-Sequence-Number: 3005 This is a multi-part message in MIME format. ------=_NextPart_000_00B3_01C1A009.B73072C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thank you. I found this doc just after I sent the email. I appreciate the q= uick response. Jodi ----- Original Message -----=20 From: Florian Helmberger=20 To: Jodi Kanter=20 Cc: pgsql-admin@postgresql.org=20 Sent: Friday, January 18, 2002 10:14 AM Subject: RE: [ADMIN] adding fields Hi. =20=20=20 You should use =20=20=20 ALTER TABLE
ADD COLUMN ; =20=20=20 instead. Also, take a look at the docs: =20=20=20 http://www.postgresql.org/idocs/index.php?sql-altertable.html =20=20=20 Cheers, Florian -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgr= esql.org]On Behalf Of Jodi Kanter Sent: Friday, January 18, 2002 3:56 PM To: Postgres Admin List Subject: [ADMIN] adding fields I need to add a field to an existing table that contains a good amount = of data. Do I need to drop table, recreate, and then reload data to do this= ? I cannot seem to find any documentation to say otherwise. Thanks Jodi=20 _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu =20=20=20=20=20 =20=20=20=20=20 =20=20=20=20=20 ------=_NextPart_000_00B3_01C1A009.B73072C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Thank you. I found this doc just after I sent the email. I appreciate = the=20 quick response.
Jodi
----- Original Message -----
Fro= m:=20 = Florian=20 Helmberger
Cc: pgsql-admin@postgresql.org
Sent: Friday, January 18, 2002 10:= 14=20 AM
Subject: RE: [ADMIN] adding fields=

Hi.
 
You should use
 
  ALTER TABLE <table> ADD COLUMN <column>=20 <datatyp>;
 
instead. Also, take a look at the=20 docs:
 
  ht= tp://www.postgresql.org/idocs/index.php?sql-altertable.html
 
Cheers,
Florian
-----Original Message-----
From: pgsql-admin-owner@post= gresql.org=20 [mailto:pgsql-admin-own= er@postgresql.org]On=20 Behalf Of Jodi Kanter
Sent: Friday, January 18, 2002 3:56= =20 PM
To: Postgres Admin List
Subject: [ADMIN] adding= =20 fields

I need to add a field to an existing table that contains a good am= ount=20 of data. Do I need to drop table, recreate, and then reload data to do = this?=20 I cannot seem to find any documentation to say otherwise.
Thanks
Jodi

_______________________________
=
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu

 

 

 

------=_NextPart_000_00B3_01C1A009.B73072C0-- From hjohnson@nypost.com Fri Jan 18 15:23:59 2002 Received: from ms1.nypost.com ([65.209.114.183]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0IFNxV68853 for ; Fri, 18 Jan 2002 10:23:59 -0500 (EST) (envelope-from hjohnson@nypost.com) Received: from NYPOST-EXCHANGE.1211.nypost.com (172.16.1.117) by ms1.nypost.com (Worldmail 1.3.167); 18 Jan 2002 10:24:02 -0500 Received: from SEPHIE ([172.16.11.81]) by NYPOST-EXCHANGE.1211.nypost.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id W75RJ5H4; Fri, 18 Jan 2002 10:19:07 -0500 Message-ID: <00cc01c1a033$c2df39b0$510b10ac@sephie> From: "Heather Johnson" To: "Jodi Kanter" , "Postgres Admin List" References: <00a401c1a030$3dfd0130$de138f80@virginia.edu> Subject: Re: adding fields Date: Fri, 18 Jan 2002 10:21:11 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00C9_01C1A009.DA019090" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Archive-Number: 200201/119 X-Sequence-Number: 3006 This is a multi-part message in MIME format. ------=_NextPart_000_00C9_01C1A009.DA019090 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Jodi-- No, you shouldn't have to go to that amount of trouble. Try this instead (c= hange the name of the table, the default value, the column name, and the co= lumn type to suit your needs): BEGIN WORK; LOCK TABLE table_adding_stuff_to IN ACCESS EXCLUSIVE MODE; ALTER TABLE table_adding_stuff_to ADD COLUMN new_column_name COLUMNTYPE; ALTER TABLE table_adding_stuff_to ALTER COLUMN new_column_name SET DEFAULT = 'default value'; =20 COMMIT WORK;=20 Then you can do: BEGIN WORK; UPDATE table_adding_stuff_to SET new_column_name =3D 'default value'; COMMIT WORK;=20 Heather ----- Original Message -----=20 From: Jodi Kanter=20 To: Postgres Admin List=20 Sent: Friday, January 18, 2002 9:55 AM Subject: [ADMIN] adding fields I need to add a field to an existing table that contains a good amount of= data. Do I need to drop table, recreate, and then reload data to do this? = I cannot seem to find any documentation to say otherwise. Thanks Jodi=20 _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu =20=20=20 =20=20=20 =20=20=20 ------=_NextPart_000_00C9_01C1A009.DA019090 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi Jodi--
 
No, you shouldn't have to go to that amoun= t of=20 trouble. Try this instead (change the name of the table, the default value,= the=20 column name, and the column type to suit your needs):
 
BEGIN WORK;
LOCK=20 TABLE table_adding_stuff_to IN ACCESS EXCLUSIVE MODE;
 
ALTER TABLE table_adding_stuff_to ADD COLU= MN=20 new_column_name COLUMNTYPE;
ALTER TABLE table_adding_stuff_to ALTER COLU= MN=20 new_column_name SET DEFAULT 'default value';
 
COMMIT WORK;=20
 
Then you can do:
 
BEGIN WORK;
UPDATE table_adding_stuff_to SET new_colum= n_name =3D=20 'default value';
COMMIT WORK;
 
Heather
----- Original Message -----
Fro= m:=20 Jodi= =20 Kanter
Sent: Friday, January 18, 2002 9:5= 5=20 AM
Subject: [ADMIN] adding fields

I need to add a field to an existing table that contains a good amou= nt of=20 data. Do I need to drop table, recreate, and then reload data to do this?= I=20 cannot seem to find any documentation to say otherwise.
Thanks
Jodi

_______________________________
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu
<= SPAN=20 style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt;= mso-fareast-font-family: 'MS Mincho'">

 

 

 

------=_NextPart_000_00C9_01C1A009.DA019090--