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.98.2) (envelope-from ) id 1xNqqc-00000002mPH-0ZMY for pgsql-general@arkaria.postgresql.org; Mon, 02 Nov 2026 12:09:11 +0000 Received: from localhost ([127.0.0.1]:42718 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xNqqa-00000003Wbj-1C33 for pgsql-general@arkaria.postgresql.org; Mon, 02 Nov 2026 12:09:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:52344) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xNqqZ-00000003Wba-3WqQ for pgsql-general@lists.postgresql.org; Mon, 02 Nov 2026 12:09:07 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xNqqX-00000002E7L-1R8V for pgsql-general@lists.postgresql.org; Mon, 02 Nov 2026 12:09:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description; bh=GPvfIaubXWkjNv4UQu6FsDTGWK+vv8fgMzbszo4HFtw=; b=dCNV6qhkY3Vyc4cs3rrLuhB1gb MxalQ23FydD6JjWRwrv7EbwslCBG50/WbMhMC5rvMnR4n4OvZVMsG8czdj+qFoNhrrAsYn5aulhxb gBdkcisXpEifrhM2pmSfCUdB5//1gL9TCgcBORM46R6N4XBVcJKFDgNvYBeY6A5reNDE=; Received: from depesz by depesz.com with local (Exim 4.98.2) (envelope-from ) id 1xNqs6-00000004J1J-3M1M; Mon, 02 Nov 2026 13:10:42 +0100 Date: Mon, 2 Nov 2026 13:10:42 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Igor Korot Cc: "pgsql-generallists.postgresql.org" Subject: Re: Return trimmed string from the query Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Nov 01, 2026 at 01:17:10AM -0600, Igor Korot wrote: > hi, ALL, > Is there an option to return a trimmed string from the query? > If I try to retrieve the char(10) from the table and the field only have > "abc", how to prevent the value to be returned as "abc "? Others already helped, but also, please read: https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don't_use_char(n) Best regards, depesz