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.96) (envelope-from ) id 1vmxQY-000d1f-0Y for pgsql-docs@arkaria.postgresql.org; Mon, 02 Feb 2026 17:09:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vmxQX-000YpR-0t for pgsql-docs@arkaria.postgresql.org; Mon, 02 Feb 2026 17:09:29 +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.96) (envelope-from ) id 1vmxQW-000YpI-33 for pgsql-docs@lists.postgresql.org; Mon, 02 Feb 2026 17:09:28 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vmxQT-00000000hJL-2vKn for pgsql-docs@lists.postgresql.org; Mon, 02 Feb 2026 17:09:27 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (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-107.mailbox.org (Postfix) with ESMTPS id 4f4Y4d1xplz9v8n; Mon, 2 Feb 2026 18:09:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1770052161; 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=engHyiaBh4oUZpMPbDL2WqSDizwDQAhpaSKK5TxTUgI=; b=KSmGUn4Vz6cEncFcQp5u6cJvEiPp5RfKmi8UUJs/0zlL2Vb86X5lDUfAPCljZrF7ALpzxK dpF2NAr1BTlS4bdFJL7yKqoXq4xL0WO9z1WnsyUVidMq2U6kNAw2I+L9rxV1OlDlbgLQka neJlcqitFvN7x+G6fRnq21Q+hLLkD5+zL4EK9gjCCDfjNFu0HGbYt8lBCCLBs83b4vpdib o/VxFkzWV33xA5zUIURRRIugSjttm2L2BF/ZgG+ggNn3NkZCLirHhCP1Kr2lNINfnRe4/0 JzZzQrgmOnr0/i1/epZNYoi0Itd9Uykva6GZwSNBibyzhwlR2WORjmebOzK6zg== Date: Mon, 2 Feb 2026 18:09:18 +0100 From: Erik Wienhold To: Hoda Salim Cc: pgsql-docs@lists.postgresql.org Subject: Re: [PATCH] docs: document N'...' national character string literal syntax Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-02-02 16:05 +0100, Hoda Salim wrote: > This patch documents the N'...' national character string literal > syntax, which has been supported by PostgreSQL but was previously > undocumented. > > The documentation explains: > - What the syntax is (N'hello') > - What the SQL standard specifies (implementation-defined national > character set) > - What PostgreSQL actually does (treats it as a cast to character type) > - Why it exists (compatibility with SQL migrated from other databases) > > I verified the documentation builds without errors. +1 I brought up the missing documentation before [1], but wasn't sure at the time if Postgres conforms to the SQL standard (mainly because of [2]). Now I see that [3] already claims to support national character (F421). That entry was commented with "syntax accepted" until commit 35223af0579. I read that as "fully supported" now. > + PostgreSQL does not implement a separate > + national character set; it treats N'...' as > + equivalent to a regular string constant cast to the > + character type, that is, '...'::character, > + using the database's character set. nchar is an alias of bpchar. There's no cast to char behind the scenes since that would truncate the string: select n'foo', 'foo'::character; bpchar | bpchar --------+-------- foo | f (1 row) Should we also mention the nchar alias in [4]? [1] https://www.postgresql.org/message-id/om3g7p7u3ztlrdp4tfswgulavljgn2fe6u2agk34mrr65dffuu%40cpzlzuv6flko [2] https://www.postgresql.org/message-id/1275895438.1849.1.camel@fsopti579.F-Secure.com [3] https://www.postgresql.org/docs/current/features-sql-standard.html [4] https://www.postgresql.org/docs/current/datatype-character.html -- Erik Wienhold