public inbox for [email protected]  
help / color / mirror / Atom feed
From: Erik Wienhold <[email protected]>
Subject: [PATCH v2] doc: Consistently use uppercase keywords
Date: Thu, 16 Oct 2025 10:30:21 +0200

---
 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;
 
 <programlisting>
 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 <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
 
 <programlisting>
 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);
+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;
 </programlisting>
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 0fb70807486..c1f23c2f9a7 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -540,7 +540,7 @@ SELECT c FROM test ORDER BY c ~&gt; 3 DESC LIMIT 5;
    This union:
   </para>
 <programlisting>
-select cube_union('(0,5,2),(2,3,1)', '0');
+SELECT cube_union('(0,5,2),(2,3,1)', '0');
 cube_union
 -------------------
 (0, 0, 0),(2, 5, 2)
@@ -552,7 +552,7 @@ cube_union
    </para>
 
 <programlisting>
-select cube_inter('(0,-1),(1,1)', '(-2),(2)');
+SELECT cube_inter('(0,-1),(1,1)', '(-2),(2)');
 cube_inter
 -------------
 (0, 0),(1, 0)
@@ -579,7 +579,7 @@ cube_inter('(0,-1),(1,1)','(-2,0),(2,0)');
    </para>
 
 <programlisting>
-select cube_contains('(0,0),(1,1)', '0.5,0.5');
+SELECT cube_contains('(0,0),(1,1)', '0.5,0.5');
 cube_contains
 --------------
 t
diff --git a/doc/src/sgml/datetime.sgml b/doc/src/sgml/datetime.sgml
index 3e24170acbf..5905f5fa550 100644
--- a/doc/src/sgml/datetime.sgml
+++ b/doc/src/sgml/datetime.sgml
@@ -942,17 +942,17 @@ $ <userinput>cal 9 1752</userinput>
    definition when you need it: do the arithmetic in time
    zone <literal>UTC+12</literal>.  For example,
 <programlisting>
-=&gt; SELECT extract(julian from '2021-06-23 7:00:00-04'::timestamptz at time zone 'UTC+12');
+=&gt; SELECT extract(julian FROM '2021-06-23 7:00:00-04'::timestamptz AT TIME ZONE 'UTC+12');
            extract
 ------------------------------
  2459388.95833333333333333333
 (1 row)
-=&gt; SELECT extract(julian from '2021-06-23 8:00:00-04'::timestamptz at time zone 'UTC+12');
+=&gt; SELECT extract(julian FROM '2021-06-23 8:00:00-04'::timestamptz AT TIME ZONE 'UTC+12');
                extract
 --------------------------------------
  2459389.0000000000000000000000000000
 (1 row)
-=&gt; SELECT extract(julian from date '2021-06-23');
+=&gt; SELECT extract(julian FROM date '2021-06-23');
  extract
 ---------
  2459389
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 65bc070d2e5..0b921aad70a 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -2834,9 +2834,9 @@ GRANT UPDATE
 
 <programlisting>
 -- admin can view all rows and fields
-postgres=&gt; set role admin;
+postgres=&gt; SET ROLE admin;
 SET
-postgres=&gt; table passwd;
+postgres=&gt; TABLE passwd;
  user_name | pwhash | uid | gid | real_name |  home_phone  | extra_info | home_dir    |   shell
 -----------+--------+-----+-----+-----------+--------------+------------+-------------+-----------
  admin     | xxx    |   0 |   0 | Admin     | 111-222-3333 |            | /root       | /bin/dash
@@ -2845,11 +2845,11 @@ postgres=&gt; table passwd;
 (3 rows)
 
 -- Test what Alice is able to do
-postgres=&gt; set role alice;
+postgres=&gt; SET ROLE alice;
 SET
-postgres=&gt; table passwd;
+postgres=&gt; TABLE passwd;
 ERROR:  permission denied for table passwd
-postgres=&gt; select user_name,real_name,home_phone,extra_info,home_dir,shell from passwd;
+postgres=&gt; SELECT user_name, real_name, home_phone, extra_info, home_dir, shell FROM passwd;
  user_name | real_name |  home_phone  | extra_info | home_dir    |   shell
 -----------+-----------+--------------+------------+-------------+-----------
  admin     | Admin     | 111-222-3333 |            | /root       | /bin/dash
@@ -2857,21 +2857,21 @@ postgres=&gt; select user_name,real_name,home_phone,extra_info,home_dir,shell fr
  alice     | Alice     | 098-765-4321 |            | /home/alice | /bin/zsh
 (3 rows)
 
-postgres=&gt; update passwd set user_name = 'joe';
+postgres=&gt; UPDATE passwd SET user_name = 'joe';
 ERROR:  permission denied for table passwd
 -- Alice is allowed to change her own real_name, but no others
-postgres=&gt; update passwd set real_name = 'Alice Doe';
+postgres=&gt; UPDATE passwd SET real_name = 'Alice Doe';
 UPDATE 1
-postgres=&gt; update passwd set real_name = 'John Doe' where user_name = 'admin';
+postgres=&gt; UPDATE passwd SET real_name = 'John Doe' WHERE user_name = 'admin';
 UPDATE 0
-postgres=&gt; update passwd set shell = '/bin/xx';
+postgres=&gt; UPDATE passwd SET shell = '/bin/xx';
 ERROR:  new row violates WITH CHECK OPTION for "passwd"
-postgres=&gt; delete from passwd;
+postgres=&gt; DELETE FROM passwd;
 ERROR:  permission denied for table passwd
-postgres=&gt; insert into passwd (user_name) values ('xxx');
+postgres=&gt; INSERT INTO passwd (user_name) VALUES ('xxx');
 ERROR:  permission denied for table passwd
 -- Alice can change her own password; RLS silently prevents updating other rows
-postgres=&gt; update passwd set pwhash = 'abc';
+postgres=&gt; UPDATE passwd SET pwhash = 'abc';
 UPDATE 1
 </programlisting>
 
@@ -2904,7 +2904,7 @@ CREATE POLICY admin_local_only ON passwd AS RESTRICTIVE TO admin
  admin
 (1 row)
 
-=&gt; select inet_client_addr();
+=&gt; SELECT inet_client_addr();
  inet_client_addr
 ------------------
  127.0.0.1
diff --git a/doc/src/sgml/dict-int.sgml b/doc/src/sgml/dict-int.sgml
index 8dd07b9bc12..b4ce5484823 100644
--- a/doc/src/sgml/dict-int.sgml
+++ b/doc/src/sgml/dict-int.sgml
@@ -80,7 +80,7 @@ ALTER TEXT SEARCH DICTIONARY
    To test the dictionary, you can try
 
 <programlisting>
-mydb# select ts_lexize('intdict', '12345678');
+mydb# SELECT ts_lexize('intdict', '12345678');
  ts_lexize
 -----------
  {123456}
diff --git a/doc/src/sgml/dml.sgml b/doc/src/sgml/dml.sgml
index 458aee788b7..61c64cf6c49 100644
--- a/doc/src/sgml/dml.sgml
+++ b/doc/src/sgml/dml.sgml
@@ -317,7 +317,7 @@ DELETE FROM products;
    column to provide unique identifiers, <literal>RETURNING</literal> can return
    the ID assigned to a new row:
 <programlisting>
-CREATE TABLE users (firstname text, lastname text, id serial primary key);
+CREATE TABLE users (firstname text, lastname text, id serial PRIMARY KEY);
 
 INSERT INTO users (firstname, lastname) VALUES ('Joe', 'Cool') RETURNING id;
 </programlisting>
diff --git a/doc/src/sgml/event-trigger.sgml b/doc/src/sgml/event-trigger.sgml
index 1bd9abb6676..c10627554bd 100644
--- a/doc/src/sgml/event-trigger.sgml
+++ b/doc/src/sgml/event-trigger.sgml
@@ -433,7 +433,7 @@ $$
 ---
 DECLARE
   table_oid oid := pg_event_trigger_table_rewrite_oid();
-  current_hour integer := extract('hour' from current_time);
+  current_hour integer := extract('hour' FROM current_time);
   pages integer;
   max_pages integer := 100;
 BEGIN
diff --git a/doc/src/sgml/func/func-binarystring.sgml b/doc/src/sgml/func/func-binarystring.sgml
index dd7037811af..446b54010b5 100644
--- a/doc/src/sgml/func/func-binarystring.sgml
+++ b/doc/src/sgml/func/func-binarystring.sgml
@@ -856,8 +856,8 @@
    significant byte first. Some examples:
 <programlisting>
 1234::smallint::bytea          <lineannotation>\x04d2</lineannotation>
-cast(1234 as bytea)            <lineannotation>\x000004d2</lineannotation>
-cast(-1234 as bytea)           <lineannotation>\xfffffb2e</lineannotation>
+cast(1234 AS bytea)            <lineannotation>\x000004d2</lineannotation>
+cast(-1234 AS bytea)           <lineannotation>\xfffffb2e</lineannotation>
 '\x8000'::bytea::smallint      <lineannotation>-32768</lineannotation>
 '\x8000'::bytea::integer       <lineannotation>32768</lineannotation>
 </programlisting>
diff --git a/doc/src/sgml/func/func-srf.sgml b/doc/src/sgml/func/func-srf.sgml
index eafc961c9f9..34a45971aad 100644
--- a/doc/src/sgml/func/func-srf.sgml
+++ b/doc/src/sgml/func/func-srf.sgml
@@ -247,8 +247,8 @@ FROM (SELECT generate_subscripts(a, 1) AS s, a FROM arrays) foo;
 -- unnest a 2D array:
 CREATE OR REPLACE FUNCTION unnest2(anyarray)
 RETURNS SETOF anyelement AS $$
-select $1[i][j]
-   from generate_subscripts($1,1) g1(i),
+SELECT $1[i][j]
+   FROM generate_subscripts($1,1) g1(i),
         generate_subscripts($1,2) g2(j);
 $$ LANGUAGE sql IMMUTABLE;
 CREATE FUNCTION
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index 44325e0bba0..fb71bb2e30f 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -799,7 +799,7 @@ UPDATE tab SET h = h || hstore('c', '3');
    If multiple keys are to be added or changed in one operation,
    the concatenation approach is more efficient than subscripting:
 <programlisting>
-UPDATE tab SET h = h || hstore(array['q', 'w'], array['11', '12']);
+UPDATE tab SET h = h || hstore(ARRAY['q', 'w'], ARRAY['11', '12']);
 </programlisting>
   </para>
 
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 9c4f76abf0d..6469f032f23 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -949,19 +949,19 @@ WHERE url = '/index.html' AND client_ip = inet '192.168.100.23';
     command to create the index would look like this:
 <programlisting>
 CREATE INDEX orders_unbilled_index ON orders (order_nr)
-    WHERE billed is not true;
+    WHERE billed IS NOT TRUE;
 </programlisting>
    </para>
 
    <para>
     A possible query to use this index would be:
 <programlisting>
-SELECT * FROM orders WHERE billed is not true AND order_nr &lt; 10000;
+SELECT * FROM orders WHERE billed IS NOT TRUE AND order_nr &lt; 10000;
 </programlisting>
     However, the index can also be used in queries that do not involve
     <structfield>order_nr</structfield> at all, e.g.:
 <programlisting>
-SELECT * FROM orders WHERE billed is not true AND amount &gt; 5000.00;
+SELECT * FROM orders WHERE billed IS NOT TRUE AND amount &gt; 5000.00;
 </programlisting>
     This is not as efficient as a partial index on the
     <structfield>amount</structfield> column would be, since the system has to
diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index b803a819cf1..2cd00d0e4b2 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -73,7 +73,7 @@ postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NU
 -----+-----+------
 (0 rows)
 
-postgres=# CREATE TABLE data(id serial primary key, data text);
+postgres=# CREATE TABLE data(id serial PRIMARY KEY, data text);
 CREATE TABLE
 
 postgres=# -- DDL isn't replicated, so all you'll see is the transaction
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index d5f0fb7ba7c..6cbb361b778 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -1137,7 +1137,7 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
      Here are examples of how wait events can be viewed:
 
 <programlisting>
-SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event is NOT NULL;
+SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event IS NOT NULL;
  pid  | wait_event_type | wait_event
 ------+-----------------+------------
  2540 | Lock            | relation
@@ -1150,7 +1150,7 @@ SELECT a.pid, a.wait_event, w.description
   FROM pg_stat_activity a JOIN
        pg_wait_events w ON (a.wait_event_type = w.type AND
                             a.wait_event = w.name)
-  WHERE a.wait_event is NOT NULL and a.state = 'active';
+  WHERE a.wait_event IS NOT NULL AND a.state = 'active';
 -[ RECORD 1 ]------------------------------------------------------&zwsp;------------
 pid         | 686674
 wait_event  | WALInitSync
diff --git a/doc/src/sgml/pgstattuple.sgml b/doc/src/sgml/pgstattuple.sgml
index c747a5818ab..54d8f90245e 100644
--- a/doc/src/sgml/pgstattuple.sgml
+++ b/doc/src/sgml/pgstattuple.sgml
@@ -377,7 +377,7 @@ pending_tuples | 0
       <function>pgstathashindex</function> returns a record showing information
       about a HASH index.  For example:
 <programlisting>
-test=&gt; select * from pgstathashindex('con_hash_index');
+test=&gt; SELECT * FROM pgstathashindex('con_hash_index');
 -[ RECORD 1 ]--+-----------------
 version        | 4
 bucket_pages   | 33081
diff --git a/doc/src/sgml/pgsurgery.sgml b/doc/src/sgml/pgsurgery.sgml
index 29bccd7f36d..68186122a22 100644
--- a/doc/src/sgml/pgsurgery.sgml
+++ b/doc/src/sgml/pgsurgery.sgml
@@ -34,17 +34,17 @@
       intended use of this function is to forcibly remove tuples that are not
       otherwise accessible. For example:
 <programlisting>
-test=&gt; select * from t1 where ctid = '(0, 1)';
+test=&gt; SELECT * FROM t1 WHERE ctid = '(0, 1)';
 ERROR:  could not access status of transaction 4007513275
 DETAIL:  Could not open file "pg_xact/0EED": No such file or directory.
 
-test=# select heap_force_kill('t1'::regclass, ARRAY['(0, 1)']::tid[]);
+test=# SELECT heap_force_kill('t1'::regclass, ARRAY['(0, 1)']::tid[]);
  heap_force_kill
 -----------------
 
 (1 row)
 
-test=# select * from t1 where ctid = '(0, 1)';
+test=# SELECT * FROM t1 WHERE ctid = '(0, 1)';
 (0 rows)
 
 </programlisting>
@@ -70,19 +70,19 @@ test=&gt; vacuum t1;
 ERROR:  found xmin 507 from before relfrozenxid 515
 CONTEXT:  while scanning block 0 of relation "public.t1"
 
-test=# select ctid from t1 where xmin = 507;
+test=# SELECT ctid FROM t1 WHERE xmin = 507;
  ctid
 -------
  (0,3)
 (1 row)
 
-test=# select heap_force_freeze('t1'::regclass, ARRAY['(0, 3)']::tid[]);
+test=# SELECT heap_force_freeze('t1'::regclass, ARRAY['(0, 3)']::tid[]);
  heap_force_freeze
 -------------------
 
 (1 row)
 
-test=# select ctid from t1 where xmin = 2;
+test=# SELECT ctid FROM t1 WHERE xmin = 2;
  ctid
 -------
  (0,3)
diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml
index 8007261d022..84753f3375d 100644
--- a/doc/src/sgml/plperl.sgml
+++ b/doc/src/sgml/plperl.sgml
@@ -229,7 +229,7 @@ $$ LANGUAGE plperl;
    references to Perl arrays.  Here is an example:
 
 <programlisting>
-CREATE OR REPLACE function returns_array()
+CREATE OR REPLACE FUNCTION returns_array()
 RETURNS text[][] AS $$
     return [['a&quot;b','c,d'],['e\\f','g']];
 $$ LANGUAGE plperl;
@@ -588,7 +588,7 @@ CREATE OR REPLACE FUNCTION lotsa_md5 (INTEGER) RETURNS SETOF foo_type AS $$
     return;
 $$ LANGUAGE plperlu;
 
-SELECT * from lotsa_md5(500);
+SELECT * FROM lotsa_md5(500);
 </programlisting>
     </para>
 
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index e937491e6b8..fb4d821a9f7 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1023,7 +1023,7 @@ IF count(*) &gt; 0 FROM my_table THEN ...
 tax := subtotal * 0.06;
 my_record.user_id := 20;
 my_array[j] := 20;
-my_array[1:3] := array[1,2,3];
+my_array[1:3] := ARRAY[1,2,3];
 complex_array[n].realpart = 12.3;
 </programlisting>
     </para>
@@ -1037,7 +1037,7 @@ complex_array[n].realpart = 12.3;
      within a <application>PL/pgSQL</application> function just by writing
      the command.  For example, you could create and fill a table by writing
 <programlisting>
-CREATE TABLE mytable (id int primary key, data text);
+CREATE TABLE mytable (id int PRIMARY KEY, data text);
 INSERT INTO mytable VALUES (1,'one'), (2,'two');
 </programlisting>
     </para>
diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml
index 2736868fb06..3adc5c6557f 100644
--- a/doc/src/sgml/queries.sgml
+++ b/doc/src/sgml/queries.sgml
@@ -2232,7 +2232,7 @@ WITH RECURSIVE included_parts(sub_part, part, quantity) AS (
     FROM included_parts pr, parts p
     WHERE p.part = pr.sub_part
 )
-SELECT sub_part, SUM(quantity) as total_quantity
+SELECT sub_part, sum(quantity) AS total_quantity
 FROM included_parts
 GROUP BY sub_part
 </programlisting>
@@ -2603,7 +2603,7 @@ WHERE w2.key = 123;
    undesirable is
 <programlisting>
 WITH w AS (
-    SELECT key, very_expensive_function(val) as f FROM some_table
+    SELECT key, very_expensive_function(val) AS f FROM some_table
 )
 SELECT * FROM w AS w1 JOIN w AS w2 ON w1.f = w2.f;
 </programlisting>
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index bea9f90138b..9d23ad5a0fb 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -1642,7 +1642,7 @@ ALTER TABLE measurements
 <programlisting>
 ALTER TABLE transactions
   ADD COLUMN status varchar(30) DEFAULT 'old',
-  ALTER COLUMN status SET default 'current';
+  ALTER COLUMN status SET DEFAULT 'current';
 </programlisting>
    Existing rows will be filled with <literal>old</literal>, but then
    the default for subsequent commands will be <literal>current</literal>.
diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index 0d240484cd3..11a9616177d 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -709,7 +709,7 @@ CREATE FUNCTION foo(int, int default 42) ...
    Add two integers using an SQL function:
 <programlisting>
 CREATE FUNCTION add(integer, integer) RETURNS integer
-    AS 'select $1 + $2;'
+    AS 'SELECT $1 + $2;'
     LANGUAGE SQL
     IMMUTABLE
     RETURNS NULL ON NULL INPUT;
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index a157a244e4e..94093599ca2 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -2257,7 +2257,7 @@ CREATE TABLE employees OF employee_type (
    Create a range partitioned table:
 <programlisting>
 CREATE TABLE measurement (
-    logdate         date not null,
+    logdate         date NOT NULL,
     peaktemp        int,
     unitsales       int
 ) PARTITION BY RANGE (logdate);
@@ -2267,7 +2267,7 @@ CREATE TABLE measurement (
    Create a range partitioned table with multiple columns in the partition key:
 <programlisting>
 CREATE TABLE measurement_year_month (
-    logdate         date not null,
+    logdate         date NOT NULL,
     peaktemp        int,
     unitsales       int
 ) PARTITION BY RANGE (EXTRACT(YEAR FROM logdate), EXTRACT(MONTH FROM logdate));
@@ -2277,8 +2277,8 @@ CREATE TABLE measurement_year_month (
    Create a list partitioned table:
 <programlisting>
 CREATE TABLE cities (
-    city_id      bigserial not null,
-    name         text not null,
+    city_id      bigserial NOT NULL,
+    name         text NOT NULL,
     population   bigint
 ) PARTITION BY LIST (left(lower(name), 1));
 </programlisting></para>
@@ -2287,8 +2287,8 @@ CREATE TABLE cities (
    Create a hash partitioned table:
 <programlisting>
 CREATE TABLE orders (
-    order_id     bigint not null,
-    cust_id      bigint not null,
+    order_id     bigint NOT NULL,
+    cust_id      bigint NOT NULL,
     status       text
 ) PARTITION BY HASH (order_id);
 </programlisting></para>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 5485033ed8c..e93ab7cd2bc 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -352,10 +352,10 @@ PostgreSQL documentation
    a role, named <literal>rewind_user</literal> here:
 <programlisting>
 CREATE USER rewind_user LOGIN;
-GRANT EXECUTE ON function pg_catalog.pg_ls_dir(text, boolean, boolean) TO rewind_user;
-GRANT EXECUTE ON function pg_catalog.pg_stat_file(text, boolean) TO rewind_user;
-GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text) TO rewind_user;
-GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text, bigint, bigint, boolean) TO rewind_user;
+GRANT EXECUTE ON FUNCTION pg_catalog.pg_ls_dir(text, boolean, boolean) TO rewind_user;
+GRANT EXECUTE ON FUNCTION pg_catalog.pg_stat_file(text, boolean) TO rewind_user;
+GRANT EXECUTE ON FUNCTION pg_catalog.pg_read_binary_file(text) TO rewind_user;
+GRANT EXECUTE ON FUNCTION pg_catalog.pg_read_binary_file(text, bigint, bigint, boolean) TO rewind_user;
 </programlisting>
   </para>
 
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 1a339600bc4..dbcd7907e26 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -2531,7 +2531,7 @@ Tue Oct 26 21:40:57 CEST 1999
          statement to be executed.  For example, to create an index on each
          column of <structname>my_table</structname>:
 <programlisting>
-=&gt; <userinput>SELECT format('create index on my_table(%I)', attname)</userinput>
+=&gt; <userinput>SELECT format('CREATE INDEX ON my_table(%I)', attname)</userinput>
 -&gt; <userinput>FROM pg_attribute</userinput>
 -&gt; <userinput>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</userinput>
 -&gt; <userinput>ORDER BY attnum</userinput>
@@ -4003,7 +4003,7 @@ SELECT 1 \bind \sendpipeline
         server as soon as it reaches the command-ending semicolon, even if
         more input remains on the current line.  Thus for example entering
 <programlisting>
-select 1; select 2; select 3;
+SELECT 1; SELECT 2; SELECT 3;
 </programlisting>
         will result in the three SQL commands being individually sent to
         the server, with each one's results being displayed before
@@ -4012,7 +4012,7 @@ select 1; select 2; select 3;
         command before it and the one after are effectively combined and
         sent to the server in one request.  So for example
 <programlisting>
-select 1\; select 2\; select 3;
+SELECT 1\; SELECT 2\; SELECT 3;
 </programlisting>
         results in sending the three SQL commands to the server in a single
         request, when the non-backslashed semicolon is reached.
@@ -5550,7 +5550,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
   input. Notice the changing prompt:
 <programlisting>
 testdb=&gt; <userinput>CREATE TABLE my_table (</userinput>
-testdb(&gt; <userinput> first integer not null default 0,</userinput>
+testdb(&gt; <userinput> first integer NOT NULL DEFAULT 0,</userinput>
 testdb(&gt; <userinput> second text)</userinput>
 testdb-&gt; <userinput>;</userinput>
 CREATE TABLE
@@ -5739,8 +5739,8 @@ testdb=&gt; <userinput>\crosstabview first second</userinput>
 This second example shows a multiplication table with rows sorted in reverse
 numerical order and columns with an independent, ascending numerical order.
 <programlisting>
-testdb=&gt; <userinput>SELECT t1.first as "A", t2.first+100 AS "B", t1.first*(t2.first+100) as "AxB",</userinput>
-testdb-&gt; <userinput>row_number() over(order by t2.first) AS ord</userinput>
+testdb=&gt; <userinput>SELECT t1.first AS "A", t2.first+100 AS "B", t1.first*(t2.first+100) AS "AxB",</userinput>
+testdb-&gt; <userinput>row_number() OVER (ORDER BY t2.first) AS ord</userinput>
 testdb-&gt; <userinput>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</userinput>
 testdb-&gt; <userinput>\crosstabview "A" "B" "AxB" ord</userinput>
  A | 101 | 102 | 103 | 104
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index 5a3bcff7607..fd441ef4487 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -1927,7 +1927,7 @@ SELECT * FROM unnest(ARRAY['a','b','c','d','e','f']) WITH ORDINALITY;
 
 <programlisting>
 WITH t AS (
-    SELECT random() as x FROM generate_series(1, 3)
+    SELECT random() AS x FROM generate_series(1, 3)
   )
 SELECT * FROM t
 UNION ALL
diff --git a/doc/src/sgml/tablefunc.sgml b/doc/src/sgml/tablefunc.sgml
index e10fe7009d1..6fc5b217826 100644
--- a/doc/src/sgml/tablefunc.sgml
+++ b/doc/src/sgml/tablefunc.sgml
@@ -281,7 +281,7 @@ SELECT * FROM crosstab('...') AS ct(row_name text, category_1 text, category_2 t
    <para>
     Here is a complete example:
 <programlisting>
-CREATE TABLE ct(id SERIAL, rowid TEXT, attribute TEXT, value TEXT);
+CREATE TABLE ct(id serial, rowid text, attribute text, value text);
 INSERT INTO ct(rowid, attribute, value) VALUES('test1','att1','val1');
 INSERT INTO ct(rowid, attribute, value) VALUES('test1','att2','val2');
 INSERT INTO ct(rowid, attribute, value) VALUES('test1','att3','val3');
@@ -293,10 +293,10 @@ INSERT INTO ct(rowid, attribute, value) VALUES('test2','att4','val8');
 
 SELECT *
 FROM crosstab(
-  'select rowid, attribute, value
-   from ct
-   where attribute = ''att2'' or attribute = ''att3''
-   order by 1,2')
+  'SELECT rowid, attribute, value
+   FROM ct
+   WHERE attribute = ''att2'' OR attribute = ''att3''
+   ORDER BY 1,2')
 AS ct(row_name text, category_1 text, category_2 text, category_3 text);
 
  row_name | category_1 | category_2 | category_3
@@ -347,13 +347,13 @@ crosstab<replaceable>N</replaceable>(text sql)
 
 <programlisting>
 CREATE TYPE tablefunc_crosstab_N AS (
-    row_name TEXT,
-    category_1 TEXT,
-    category_2 TEXT,
+    row_name text,
+    category_1 text,
+    category_2 text,
         .
         .
         .
-    category_N TEXT
+    category_N text
 );
 </programlisting>
 
@@ -371,10 +371,10 @@ CREATE TYPE tablefunc_crosstab_N AS (
 <programlisting>
 SELECT *
 FROM crosstab3(
-  'select rowid, attribute, value
-   from ct
-   where attribute = ''att2'' or attribute = ''att3''
-   order by 1,2');
+  'SELECT rowid, attribute, value
+   FROM ct
+   WHERE attribute = ''att2'' OR attribute = ''att3''
+   ORDER BY 1,2');
 </programlisting>
     </para>
 
@@ -572,18 +572,18 @@ row_name   extra   cat1   cat2   cat3   cat4
    <para>
     Here are two complete examples:
 <programlisting>
-create table sales(year int, month int, qty int);
-insert into sales values(2007, 1, 1000);
-insert into sales values(2007, 2, 1500);
-insert into sales values(2007, 7, 500);
-insert into sales values(2007, 11, 1500);
-insert into sales values(2007, 12, 2000);
-insert into sales values(2008, 1, 1000);
-
-select * from crosstab(
-  'select year, month, qty from sales order by 1',
-  'select m from generate_series(1,12) m'
-) as (
+CREATE TABLE sales(year int, month int, qty int);
+INSERT INTO sales VALUES (2007, 1, 1000);
+INSERT INTO sales VALUES (2007, 2, 1500);
+INSERT INTO sales VALUES (2007, 7, 500);
+INSERT INTO sales VALUES (2007, 11, 1500);
+INSERT INTO sales VALUES (2007, 12, 2000);
+INSERT INTO sales VALUES (2008, 1, 1000);
+
+SELECT * FROM crosstab(
+  'SELECT year, month, qty FROM sales ORDER BY 1',
+  'SELECT m FROM generate_series(1,12) m'
+) AS (
   year int,
   "Jan" int,
   "Feb" int,
diff --git a/doc/src/sgml/tcn.sgml b/doc/src/sgml/tcn.sgml
index 32a1025cc6b..98278fbee37 100644
--- a/doc/src/sgml/tcn.sgml
+++ b/doc/src/sgml/tcn.sgml
@@ -43,32 +43,32 @@
   A brief example of using the extension follows.
 
 <programlisting>
-test=# create table tcndata
+test=# CREATE TABLE tcndata
 test-#   (
-test(#     a int not null,
-test(#     b date not null,
+test(#     a int NOT NULL,
+test(#     b date NOT NULL,
 test(#     c text,
-test(#     primary key (a, b)
+test(#     PRIMARY KEY (a, b)
 test(#   );
 CREATE TABLE
-test=# create trigger tcndata_tcn_trigger
-test-#   after insert or update or delete on tcndata
-test-#   for each row execute function triggered_change_notification();
+test=# CREATE TRIGGER tcndata_tcn_trigger
+test-#   AFTER INSERT OR UPDATE OR DELETE ON tcndata
+test-#   FOR EACH ROW EXECUTE FUNCTION triggered_change_notification();
 CREATE TRIGGER
-test=# listen tcn;
+test=# LISTEN tcn;
 LISTEN
-test=# insert into tcndata values (1, date '2012-12-22', 'one'),
+test=# INSERT INTO tcndata VALUES (1, date '2012-12-22', 'one'),
 test-#                            (1, date '2012-12-23', 'another'),
 test-#                            (2, date '2012-12-23', 'two');
 INSERT 0 3
 Asynchronous notification "tcn" with payload ""tcndata",I,"a"='1',"b"='2012-12-22'" received from server process with PID 22770.
 Asynchronous notification "tcn" with payload ""tcndata",I,"a"='1',"b"='2012-12-23'" received from server process with PID 22770.
 Asynchronous notification "tcn" with payload ""tcndata",I,"a"='2',"b"='2012-12-23'" received from server process with PID 22770.
-test=# update tcndata set c = 'uno' where a = 1;
+test=# UPDATE tcndata SET c = 'uno' WHERE a = 1;
 UPDATE 2
 Asynchronous notification "tcn" with payload ""tcndata",U,"a"='1',"b"='2012-12-22'" received from server process with PID 22770.
 Asynchronous notification "tcn" with payload ""tcndata",U,"a"='1',"b"='2012-12-23'" received from server process with PID 22770.
-test=# delete from tcndata where a = 1 and b = date '2012-12-22';
+test=# DELETE FROM tcndata WHERE a = 1 AND b = date '2012-12-22';
 DELETE 1
 Asynchronous notification "tcn" with payload ""tcndata",D,"a"='1',"b"='2012-12-22'" received from server process with PID 22770.
 </programlisting>
-- 
2.51.1


--azr3km4zebrd3uiq--





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]
  Subject: Re: [PATCH v2] doc: Consistently use uppercase keywords
  In-Reply-To: <no-message-id-50@localhost>

* 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