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 1v9TDH-0010wk-Ir for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 19:00:34 +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 1v9TDG-00Ezqw-Hi for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 19:00:33 +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 1v9TDG-00EzqZ-AE for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 19:00:33 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9TDD-002Zx0-01 for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 19:00:33 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-b62ed9c3e79so732203a12.0 for ; Thu, 16 Oct 2025 12:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760641229; x=1761246029; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0NNdI+P16cUSm6iz8dY7c9j8sJTdiP6QOEgw7/cSDMk=; b=cMfx8Pas/962d0Yix64O8RhGu8dSgpqQepoAO6hj9pBfXShqk6C2j5a/8LZPtMqQ+H K4zdYwUL/MZr8gHjS79VjNWMZMiwmX2J29Y95FskJUPbisnuDTCiMLow1COwLmiytjk2 lY7SFraJ/YAUp+zKabWS0g3AqZGoBJIeedd4udjKiNCobI2bhaJI2VCM1ED/Qm7bdnJ2 dLt3v3thsd9Om+0itl46BZYNVCjHjRjdFDWWw5jz1eDOiGfZX+DWVoCE8Hs6H6s5Lqsq F0ELxNOKPqGzEQaiJvjObb7amVhbDrL1+MLS0FGxnkn5lOG8x8JinlsteQys/FGNWWAe A+vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760641229; x=1761246029; h=content-transfer-encoding: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=0NNdI+P16cUSm6iz8dY7c9j8sJTdiP6QOEgw7/cSDMk=; b=XOU/HWnfchNd0thVmY/j9VroYl2AfzqJemoZGSmruktNKD7kTmBg0Gq2k2fvRuPYa5 81G0KYeCpb2mqF5FdSHz7iHgE7yrmguxH0knzZrq98tED85HThKD6dGJ5UYUPnL8ZJx0 9JF82UIPmSlgvO+VDhghIQqagigRhZwtrRf7ejcw3IuPjart5qUV6xOGOI+dfVbFLTnM yPFEjRQzWQxMtS4Y0DhQoTBsufa9nlJVe7qV0vq33oTzx9jPIZvUHIAKFLhT35/lxJ3n Awor4j6Z/rr5IJ6eAY62HyCcV7e2T3nThOG7lTsa033zGXRKrRFF1rr0adOTREvEY6Cy rRvg== X-Forwarded-Encrypted: i=1; AJvYcCWpO8tGDIVZBk3vG78GLkTuoEM+s1SKSca6sZuX4N7y6gpKNtwPROupJYC93K0Lb5sEX5AD6ZO02rtw@lists.postgresql.org X-Gm-Message-State: AOJu0YyJBgYlBPXt7HfgbF4NMhI6HHBxtKVeYrm9WByMxQNV+BILdiAR Idnne28Gn7R822ZMTJUWX5Ob8o967e9ZwCuM3Y57mdjkS8eWlBci+1fOfDMAZ/slnva/SWmWJvN NS/EZ9ElK0YqaB3SjyZMqElfC3Fk8IwY= X-Gm-Gg: ASbGncvpLaWJbLUkH8MfI38yxAuoG5dokVTBXm2s3TcTGibzxoNDlUNh/M9txgxNsDs Z4+EcUkNZjgONvgJ07b3RRgipo9Er+o8Io6LHb8qhvhlgBInT9qClILiXa/msHUiJ47At7vz6Ri 9kxGIK+Rz4EdfAy8yAw/gDQKviPCEgNVEZ/BrJPsl4des+IRXPCfYJi0XHhSSR9G+c8TI906V1D zxvyofopngTbU9qfiJv3dNP1nO/oywdg8BTAai7uf6YAEDpV5y5fFsav+zisw== X-Google-Smtp-Source: AGHT+IEY46pBiXhuJ6jTzjNlJc4m6/TBwUGk72Olp8Phma3cLcRVLc0Jfcasd/ZpfbV1h1pdfioOOnxOGmOUCVAfI6k= X-Received: by 2002:a17:902:ec87:b0:27a:6c30:49c with SMTP id d9443c01a7336-290ca4fab50mr12826985ad.27.1760641228708; Thu, 16 Oct 2025 12:00:28 -0700 (PDT) MIME-Version: 1.0 References: <176044409338.770.16064383081308443747@wrigleys.postgresql.org> <1307875.1760556576@sss.pgh.pa.us> In-Reply-To: From: Sergei Katkovsky Date: Thu, 16 Oct 2025 23:00:04 +0400 X-Gm-Features: AS18NWC0Ap_qMo_T-WVLyvhhd67Fl-etLUZBprT9vmCu-eCaZXOWYemono93HNY Message-ID: Subject: Re: BPCHAR description in 8.3. Character Types is misleading and incomplete To: "David G. Johnston" Cc: Tom Lane , Jeff Davis , "pgsql-docs@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Oct 16, 2025 at 10:11=E2=80=AFPM David G. Johnston wrote: > The spaces added to the end of a bpchar manually can and are considered = =E2=80=9Cpadding=E2=80=9D - or =E2=80=9Cpresent but lack semantic/value sig= nificance=E2=80=9D. The reason they are not padding for varchar is that suc= h spaces are considered part of the stored value from a semantic perspectiv= e. > > Think of padding as a noun, not a verb. =E2=80=9CThe value contains padd= ing=E2=80=9D. Not, =E2=80=9C I am padding the value=E2=80=9D. The value may sometimes contain padding. And sometimes not. But we are talking about the type, not value. The value 'abc'::bpchar does not contain any blanks. But it's still a BPCHAR value. And it is not padded, despite that its type is BPCHAR. > And yes, this is intended as a way to make the name of the type and its b= ehavior consistent. The behavior of 'abc'::BPCHAR is, for example, the following: length('abc'::BPCHAR) =3D 3 CONCAT('abc::BPCHAR, 'def') =3D 'abcdef'. What of the above is consistent with the notion of being 'blank-padded'? And, the proposal is not to change the name of the type. The proposal is to change the wording 'blank-trimming' to something more appropriate. > You sorta have to want it to work/make sense; not fight it on minor nuanc= e. The sole reason that I am here is that recently I came across a (year-old) question on stackoverflow where some person was curious why the actual behavior of BPCHAR was inconsistent with the documentation. What is worse is that the question was answered, but answered incorrectly. So, I doubt that it is just a minor nuance. Probably, not just one person tried to use BPCHAR as a 'blank-trimming' type. With best regards, Sergei Katkovskii