Re: nextval parameter is not clear

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Kirk Wolak <wolakk(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Bruce Momjian <bruce(at)momjian(dot)us>, ailjushkin(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: nextval parameter is not clear
Date: 2022-11-28 19:50:07
Message-ID: CAKFQuwZq4=bjOjcS=Se-jviMWABSnuoh4BHfoze=Tf1MawerSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Mon, Nov 28, 2022 at 12:22 PM Kirk Wolak <wolakk(at)gmail(dot)com> wrote:

> On Mon, Nov 28, 2022 at 12:47 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Kirk Wolak <wolakk(at)gmail(dot)com> writes:
>> > my goal is to get an "approach" accepted, this is the first.
>> Ultimately, I
>> > would love to see
>> > the documentation of functions with examples like this everywhere.
>>
>> I'm not for that. func.sgml is already massive, and doubling its size
>
> ...
>> reference material, so extended examples ought to go somewhere else.
>>
>> I could see adding a section about sequences and identity columns to
>> chapter 3 in the tutorial.
>>
>> > Preferably where someone
>> > can copy/paste the example and see the results.
>>
>> As far as that goes, there's already an idea that src/tutorial/
>> should contain SQL scripts that you can step-execute to follow
>> along with the tutorial docs. This hasn't been followed through
>> on very well --- chapter 2 is covered, but chapter 3 mostly not.
>> No time like the present to make it better, though. If your
>> ambition is to make self-contained working examples, making sure
>> that they execute as a script is good discipline.
>>
>> regards, tom lane
>>
>
> Two questions follow from the above:
> 1) For the novice who finds this page (funcs), how will they know to find
> the tutorial?
> 2) Should each function link to that? or One link per page? [to the
> appropriate example section]
>

You would add a sentence, as appropriate to the page, pointing the reader
to the tutorial section for further examples. There isn't really a
rule-of-thumb here; use existing examples and context to figure out what
makes the most sense.

>
> I will gladly move my focus to adding to the tutorials... (but I want to
> know how even I would know it was available if I hit here first)
>

> And I still believe that each function in the documentation section should
> have at least a one-line example usage???
>

There already is guaranteed one example - it is the function signature that
begins each row.

On a related point, the word SELECT in table examples is unwanted noise
(this page is not the best example to emulate). The example call
expressions the supplement the function signature also need not be
executable.

The string functions demonstrate good usage examples for the tables.

https://www.postgresql.org/docs/current/functions-string.html

> After a quick review of the tutorial section, if you end up on any random
> page in the tutorial,
> the example code does not stand alone.
>

If you'd like to start a discussion on this I suggest a new email thread,
leaving this one to finishing the patch within the reality of the
documentation as it exists today. That is to say, making decisions based
upon existing prior work and sound arguments about the merits of the
content presentation. This isn't the place to experiment and propose an
example of some new grand design.

David J.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2022-11-28 21:29:56 Re: "jsonb ? text" operator and JSON strings
Previous Message PG Doc comments form 2022-11-28 19:41:38 "jsonb ? text" operator and JSON strings