On 2025-10-21 04:37 +0300, Euler Taveira wrote:
> On Thu, Oct 16, 2025, at 5:37 AM, Erik Wienhold wrote:
> > While browsing the docs I saw that the foreign key tutorial [1] uses
> > some lowercase keywords which are inconsistent with the rest of the
> > docs. The attached patch fixes that. Should be pushed to all stable
> > branches.
> >
>
> Register your patch in the next CF [1] so it won't be forgotten.
https://commitfest.postgresql.org/patch/6159/
> These are not the only places that SQL keywords use lowercase. There
> are various cases (I searched for 'primary key') in dml.sgml,
> logicaldecoding.sgml, plpgsql.sgml, sepgsql.sgml, and textsearch.sgml
> that you should address as part of your proposal. I don't think there
> is an easy way to collect all cases. I also checked the most common
> keywords and I found a few lowercase cases. The SQL commands are
> usually inside programlisting tag so I tried the following command (to
> find the occurrence in the first line):
>
> cd doc/srg/sgml
> grep -r -A 1 ' |insert into|update |delete '
>
> (This command was an easy way to show there are other cases. It is not
> intended to be a starting point to collect all cases.)
>
> Of course, there are other cases too. For example, "between" in
> config.sgml is lowercase.
>
>
> CREATE TABLE parent(key integer, ...);
> CREATE TABLE child1000(check (key between 1000 and 1999)) INHERITS(parent);
> CREATE TABLE child2000(check (key between 2000 and 2999)) INHERITS(parent);
> ...
> SELECT * FROM parent WHERE key = 2400;
>
Ah, thanks for the tip. I figured that I can grep all defined keywords
using the keyword list in the repository with this Bash script:
#!/usr/bin/env bash
set -eu
# Collect all defined keywords and turn them lowercase for searching
kwfile=$(mktemp)
( cat doc/src/sgml/keywords/*.txt | tr [:upper:] [:lower:] ;
sed -n 's/PG_KEYWORD("\(\w\+\)".*/\1/p' src/include/parser/kwlist.h
) | sort | uniq > "$kwfile"
find_lowercase_keywords() {
local infile="$1"
# Extract program listings and prefix lines with line numbers
of the
# input file (filename gets prepended after grepping the
keywords).
# This also covers non-SQL program listings because there's no
language
# attribute that we could filter by.
awk '/>From cc729527d734beae1447933de83dff6abdf8c657 Mon Sep 17 00:00:00 2001
From: Erik Wienhold
Date: Thu, 16 Oct 2025 10:30:21 +0200
Subject: [PATCH v2] doc: Consistently use uppercase keywords
---
doc/src/sgml/advanced.sgml | 4 +-
doc/src/sgml/config.sgml | 4 +-
doc/src/sgml/cube.sgml | 6 +--
doc/src/sgml/datetime.sgml | 6 +--
doc/src/sgml/ddl.sgml| 26 ++--
doc/src/sgml/dict-int.sgml | 2 +-
doc/src/sgml/dml.sgml| 2 +-
doc/src/sgml/event-trigger.sgml | 2 +-
doc/src/sgml/func/func-binarystring.sgml | 4 +-
doc/src/sgml/func/func-srf.sgml | 4 +-
doc/src/sgml/hstore.sgml | 2 +-
doc/src/sgml/indices.sgml| 6 +--
doc/src/sgml/logicaldecoding.sgml| 2 +-
doc/src/sgml/monitoring.sgml | 4 +-
doc/src/sgml/pgstattuple.sgml| 2 +-
doc/src/sgml/pgsurgery.sgml | 12 +++---
doc/src/sgml/plperl.sgml | 4 +-
doc/src/sgml/plpgsql.sgml| 4 +-
doc/src/sgml/queries.sgml| 4 +-
doc/src/sgml/ref/alter_table.sgml| 2 +-
doc/src/sgml/ref/create_function.sgml| 2 +-
doc/src/sgml/ref/create_table.sgml | 12 +++---
doc/src/sgml/ref/pg_rewind.sgml | 8 ++--
doc/src/sgml/ref/psql-ref.sgml | 12 +++---
doc/src/sgml/ref/select.sgml | 2 +-
doc/src/sgml/tablefunc.sgml | 50
doc/src/sgml/tcn.sgml| 22 +--
27 files changed, 105 insertions(+), 105 deletions(-)
diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml
index e15a3323dfb..1f37dc73be8 100644
--- a/doc/src/sgml/advanced.sgml
+++ b/doc/src/sgml/advanced.sgml
@@ -101,12 +101,12 @@ SELECT * FROM myview;
CREATE TABLE cities (
-name varchar(80) primary key,
+name varchar(80) PRIMARY KEY,
location point
);
CREATE TABLE weather (
-city varchar(80) references cities(name),
+city varchar(80) REFERENCES cities(name),
temp_lo int,
temp_hi int,
prcp real,
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 0a2a8b49fdb..c850078c0bf 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -6394,8 +6394,8 @@ ANY num_sync
(
@@ -2904,7 +2904,7 @@ CREATE POLICY admin_local_only ON passwd AS RESTRICTIVE
TO admin
admin
(1 row)
-=> select inet_client_addr();
+=> SELE