Re: [HACKERS] [PATCH] WIP Add ALWAYS DEFERRED option for constraints - Mailing list pgsql-hackers

From Nico Williams
Subject Re: [HACKERS] [PATCH] WIP Add ALWAYS DEFERRED option for constraints
Date
Msg-id 20180712005054.GD9712@localhost
Whole thread Raw
In response to Re: [HACKERS] [PATCH] WIP Add ALWAYS DEFERRED option for constraints  (Nico Williams <nico@cryptonector.com>)
List pgsql-hackers
On Wed, Jul 11, 2018 at 01:41:12PM -0500, Nico Williams wrote:
> > > @@ -5538,17 +5568,24 @@ ConstraintAttributeSpec:
> > >                      int        newspec = $1 | $2;
> > >  
> > >                      /* special message for this case */
> > > -                    if ((newspec & (CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED)) == (CAS_NOT_DEFERRABLE |
CAS_INITIALLY_DEFERRED))
> > > +                    if ((newspec & CAS_NOT_DEFERRABLE) &&
> > > +                        (newspec & (CAS_INITIALLY_DEFERRED | CAS_ALWAYS_DEFERRED)))
> > >                          ereport(ERROR,
> > >                                  (errcode(ERRCODE_SYNTAX_ERROR),
> > >                                   errmsg("constraint declared INITIALLY DEFERRED must be DEFERRABLE"),
> > >                                   parser_errposition(@2)));
> > >                      /* generic message for other conflicts */
> > > +                    if ((newspec & CAS_ALWAYS_DEFERRED) &&
> > > +                        (newspec & (CAS_INITIALLY_IMMEDIATE)))
> > > +                        ereport(ERROR,
> > > +                                (errcode(ERRCODE_SYNTAX_ERROR),
> > > +                                 errmsg("conflicting constraint properties 1"),
> > > +                                 parser_errposition(@2)));
> > >                      if ((newspec & (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE)) == (CAS_NOT_DEFERRABLE |
CAS_DEFERRABLE)||
 
> > >                          (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) ==
(CAS_INITIALLY_IMMEDIATE| CAS_INITIALLY_DEFERRED))
 
> > >                          ereport(ERROR,
> > >                                  (errcode(ERRCODE_SYNTAX_ERROR),
> > > -                                 errmsg("conflicting constraint properties"),
> > > +                                 errmsg("conflicting constraint properties 2"),
> > 
> > I'd prefer you just repeat the message (or make them more situationally
> > descriptive), rather than appending a number.  (Repeating error messages
> > is in keeping with the style here.)
> 
> Oy, I forgot about these.  The number was a bread crumb I forgot to
> cleanup :(  So sorry about that.

So, I'm tempted not to add new messages that will require translation,
leaving these as "conflicting constraint properties".

But I'm perfectly happy to make these more informative too if that's
desired.  I just don't know what the expectations are regarding message
catalog translation.  Any advice?

Nico
-- 


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Costing bug in hash join logic for semi joins
Next
From: Nico Williams
Date:
Subject: Re: [HACKERS] [PATCH] WIP Add ALWAYS DEFERRED option for constraints