Re: Unclear error message

2018-10-08 Thread Michael Paquier
On Mon, Oct 08, 2018 at 08:40:49AM +0200, Laurenz Albe wrote: > I'm fine with it. Thanks, I have pushed this version and back-patched to v11. -- Michael signature.asc Description: PGP signature

Re: Unclear error message

2018-10-08 Thread Laurenz Albe
Michael Paquier wrote: > On Sun, Oct 07, 2018 at 05:14:30PM +0900, Michael Paquier wrote: > > Here is a counter-proposal: > > "cannot use ONLY for foreign key on partitioned table \"%s\" referencing > > relation \"%s\"" > > > > +-- also, adding a NOT VALID foreign key should fail > > +ALTER TABLE

Re: Unclear error message

2018-10-07 Thread Michael Paquier
On Sun, Oct 07, 2018 at 05:14:30PM +0900, Michael Paquier wrote: > Here is a counter-proposal: > "cannot use ONLY for foreign key on partitioned table \"%s\" referencing > relation \"%s\"" > > +-- also, adding a NOT VALID foreign key should fail > +ALTER TABLE fk_partitioned_fk ADD FOREIGN KEY (a,

Re: Unclear error message

2018-10-07 Thread Michael Paquier
On Sat, Oct 06, 2018 at 11:16:09PM +0200, Laurenz Albe wrote: > True; how about the attached? > > I think this should go in before v11. Thanks for adding regression tests for that. - errmsg("foreign key referencing partitioned table \"%s\" must not be ONLY", - RelationGetRelationName(pk

Re: Unclear error message

2018-10-06 Thread Laurenz Albe
Michael Paquier wrote: > On Thu, Sep 20, 2018 at 09:45:09PM +0200, Laurenz Albe wrote: > > That message is wrong, because "rel" and not "pkrel" is the partitioned > > table. > > I think it should be > > > > ereport(ERROR, > > (errcode(ERRCODE_WRONG_OBJECT_TYPE), > >

Re: Unclear error message

2018-09-20 Thread Michael Paquier
On Thu, Sep 20, 2018 at 09:45:09PM +0200, Laurenz Albe wrote: > That message is wrong, because "rel" and not "pkrel" is the partitioned table. > I think it should be > > ereport(ERROR, > (errcode(ERRCODE_WRONG_OBJECT_TYPE), > errmsg("foreign key cannot be d

Unclear error message

2018-09-20 Thread Laurenz Albe
In backend/commands/tablecmds.c, function ATAddForeignKeyConstraint, I find: if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) { if (!recurse) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("foreign key referencing partitioned table \"%