"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wednesday, November 13, 2024, "Сергей П (SergeiDos)" <
> podrezov.sergey@gmail.com> wrote:
>> In the documentation for the Constraints section
>> https://www.postgresql.org/docs/current/ddl-constraints.html there is a
>> phrase: "So, to specify a named constraint, use the key word CONSTRAINT
>> followed by an identifier followed by the constraint definition. (If you
>> can't specify a constraint name in this way, the system choose a name for
>> you.)"
>> But nowhere in the documentation are the rules by which it generates names
>> on its own described.
> Correct. Which means the specific name chosen is an implementation detail
> that can change at any time and should not be relied upon by the
> DBA.
Indeed. I double-checked the SQL spec and found that it says
3) If <constraint name definition> is not specified, then a
<constraint name definition> that contains an implementation-
dependent <constraint name> is implicit. The assigned
<constraint name> shall obey the Syntax Rules of an explicit
<constraint name>.
"Implementation-dependent" is standards-ese for "implementations
don't have to document their exact behavior". (If it said
"implementation-defined", that would mean we should.) So not
documenting it is expected. I think we have indeed changed the
details around this in the past.
regards, tom lane