conventions

From: rir <rirans(at)comcast(dot)net>
To: Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: conventions
Date: 2021-07-07 16:30:09
Message-ID: 20210707163009.44wpfn7uc72zwyp7@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs


The conventions page is weak. Here is a proposed start for
change. Seeing SQL as an early language, I have tried to use something
like plain English. Here "early" could describe a mail merge user
wandering into programming SQL after seeing some simple examples.

I like the idea of accessibility but I may have been overly influenced
by the tone of the existing page. I tried to express the idea of
operators and that "repeaters" could/should be viewed as tokens.

I am not sure if parenthetical groups are degenerate in their
behavior pertaining to their contents. It seems they take the op's
on the outside.

Thanks,
rob

Conventions

The conventions used in the synopses of commands vary with the language
being presented.

SQL

The conventions for SQL synopses consist of placeholders, groups,
repeaters and the alternator.

Placeholders are bold, italicized names for SQL code. Often the
placeholder's definition or syntax is is introduced and presented
later in the synopsis. When not defined, there are three possible
reasons:
1. The placeholder is self-evident, i.e. "name" being more helpful
in giving the intent of the code than "sql_identifier".
2. The placeholder is a common SQL construct explained elsewhere,
i.e. "expression".
3. The placeholder is arcane or requires knowledge beyond SQL;
the commonest cases involve creating or altering C language
code.
In the above cases, the page's explanatory text should help.

Square brackets ([ and ]) create optional groups.

Pointy braces ({ and }) create required groups. To date, only alternative
lists exist inside braces.

Parentheses (( and )) are to be taken literally as part of the SQL code,
but also group parts.

The bar or pipe (|) is the alternator, it separates lists of alternatives
which require one choice.

The ellipsis (...) is the basic repeater, all repeaters indicate some
repetition of the prior group, symbol or word. The basic repeater
requires at least one repetition.
The ellipsis in square brackets ([ ... ]) indicates an optional
repetition.
The other repeaters are special usages of square brackets to create
repeaters that contain a separator that goes between the repetitions.
These are ([, ...]), ([ OR ...]) and ([ AND ...]).

PL/pgSQL

XXX See SQL above.

PL/Tcl
...

PL/Perl
...

PL/Python
...

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Euler Taveira 2021-07-07 19:13:59 Re: conventions
Previous Message David Rowley 2021-07-07 11:44:16 Re: Update maintenance_work_mem/autovacuum_work_mem to reflect the 1GB limitation with VACUUM