On 11/21/2012 02:12:26 PM, Robert Haas wrote:
> On Sat, Nov 17, 2012 at 1:22 AM, Peter Eisentraut <peter_e@gmx.net>
> wrote:
> > On Mon, 2012-11-12 at 11:42 -0600, Karl O. Pinc wrote:
> >> Could ALTER TABLE use an option to drop the
> >> primary key constraint? I needed to do that,
> >> found it was not obvious, and this lead me to
> >> try to improve things.
> >
> > That could be useful, I think. But it might open a can of worms.
>
> Would the new option be syntactic sugar around ALTER TABLE ... DROP
> CONSTRAINT "put_the_name_of_the_primary_key_here"?
This sounds nice to me, but there's worms left over because
the unique index created when PRIMARY KEY is specified would
then remain. This the right behavior IMHO, and if everything
is spelled out in the documentation no problems should arise.
But the user deserves to know how to get rid of the unique
index too, so the index's name would need to be documented.
Since this is something of an internal matter (?) there
might be another worm here.
Regards,
Karl <kop@meme.com>
Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein