Re: Generated names (suffix) for constraints not described in docs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "Сергей П (SergeiDos)" <podrezov(dot)sergey(at)gmail(dot)com>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Generated names (suffix) for constraints not described in docs
Date: 2024-11-13 15:00:50
Message-ID: 1363392.1731510050@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Wednesday, November 13, 2024, "Сергей П (SergeiDos)" <
> podrezov(dot)sergey(at)gmail(dot)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

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Сергей П (SergeiDos) 2024-11-13 19:59:10 Re: Generated names (suffix) for constraints not described in docs
Previous Message David G. Johnston 2024-11-13 14:22:46 Re: Generated names (suffix) for constraints not described in docs