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 1v9Hsn-00Ef68-Ro for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 06:54:41 +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 1v9Hsm-00ATAe-Rl for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 06:54:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9Hsm-00ATAW-KL for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 06:54:39 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9Hsj-0022qy-2y for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 06:54:38 +0000 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-b62fcddfa21so217167a12.1 for ; Wed, 15 Oct 2025 23:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760597675; x=1761202475; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rT69JeffJXr/zuzVyVZ4cbhDxhb6fU+f/DzKSsxAbGc=; b=IekAMeZZmtrWfWOC/9lmERkUnmu5AIxhbBAW35Zp9dWr/zE+H4XZkhVbD3jkN90unC 55OtRcoq9GOoAm29GKuxVgcnrEIDX5rfvZK07ctQTV4COeji/4RpijkGCDM73UELHf1s oJ5/vAemzHnEs8kzolmnHgxEOGMNMY3/lhRRzVl5tfKTwfF0ke7g0zVLQ4Rw2B6NajxI QksgpG6vN390YfUFd5fX+HTnuM3lA5gpBzA3/U7p0v1zzmwp5nw/OcE8gzU3/bVVXg8r PpPc3vuymqNus2+5MtHixCrCljjYGEslA8AalLNnr9GSwinY3HmNusVLVEDpDRw5t/hQ 8CAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760597675; x=1761202475; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rT69JeffJXr/zuzVyVZ4cbhDxhb6fU+f/DzKSsxAbGc=; b=ecIq/ddxKeke5qQxJjNS/MwmUJSBoF1fjC2kkm1ma2WhvE0wPDJKenzl/9xF7H0/vj webkpacLXJXMByuzbpYV3MuwYEAlvq3n4PlVlzTCDy2eR/PFlbOHyfIe+LnRIp4Z84pK fHLS9Gu87bypr/sZycuvXfFnQRzsUBPwuqpqwhsOFb052sD2/KXR1MSjzvrpd4xj8Lct MDohsP4zithIzQTRLt6mLxChw4de1HqEv/qXXojn8MlN6KTAuMz/dPeCfTrwBusp2UOz jXpyqeBAmR5sJzh/cil0iAGRh0xGywkxV5Qc9Qpoxu2UvyU0fYps6JpprbeP3QmP+xUk SnFA== X-Forwarded-Encrypted: i=1; AJvYcCWgd0Zd722FSecU76831f3jRUVZr54ArI7Iy0FlW+rG+0G22qZjWjCiU8RRNxhu0727Y5NrYx7LQjLf@lists.postgresql.org X-Gm-Message-State: AOJu0YzF2nyvfU0kjPr2TQiTn0vbNj8OVLzrGf7s8vCROByJgg5uUE8u dsW1AQ3+WbR2PfmAhCSZ39koNUNvb+3KWy1LxNfHOM5miUeKBz7X5JFiuZGNGVWjdXtq7v1M1wN 9ppLZQIN9hVW00RPKI88j6hqnv2JjGaI= X-Gm-Gg: ASbGncsgZ3CWHjEo4FvpIteP9JIDxpGVBQqAqmdRpIYcBO3FFGwdc7gpVIYByvbmsSW GWVZl4WEY4G5bYQcgjbAxpjvkt61GzMGTO1nGSvvxOajYh/nSsQC2iZchUJFdTlafyBDV3PsDVp XJZeDSUAUAILfcBwni6/aXUBJC+axLuWI06kbwwnqn/PCnjjutpdu1pDNL26axAxR1GEbe1WC73 WZX6I9BDG6OpSaPaWD71sEw8c0uGWCeh2Csl4Gf1JgwqPQDgLqBaTRb+mcSMZhCTcEvvMYM X-Google-Smtp-Source: AGHT+IHKLPa1oJMgq5nlBU/BfAOnneEdeBOEED8gwKODtL6N+FNN4moOGqFM64dalsSt+hu5cSH6V9IzMx/4cc0IuOc= X-Received: by 2002:a17:903:2342:b0:28d:1815:6382 with SMTP id d9443c01a7336-290272e3ed2mr409441385ad.46.1760597675610; Wed, 15 Oct 2025 23:54:35 -0700 (PDT) MIME-Version: 1.0 References: <176044409338.770.16064383081308443747@wrigleys.postgresql.org> <1307875.1760556576@sss.pgh.pa.us> In-Reply-To: <1307875.1760556576@sss.pgh.pa.us> From: Sergei Katkovsky Date: Thu, 16 Oct 2025 10:53:59 +0400 X-Gm-Features: AS18NWBQNNY9pkncQGeAcxqwaYwzxqyFJpbh_UH4jbRnxLpB5hA3NtTR8fOBq20 Message-ID: Subject: Re: BPCHAR description in 8.3. Character Types is misleading and incomplete To: Tom Lane Cc: Jeff Davis , pgsql-docs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > I don't understand why any of these variants are better than the > original wording "blank-padded". That has the non-negligible > advantage of corresponding to the type name, and furthermore > appears in many other places in our docs and source code. The wording for BPCHAR (not to be confused with BPCHAR(N) is already "blank-trimming", not "blank-padded". And "blank-padded" is probably the least correct wording variant for BPCHAR, because this type has unlimited length and it's impossible to pad to the infinity. The following example (slight modification of my original example, I replaced varchar with bpchar(6)) can perhaps explain the difference. SELECT length(bpchar_val) as bplen, concat('[', bpchar_val, ']') as bpbrack , length(char6_val) as c6len, concat('[', char6_val, ']') as c6brack FROM (VALUES ('abc '::bpchar, 'abc '::bpchar(6)), ('abc '::bpchar, 'abc'::bpchar(6)), ('abc'::bpchar, 'abc '::bpchar(6)), ('abc'::bpchar, 'abc'::bpchar(6))) AS bpchar_test (bpchar_val, char6_val) WHERE bpchar_val = char6_val; There results are: bplen bpbrack c6len c6brack 3 [abc ] 3 [abc ] 3 [abc ] 3 [abc ] 3 [abc] 3 [abc ] 3 [abc] 3 [abc ] As you can see, there are four rows, so, comparison ignores blanks, length() also ignores blank, but the results of concatenation show that while BPCHAR(6) was actually padded to 6 characters ('abc' became 'abc '), BPCHARwas not. 'abc' remained 'abc'. Therefore, I don't think it's a good idea to call BPCHAR "blank-padded". With best regards, Sergei Katkovskii