Re: ALTER TABLE ... NOREWRITE option

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ... NOREWRITE option
Date: 2012-12-01 20:24:57
Message-ID: 50BA6799.7070908@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


>> I'm not thrilled about inventing YA keyword for this. If you have a
>> problem with that sort of scenario, why aren't you testing your DDL
>> on a test server before you do it on production?

*I* do test my DDL. However, there are literally hundreds of thousands
of Rails, Django and Hibernate developers who "test" their DDL by
running it using a 5-row dataset on their laptops before pushing it to
production. As far as these folks are concerned, "rewrite if there's a
default" is a completely unintuitive booby-trap.

I agree that adding "NOREWRITE" is a bad solution, though. Personally,
I'd rather have a system function which tests whether a series of DDL
statements involves a rewrite anywhere. e.g.:

SELECT pg_test_for_rewrite('ALTER TABLE josh ADD COLUMN haircolor')

Hmmmm. Actually, that wouldn't work with migrations tools, especially
Rails. Better, what about a GUC?

SET message_on_rewrite=WARNING;

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-12-01 20:32:20 Re: ALTER TABLE ... NOREWRITE option
Previous Message Andres Freund 2012-12-01 19:35:57 Re: --single-transaction hack to pg_upgrade does not work