From: Stef <svb@ucs.co.za>
To: pgsql-sql@postgresql.org
Subject: Preserving column order when recreating table.
Date: Wed, 15 Sep 2004 14:24:45 +0200
Message-ID: <20040915142445.06b60e3e@svb.ucs.co.za> (raw)
Hi all,
I'm struggling with a situation where I
want to recreate a table (in more than 30 databases) to
fix the column order (attnum sequence) and in another case,
fix different definitions for the same column in a table e.g.
amount numeric(16,2)
in stead of :
amount numeric(16,5)
The complication comes in when the newly created table
could have extra (new) columns, or its column order is not the
same as the original table's, but the corresponding column
names are the same.
My question is :
Is it possible to do this in DML/DDL ?
That is, dumping the data, dropping the table,
recreating the table, and reimporting the data in the correct order ?
I've tried different things, but I cannot write SQL to do this.
I know it's easy from a script, but I don't have any other type
of access to the database servers.
Kind Regards
Stefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: svb@ucs.co.za
Subject: Re: Preserving column order when recreating table.
In-Reply-To: <20040915142445.06b60e3e@svb.ucs.co.za>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox