Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vC25p-008AZr-Nt for pgsql-docs@arkaria.postgresql.org; Thu, 23 Oct 2025 20:39:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vC25o-00BiuV-KQ for pgsql-docs@arkaria.postgresql.org; Thu, 23 Oct 2025 20:39:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vC25o-00BiuL-6a for pgsql-docs@lists.postgresql.org; Thu, 23 Oct 2025 20:39:27 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vC25k-003rwL-2F for pgsql-docs@lists.postgresql.org; Thu, 23 Oct 2025 20:39:26 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4csyZ068M8z9t0J; Thu, 23 Oct 2025 22:39:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1761251961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CfC7txcObnvf6Oj6PjwShFs4Aau9zxJWThvb8wJg5tw=; b=2IDhXYFPBtPYzy9AYljnplgiHyFb4VC1pebUcHq+ejvdamhJzUu5haRqQ4cTAypR4nxt6t X97Y0NoIMhtIeui4bspKKT0unYntCp0qb/wDDOl+hbA6xAXM/oVpRcbswUSZrxSVEbHH5h n9iUYtWrNadFizr4J6VhPrb6yjYJ+n34o7sH6WAO3zxMCTjMcFR2WeC4E35xzAlZzz+Kbk eK9Xc3PBx20IJAwRm/H9yoUbHCrN/3wThIlfy+Mz34fD/z3RBC6wonoImODgZXG65JI48H NlGk852z49C7GZBw71YqLNMwunMR0SedXWZShVTJfZBQsSSfl4TK3xeemBjteA== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ewie@ewie.name designates 2001:67c:2050:b231:465::2 as permitted sender) smtp.mailfrom=ewie@ewie.name Date: Thu, 23 Oct 2025 23:39:17 +0300 From: Erik Wienhold To: Euler Taveira Cc: pgsql-docs@lists.postgresql.org Subject: Re: Use uppercase keywords in foreign key tutorial Message-ID: <0a9d7393-1cf2-4d38-a648-631c1f93e345@ewie.name> References: <82eb512b-8ed2-46be-b311-54ffd26978c4@ewie.name> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="azr3km4zebrd3uiq" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4csyZ068M8z9t0J List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --azr3km4zebrd3uiq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 ' > (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 '/