On 2025-Jun-02, jian he wrote:
> On Mon, Jun 2, 2025 at 12:13 AM Álvaro Herrera <alvherre@kurilemu.de> wrote:
> >
> > Hmm, I think it would be more consistent to reject the case of duplicate
> > constraints, instead of silently ignoring it. So you'd do it in the
> > loop that checks for constraints before creating anything, like
> I don't have a preference.
> error out would be fine, since it's a corner case.
Yeah, if you were to specify that they have different properties, it'd
be messy to allow two to be given because you somehow have to merge
them. Also, if something creates a constraint with a certain name, then
the jonstraint name should exist. If we allow two names to be given,
one of them is lost which is undesirable.
Pushed that way.
I noticed that for the "conflicting NULL/NOT NULL constraints" error we
use the SYNTAX_ERROR errcode but for redundant ones we use
INVALID_OBJECT_DEFINITION. Apparently this was changed in commit
33d4c828fde8 in 2003, in whose commit message Peter wrote
Some "feature not supported" errors are better syntax errors, because the
feature they complain about isn't a feature or cannot be implemented without
definitional changes.
... not sure what to think about this.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)