Re: create table explicitly mention that unique|primary key constraint will create an

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: create table explicitly mention that unique|primary key constraint will create an
Date: 2023-11-27 02:30:28
Message-ID: 24f01200b651ff87311ae0f46b99eaf91fc3ec43.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Mon, 2023-11-27 at 08:00 +0800, jian he wrote:
> Hi. minor doc issue.
> create table s1(a int, constraint s2 PRIMARY key (a));
> create table s2(a int);
> ERROR: relation "s2" already exists
>
> https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-PARMS-UNIQUE
> maybe for the following 2 sentence
> "Adding a unique constraint will automatically create a unique btree
> index on the column or group of columns used in the constraint."
> "Adding a PRIMARY KEY constraint will automatically create a unique
> btree index on the column or group of columns used in the constraint."
>
> maybe we can mention that: the unique btree index name will be the
> constraint name.
> also is "a unique" or "an unique"?

It would be "a unique", because "unique" is pronounced "juneek", which
does not start with a vowel.

> I personally thought this part is obscure.

True; I don't find it documented that all objects in pg_class share a
namespace and that constraints are implemented by indexes of the same
name. But I think that the first part is a property of schemas and had
better be documented there.

What do you think of the attached patch?

Yours,
Laurenz Albe

Attachment Content-Type Size
0001-Doc-objects-in-pg_class-share-a-namespace.patch text/x-patch 3.2 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message jian he 2023-11-27 05:58:53 Re: create table explicitly mention that unique|primary key constraint will create an
Previous Message jian he 2023-11-27 00:00:00 create table explicitly mention that unique|primary key constraint will create an