Skip site navigation (1) Skip section navigation (2)

Column reordering in pg_dump

From: "hernan gonzalez" <hgonzalez(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Column reordering in pg_dump
Date: 2008-11-14 17:21:50
Message-ID: 48692c2d0811140921v4504162ctb2c22b53e2f1b5c9@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi.
As I wanted to change the order of columns of some tables (I know, I
know, my code does not depend
on that; but I prefer that \dt gives me a more organized ouput...)
I've added an option to pg_dump to reorder
columns in the ouput "CREATE TABLE" dump.
The specified order is given in a external file (one column by line,
format "scheme.tablename.colname"),
you only need to write the desired columns to reorder.
I've done it for my own use, minimal testing, etc; but the code is
quite simple and has little coupling
with the rest; and very little risk, IMO.
The code (reoder.c and patched pg_dump.c) is here:
 http://hjg.com.ar/tech/prog/pg_dump_reorder/
See the README.txt, and the comments at reorder.c.
If the dev team is interested in adding this little feature to the
core, delighted (in that case, I guess the code
needs some polishing, and perhaps revise terminology, options names,
modify man page, etc)
If not, there it is so the people interested can use it.

BTW: I've been using Postgresql since ten years ago, and it rocks. Congrats.

-- 
Hernán J. González
http://hjg.com.ar/
Buenos Aires, Argentina

Responses

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2008-11-14 17:23:51
Subject: Re: Synchronous replication patch v2
Previous:From: Tom LaneDate: 2008-11-14 17:13:30
Subject: Re: pgsql: Enable script to generate preproc.y in build process.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group