agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: "Сергей П (SergeiDos)" <podrezov.sergey@gmail.com>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: Generated names (suffix) for constraints not described in docs
Date: Wed, 13 Nov 2024 10:00:50 -0500
Message-ID: <1363392.1731510050@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYypoe_44QXqXokL0rq8j-Kbv52fynTG2nFPnb4kjjmJQ@mail.gmail.com>
References: <712E40A2-744F-424E-AE45-95CE5BE27D82@gmail.com>
	<CAKFQuwYypoe_44QXqXokL0rq8j-Kbv52fynTG2nFPnb4kjjmJQ@mail.gmail.com>

"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





view thread (5+ messages)  latest in thread

Message-ID: <1363392.1731510050@sss.pgh.pa.us>
Permalink:  ../1363392.1731510050@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1363392.1731510050@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, podrezov.sergey@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Generated names (suffix) for constraints not described in docs
  In-Reply-To: <1363392.1731510050@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox