X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8CFB5D1BA74 for ; Wed, 20 Aug 2003 12:50:57 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 95470-03 for ; Wed, 20 Aug 2003 12:50:47 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 7F563D1B8CE for ; Wed, 20 Aug 2003 12:50:46 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h7KFmgdb018920; Wed, 20 Aug 2003 09:48:42 -0600 (MDT) Date: Wed, 20 Aug 2003 09:48:39 -0600 (MDT) From: "scott.marlowe" To: Jodi Kanter Cc: Bruno Wolff III , Gaetano Mendola , Subject: Re: changing field length In-Reply-To: <3F4390C2.6050106@virginia.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/225 X-Sequence-Number: 9946 As always, there's more than one way to skin a cat... Create a new table and insert into it: create newtable (field newdef, field2 newdef); insert into newtable ( select oldfield, oldfield2 from oldtable ); Create it on the fly with Postgresql casting shortcuts: select field1::newtype, field2::newtype, field3, field4 into newtable from oldtable; Create it on the fly with ANSI style casting: select cast(field1 as newtype), cast(field2 as newtype), field3, field4 into newtable from oldtable; On Wed, 20 Aug 2003, Jodi Kanter wrote: > Ok. so for now I want to return to where I started. so I renamed the > table and regenerated my original table with the fields in the order > that I like. I cannot just do a > insert into table select * from other_table; > because the fields are in a different order. > Can I do this by listing the fields in my insert in the order in which I > want them placed? > Thanks > Jodi > > Bruno Wolff III wrote: > > >On Wed, Aug 20, 2003 at 10:49:08 -0400, > > Jodi Kanter wrote: > > > >>can I now make this field not null? > >> > >>is it possible to move a field up in a table? now that I have done this > >> > > > >Currently, not without recreating the table. There was some discussion > >about that a few months ago, but nothing is happening in 7.4 on that > >front. Maybe in 7.5 there will be a way to change the column order, > >but don't count on it. > > > >---------------------------(end of broadcast)--------------------------- > >TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > >