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 1v9Oq6-00HRT2-6l for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 14:20:21 +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 1v9Oq5-00DJb1-3F for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 14:20:20 +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 1v9Oq4-00DJar-Rk for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 14:20:19 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9Oq2-0026mL-12 for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 14:20:18 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-26a0a694ea8so6284015ad.3 for ; Thu, 16 Oct 2025 07:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760624417; x=1761229217; 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=JAp5sRJbcr3hDHTrh4mLoBunACHxvEwqMJhG/fqAfR0=; b=KE0ZN6OGnaoEebEAqiZ6jObkX3KiDnhYUMXTD/EIPM266aq1LkS4meDH3KztlUm2vq /NWSa7uuPlY2iKInz3WeUCvl0FVbahAa1ekPS3cNHXpMfcelhZWVRxfFyjB/eO4G09yj cvH5O/D7oPOOg4F48O3ySM3U74TRD9tLmlGNZXQgM2SZBkQhfD9Qp3AvW0nCd77BigOF 6JkB3oFGEEdssOPcmGWHMOgLtAgL4W4G7RpTUZHyoozXz/+54yGPIzFq8G/fMz9oxMMc 48gSogW8gFKO7KfMkaIJ2OsMjVt4D9VkdZWQDrgEbEC5v6wyOsCXvsF6FZnZWlgahX8M 9F8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760624417; x=1761229217; 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=JAp5sRJbcr3hDHTrh4mLoBunACHxvEwqMJhG/fqAfR0=; b=qwBpmWsXf1Zcv1jWR+t8TRSc/aGGL9KT8VfgLhgw5YbmtRwDrnE+SDN3My3zmyKsit 1iz1YQFD5Z/TmAzuJp1W1t4Ly2zkr5J7P7Up9wjCEDlR19SzBrA8fj1PuxRi/Xagus5e Hc/kdtUUzL/2BRvhlx24A0rkn6Fzc3eiohPeglVcDIUydbRzDi0ogIoaPvlp64R/YFZ+ 1eMjn0AJjao2bst++OI2+2lpKg/gnMvJcR9stiO+kMLSoocOTeKHDFATqMtYRYVF5hd6 ydsNrwLBxTKeLb1vd4c4OmfY7T//13Cs4/t9yxS9AuXxzkaGI+/NV/CN2uD6LvYpeX7b z0bw== X-Forwarded-Encrypted: i=1; AJvYcCVo20AzSR5oLsFLj1rfoh4mscCOAc0TAmBPMVB44oP/Jfx0FEz0chtFNoUPBek95vR0lpeO0VltYiS2@lists.postgresql.org X-Gm-Message-State: AOJu0YwBXz1XOHbHidd8SXdWNL3RaOu8ChtgVPK4SGrBiHhBpSlp7r5+ ae0n8r/EaY4BNDOkIohrOtFT7Y1UHs+wNky+vOktiUUqYrhD/hJObmGUsKB41e3tndXAEpiLWOQ JfTeDvhlUOQCLTyVyd1zT7MJntCXKr0M8ZgYwuLw= X-Gm-Gg: ASbGncu39nxQiiSrfgCRDiZDkudIo0GcsKCtg7/QWiPLubSQPUXKiw6wYFHRBJqurvZ y0z4txAhhUpzT+c4U3HDhb5dgSbasFZ14VYP+pe+njb45Y4iHuuH8bfuVOwZV7cR4XANM7eoWOJ CSHVcufPuowdeiqy/hostiC0xLdlRG2DFZi64dN+pSM0zM5JPFSs48RFLOM4Hr2M+NEU2XFaBNB 1kveTpXsEOx5ZuK3MvhyslAHLJqdiQsoNGTetRAQq16Y51VghQauXS31lNlIY9vr/jm2lWr X-Google-Smtp-Source: AGHT+IFaaf649MPQKwKoE9OVN/HrDA679ue6WitFZOHX8CZ5G40XR9GRh8FpQsgRqdANAVOp/tnxVj+PHIgYY0qRyEw= X-Received: by 2002:a17:902:cec7:b0:290:c09f:a48b with SMTP id d9443c01a7336-290c9ca3225mr2123435ad.16.1760624416733; Thu, 16 Oct 2025 07:20:16 -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 18:19:51 +0400 X-Gm-Features: AS18NWDj-wMGBD5pUNqiG6US4NWmEFMFHktKS4RRrCv9YEMHFA9xyu_eMW2RMwM 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 4:36=E2=80=AFPM David G. Johnston wrote: > > A given value has a finite length and there is just no restriction on wha= t that length is. All trailing spaces in the input are considered padding = for purposes of comparison i.e., manually padding is added by the user as o= pposed to the system. A given value of BPCHAR is stored as is, without padding or trimming (contrary to the current wording in Table 8.4 about black-trimming). But what is the point of saying that it is manually padded, if the user is free to store it without any padding? And, although technically you can say that BPCHAR is blank-padded for purposes of comparison (but saying that blanks are trimmed or ignored for that purpose is also technically correct), it is definitely not padded in other contexts, neither for concatenation, where not padding or trimming occurs at all, nor for length evaluation, where blanks are trimmed or ignored. > So bpchar(n) is automatically blank padded to a total length for a value = of n characters. bpchar also has padding blanks but they must be manually = inserted during value creation. BPCHAR(n) is definitely blank-padded to n, no doubt. BPCHAR may have trailing blanks, if and only if they are added manually. But the ability to store trailing blanks is not the same as blank-padding. Manual addition is not padding, If it were, then VARCHAR would also be "blank-padded", because you can manually add trailing blanks to values of this type too. But of course it isn't. > I would leave the note of blank-padded for both and just point out the au= tomatic vs manual distinction. The current wording in Table 8.4 is that BPCHAR is blank-trimmed, not blank-padded anyway. With best regards, Sergei Katkovskii