public inbox for [email protected]  
help / color / mirror / Atom feed
From: Erik Wienhold <[email protected]>
To: David Rowley <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Bruce Momjian <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: Euler Taveira <[email protected]>
Cc: [email protected]
Subject: Re: Use uppercase keywords in foreign key tutorial
Date: Mon, 3 Nov 2025 21:06:44 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAApHDvoqh_K2KTocwWYrGw5vLubnPnTzd1SvYTTonQ=vUXP7Ug@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAApHDvoLfa2UjGfoGfVL4b=g5VbFgscrLONuC3kKE9=VZeeN=Q@mail.gmail.com>
	<[email protected]>
	<aQE29YG5pY4Cl8ym@nathan>
	<[email protected]>
	<[email protected]>
	<CAApHDvqR+_EU0mxrmS-AieE_8ovqtmnsJSOk-oq-Rdk3JzNWOg@mail.gmail.com>
	<[email protected]>
	<CAApHDvoqh_K2KTocwWYrGw5vLubnPnTzd1SvYTTonQ=vUXP7Ug@mail.gmail.com>

On 2025-10-31 04:03 +0100, David Rowley wrote:
> On Fri, 31 Oct 2025 at 13:53, Erik Wienhold <[email protected]> wrote:
> > But I also agree with Tom that keeping a consistent style is impossible
> > in the long run.  But it also shows that the docs are still written by
> > humans.  As long as we can keep a consistent style within a single
> > listing (or even an entire page) I'm satisfied as a reader.
> 
> For me, I don't see this as a reason not to try. If we do get things
> to a consistent point, then anyone making changes that reference
> existing portions of the documentation for inspiration should maintain
> consistency. If we're entirely random, then there's no hope for anyone
> to figure out what the best practice or perfected casing is.

Sure.  I didn't say we shouldn't try.  But from my experience, minor
formatting issues slip through all the time if you can't rely on an
autoformatter or linter.  Maybe less so in these docs because the sample
queries are usually short.  But it already took me a couple of rounds to
find every lowercase keyword so far and I guess I still missed some.

> > Besides that I've fixed a couple of more places that had lowercase
> > keywords or were missing some whitespace that I had missed before.
> 
> A couple of things.
> 
> 1) I see you've added a space after "INSERT INTO table" and before the
> column list, but not consistently, per:
> 
> git grep -E "INSERT INTO \w+\("

Fixed in the attached v4.  Except for one match in dblink.sgml that is
the sample output of dblink_build_sql_insert which actually omits the
space after the table name and VALUES keyword.

> 2) An identifier casing has been changed here:
> 
> -SELECT sub_part, SUM(quantity) as total_quantity
> +SELECT sub_part, sum(quantity) AS total_quantity

Reverted back to uppercase SUM.  I think this was the only changed
identifier and what remains should only be keyword and whitespace
changes to keep the patch focused on that.

> You could also look at the results of the SQL command that's returned
> by the following SQL to see if there's anything else. I do see some
> "ROLLUP(", "EXISTS(", "GROUPING(" and "VALUES(" in there. You have
> been changing "VALUES(" to "VALUES (", so I assume those ones have
> been missed:
> 
> select 'git grep -E "\b(' || string_agg(UPPER(word),'|') || ')\("'
> from pg_get_keywords();

Thanks.  Fixed those as well.  But only for keywords with non-C catcodes
because I figured that the catcode C keywords mostly cover builtin
function names where extra whitespace before the opening paren doesn't
make sense.  Missed the uppercase keywords before because I was only
searching for the lowercase ones.

-- 
Erik Wienhold


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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Use uppercase keywords in foreign key tutorial
  In-Reply-To: <[email protected]>

* 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