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 1vEdO9-00EewX-6v for pgsql-docs@arkaria.postgresql.org; Fri, 31 Oct 2025 00:53:10 +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 1vEdO7-00BNSY-Sp for pgsql-docs@arkaria.postgresql.org; Fri, 31 Oct 2025 00:53:06 +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 1vEdO7-00BNSQ-Dz for pgsql-docs@lists.postgresql.org; Fri, 31 Oct 2025 00:53:06 +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 1vEdO4-005A0F-0P for pgsql-docs@lists.postgresql.org; Fri, 31 Oct 2025 00:53:06 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (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 4cyMsR4VFhz9skK; Fri, 31 Oct 2025 01:52:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1761871979; 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=JrXo9/qxr3BhXdlxnczXoiciscaPIRYyu3uaTRXfoHk=; b=pLXKoUST/WPv9kdOgxxCKt8+1oUgInRFho93N+l4TQ+SLg0nH8ezqt4PKfDLRyyE+2POWZ roK8UKq9D+J+QTyBX/3g9L/9511ijWdbhlVKXFNCPxT47PD/AJUpF+N8Gdy6q2ROewC/7p /k/EdMfxxIlm/iwSe+cmOoxG2dQNDhjW2f6rVqci7ZBycatJ3yM8PX4jaMRi2uSRYU98vd KX5HXiX6giX1rMHW9K/upM1PrCCdeERw33LuMiGiruYnryej7qr9MFPXae7VkS5nj83Dhp 4eV8/zikEbK/+JM718ueTdjqSw6amkq/qTZrj8pTM9AMXWWfBe9uPGzLhn6j9Q== Date: Fri, 31 Oct 2025 01:52:48 +0100 From: Erik Wienhold To: David Rowley Cc: Tom Lane , Bruce Momjian , Nathan Bossart , Euler Taveira , pgsql-docs@lists.postgresql.org Subject: Re: Use uppercase keywords in foreign key tutorial Message-ID: <0a68a965-4599-4af1-a1eb-bd8e1be75788@ewie.name> References: <82eb512b-8ed2-46be-b311-54ffd26978c4@ewie.name> <0a9d7393-1cf2-4d38-a648-631c1f93e345@ewie.name> <2903384.1761770924@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="chxid222hywahboc" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --chxid222hywahboc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 2025-10-29 22:24 +0100, David Rowley wrote: > On Thu, 30 Oct 2025 at 09:48, Tom Lane wrote: > > > > Bruce Momjian writes: > > > On Tue, Oct 28, 2025 at 04:34:45PM -0500, Nathan Bossart wrote: > > >> I noticed the patch also changes some column types to lowercase: > > >> ... > > >> - category_N TEXT > > >> + category_N text > > >> > > >> FWIW I tend to use uppercase for those, too, but I'm not sure there is a > > >> preferred style for the docs. > > > > > Agreed, uppercase is better for type names. > > > > "text" is not a keyword according to either us or the SQL standard. > > I agree that there's some reason to capitalize things that are > > grammar keywords, such as INTEGER or VARCHAR, but it's a big stretch > > to go from that to capitalizing everything that is a type name. > > Would you capitalize user-defined type names? > > Going by: git grep -i "\btext\b," we're fairly consistently using > lower case, so FWIW, when I looked, I thought Eric's change made > sense. That is also my impression. The docs clearly favor lowercase identifiers and the various data type subpages consistently introduce types as lowercase names. Also, if you check the output of format_type() or pg_get_viewdef() you'll see that we use lowercase types names there as well, even for the ones mandated by the SQL standard: regress=> CREATE VIEW myview AS SELECT 'foo'::VARCHAR AS f1; CREATE VIEW regress=> SELECT pg_get_viewdef('myview'); pg_get_viewdef ----------------------------------------- SELECT 'foo'::character varying AS f1; (1 row) 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. > How about if Eric just drops the portion of the patch that alters the > casing of the types and leaves all the keyword uppercasing stuff in. > Any objections to that part? In the attached v3 I've reverted that part (and other similar changes that I had already in the pipeline after my OCD kicked in ;). With one exception: datatype.sgml has this change because lowercase bit(3) is already used in the same listing a couple of lines down: -CREATE TABLE test (a BIT(3), b BIT VARYING(5)); +CREATE TABLE test (a bit(3), b bit varying(5)); That's the only listing with inconsistently cased type names I could find. Besides that I've fixed a couple of more places that had lowercase keywords or were missing some whitespace that I had missed before. -- Erik Wienhold --chxid222hywahboc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v3-0001-doc-Apply-consistent-formatting-to-sample-SQL-sta.patch"