Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 2C3229FB407 for ; Wed, 4 Oct 2006 06:23:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 03745-05 for ; Wed, 4 Oct 2006 09:22:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id E223B9FB386 for ; Wed, 4 Oct 2006 06:22:56 -0300 (ADT) Received: from kingfisher.intern.logix-tt.com (p549D1602.dip0.t-ipconnect.de [84.157.22.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 939C365977 for ; Wed, 4 Oct 2006 11:25:21 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 4A29218815B01 for ; Wed, 4 Oct 2006 11:22:54 +0200 (CEST) Message-ID: <45237D6E.1030601@logix-tt.com> Date: Wed, 04 Oct 2006 11:22:54 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Thunderbird 1.5.0.5 (X11/20060812) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: i have table References: In-Reply-To: X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/35 X-Sequence-Number: 26424 Hi, Penchalaiah, Penchalaiah P. wrote: > now I want to add one more field in this table.. but that field has to > come next to cda_no.. I mean as a 3^rd field.. If I am adding that fiel= d > it is coming last field =E2=80=A6 In SQL, field order in the table is not given by design. A "SELECT * FROM table" might even give you the columns alphabetically ordered, or in a different random order each time in a different server implementation. If you need the colums in a specific order, use "SELECT foo, bar, baz FROM table" or create a View. All relevant SQL constructs (SELECT, INSERT, UPDATE, COPY, etc.) let you specify the columns explicitly to guarantee a given order. > may I know how it is possible to that table=E2=80=A6 If you _really_ want to do that despite what I wrote above, you have several possibilities: - COPY the table to some file, drop the table, recreate the table with the desired new column order, and then COPY the table back using an explicitly specified, correct row order. - use CREATE TABLE ... AS SELECT to select the data into a new table, drop the old table, rename the new one to the old one. In both cases, you've to recreate all missing indices, foreing key constraints etc. HTH, Markus --=20 Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in Europe! www.ffii.org www.nosoftwarepatents.org