Re: Review: Non-inheritable check constraints - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Review: Non-inheritable check constraints
Date
Msg-id 1324582763-sup-4522@alvh.no-ip.org
Whole thread Raw
In response to Re: Review: Non-inheritable check constraints  (Nikhil Sontakke <nikkhils@gmail.com>)
Responses Re: Review: Non-inheritable check constraints
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Escaping ":" in .pgpass - code or docs bug?
Next
From: Robert Haas
Date:
Subject: Re: Review: Non-inheritable check constraints