Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maNXm-0004kT-0B for pgsql-general@arkaria.postgresql.org; Tue, 12 Oct 2021 19:34:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1maNXj-000307-3s for pgsql-general@arkaria.postgresql.org; Tue, 12 Oct 2021 19:34:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maNXi-0002zz-2v for pgsql-general@lists.postgresql.org; Tue, 12 Oct 2021 19:34:30 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maNXZ-0006B8-G1 for pgsql-general@lists.postgresql.org; Tue, 12 Oct 2021 19:34:29 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 93AF932007BE; Tue, 12 Oct 2021 15:34:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 12 Oct 2021 15:34:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=T gH84Bp6eVLIyXcvLOH4TcRGOv1XsyrHZKi8to36qM0=; b=HAWha4jxcvRfmMCO5 HvPkM4eQIYV0z4qfQ7SKw+1qC0YzBxGjuDM6W8U0QyYbNE1+i1A+jM/HagUXxYHI uuveU8a/Eu6Xuc0CUTc3Y1x1Go0PwIfLS/PgmQ+aq7jgCdrKskb0u9choAZYYMAh enXVS/X7wDfgU5Grff6T27GZmSBE6AcA0DyDBLp/c8uSI+FFqajoAvotwAENwmol /UOT1yrrppkZzaUoVtP4e655nPcGQPDbguJHNJETOWIShPaCQWw5cMBoCAm7FNro jJEqWG2AyDL1TlmxZQ0dVmrVU5JSAanAphl1mt67OoAaNkYqAtx/kvq2dR+xtmRn cmD0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=TgH84Bp6eVLIyXcvLOH4TcRGOv1XsyrHZKi8to36q M0=; b=f683je4AV9khHm8OIssiZAVkHG47rsUocVVLdiGEdLWF+3EJrosmsyvLR q/5RfafUUKaUfWh9YqNeW+5rzrUQ+hMJyPXGW2+5UaRb8t6RXi32iQXMwqcE6iug V/ie6PQUiZlZbOhB607FNUAOQXpghRxutOr2btTMpI03Sodz1kLoKWhtlwqXsxW8 EFhbho9fyTNnKuuxZJ/jgYzuDvshIzlEbxjKPgbXuyVW0z5upO07chddvLLKW5uZ STHcqCo+1Q07tbsFLKheWYSuiMxl69rqsQdjpAi6DkVxgVTrd26/+dvH681+5Ud8 LlbG94u8AXHjSAXiaFF1TYNp7xgPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtkedgudefhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepleekgeejhfekteehfeduveetheeivdduheekudel teefvdffueehtddvgedtfeefnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrgh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughr ihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Oct 2021 15:34:17 -0400 (EDT) Message-ID: <10fbeda1-606a-553b-3598-eca814f40bb7@aklaver.com> Date: Tue, 12 Oct 2021 12:34:16 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: Fault with initcap Content-Language: en-US To: Shaozhong SHI , pgsql-general References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/12/21 09:31, Shaozhong SHI wrote: > I tried initcap and found a major problem with it. What Postgres version? In version 12 and 14 I get: > > Initcap of notemachine is NoteMachine. select initcap('notemachine'); initcap ------------- Notemachine > > Initcap of Sainsbury's Bank is Sainsbury'S bank. select initcap('Sainsbury''s Bank'); initcap ------------------ Sainsbury'S Bank Which follows the definition here: https://www.postgresql.org/docs/14/functions-string.html initcap ( text ) → text Converts the first letter of each word to upper case and the rest to lower case. Words are sequences of alphanumeric characters separated by non-alphanumeric characters. > > This is not expected. What is the encoding, collate, ctype for the database? Can be found in psql using: \l db_name > > Anyway to get around this problem? > > Regards, > > David -- Adrian Klaver adrian.klaver@aklaver.com