Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ixCer-0002ag-AK for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jan 2020 16:27:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ixCep-0004aQ-Q0 for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jan 2020 16:27:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ixCep-0004aI-Ev for pgsql-bugs@lists.postgresql.org; Thu, 30 Jan 2020 16:27:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ixCen-00084f-3Z for pgsql-bugs@lists.postgresql.org; Thu, 30 Jan 2020 16:27:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 00UGR2X9022131; Thu, 30 Jan 2020 11:27:02 -0500 From: Tom Lane To: memnik@hotmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16238: Function " to_char(timestamp, text) " doesn't work properly In-reply-to: <16238-3008a3b37b41cb0e@postgresql.org> References: <16238-3008a3b37b41cb0e@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 30 Jan 2020 11:49:45 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22129.1580401622.1@sss.pgh.pa.us> Date: Thu, 30 Jan 2020 11:27:02 -0500 Message-ID: <22130.1580401622@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > As i noticed the problem is that the function " > to_char(timestamp, text) " doesn't work properly. For example this query " > select to_char('2020-01-29'::date,'Day') " give me this result "Wednesday", > but this query " select to_char('2020-01-31'::date,'Day') " give me this > result "Friday ". > So, i guess it is not right to have days with many spaces as a result and > some days without any space. No, that's behaving as expected and documented. If you don't want fixed-width output, use the FM prefix: =# select to_char('2020-01-31'::date,'-Day-'); to_char ------------- -Friday - (1 row) =# select to_char('2020-01-31'::date,'-FMDay-'); to_char ---------- -Friday- (1 row) regards, tom lane