three small improvements for "Composite Types" page

From: Anton Voloshin <a(dot)voloshin(at)postgrespro(dot)ru>
To: pgsql-docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: three small improvements for "Composite Types" page
Date: 2024-04-12 20:20:27
Message-ID: 38aa8e65-32e2-4578-bfc8-0d9f59efe049@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Hello,

While reading "Composite Types" manual page I've noticed that it is
somewhat hard to follow by trying out given examples. I suggest three
small changes which would make this page a little easier to follow for
me:

1. Clarify "different kind" by adding a link to a section of "create
type" page

> Note that the AS keyword is essential; without it, the system will
think a different kind of CREATE TYPE command is meant, and you will get
odd syntax errors.

Here there is no link to CREATE TYPE, so it's not so easy to go there to
see what is that "different kind" of CREATE TYPE. I suggest to add an
anchor for the "Base Types" section there and link the words "different
kind" there.

2. make first mention of CREATE TABLE a link

> The syntax is comparable to CREATE TABLE, except ...

It would be useful if this CREATE TABLE (first on this page) would
become a link.

3. Simplify CREATE TABLE example to make it self-sufficient

One of the examples on the same "Composite Types" page is an example of
CREATE TABLE:

CREATE TABLE inventory_item (
name text,
supplier_id integer REFERENCES suppliers,
price numeric CHECK (price > 0)
);

This example is not self-sufficient: it requires one to have "suppliers"
table with specific column to work as given. This table is actively used
in examples below, like
SELECT * FROM inventory_item c ORDER BY c;
and many others, so I think it's important to make this example easy to
reproduce. It seems to me that loosing "REFERENCES suppliers", while
loses something a bit interesting, adds something more important:
simplicity for the newcomers. So I suggest removing this part.

Please see attached patches as an example of these three changes.

Any comments? Do you think this is an improvement?

--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru

Attachment Content-Type Size
0001-clarify-different-kind-by-adding-a-link-to-a-section.patch text/x-patch 1.5 KB
0002-composite-types-make-first-mention-of-CREATE-TABLE-a.patch text/x-patch 1008 bytes
0003-Composite-Types-simplify-CREATE-TABLE-example-to-mak.patch text/x-patch 822 bytes

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2024-04-12 20:44:59 Re: three small improvements for "Composite Types" page
Previous Message Erik Wienhold 2024-04-12 19:56:04 Re: nested <a> tags in glossary entries in html docs