Re: [HACKERS] [PATCH] WIP Add ALWAYS DEFERRED option for constraints

From: Nico Williams <nico(at)cryptonector(dot)com>
To: Robbie Harwood <rharwood(at)redhat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] [PATCH] WIP Add ALWAYS DEFERRED option for constraints
Date: 2018-07-12 00:50:56
Message-ID: 20180712005054.GD9712@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
--

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nico Williams 2018-07-12 00:55:37 Re: [HACKERS] [PATCH] WIP Add ALWAYS DEFERRED option for constraints
Previous Message David Rowley 2018-07-12 00:50:24 Re: Costing bug in hash join logic for semi joins