Fred Yankowski <fred@ontosys.com> writes:
> On Tue, Feb 13, 2001 at 06:40:30AM -0800, Brent R. Matzelle wrote:
> > You might also try dumping the database, dropping and
> > re-creating the database, and then hacking the dump to add,
> > delete, alter columns. That way the original structure should
> > remain intact.
>
[...]
>
> Or we can improve our tools so that changes aren't so painful to
> undertake. PostgreSQL is a damn fine piece of work, and there are
> ways that it too could evolve to make it an even more powerful tool
> for doing what our customers need done, rather than just what is
> convenient for us to do.
I agree with you; it would be very nice to be able to easily change
the schema in a running database. However, the developers of PG have
limited time, and they typically devote their efforts more towards
production issues than to development issues. In other words,
changing a schema is something the developer is going to want to do,
but it's not something you'll do much once your product is in
production.
Given the choice between having rock-solid production support and
having less solid production support, but better development support,
I'd still vote on the side of production. If somebody like you or me
wants to add ALTER TABLE DROP COLUMN, I'm sure the PG developers would
gladly accept a patch.
In the meantime, what works well for me is to build my schema by way
of an SQL script or three. When I change the schema, I just change
the script. If the database is in development, I can frequently get
away with dropping the whole thing, re-creating it, and re-running the
script. Even if not, I can run pg_dump, drop and re-create the
database, run the schema script, and then restore just the data (no
structure) from dump. It's a pain, but it does work. And it has the
added benefit of giving me a text record of the schema that I can
check into CVS and examine previous versions of.
Chris
--
chris@mt.sri.com -----------------------------------------------------
Chris Jones SRI International, Inc.
www.sri.com