Excerpts from Nikhil Sontakke's message of mar dic 20 12:03:33 -0300 2011:
> > Apologies, I did not check this particular scenario.
> >
> > I guess, here, we should not allow merging of the inherited constraint
> > into an "only" constraint. Because that breaks the semantics for "only"
> > constraints. If this sounds ok, I can whip up a patch for the same.
> >
> >
> PFA, patch which does just this.
>
> postgres=# alter table a add constraint chk check (ff1 > 0);
> ERROR: constraint "chk" for relation "b" is an ONLY constraint. Cannot
> merge
I think the basic idea is fine -- the constraint certainly cannot be
merged, and we can't continue without merging it because of the
inconsistency it would create.
The error message is wrong though. I suggest
ERROR: constraint name "%s" on relation "%s" conflicts with non-inherited constraint on relation "%s"
HINT: Specify a different constraint name.
The errmsg seems a bit long though -- anybody has a better suggestion?
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support