pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: memnik@hotmail.com
Subject: BUG #16238: Function " to_char(timestamp, text) " doesn't work properly
Date: Thu, 30 Jan 2020 11:49:45 +0000
Message-ID: <16238-3008a3b37b41cb0e@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16238
Logged by:          Nick Memos
Email address:      memnik@hotmail.com
PostgreSQL version: 10.7
Operating system:   Windows 10
Description:        

Hello,
I have created a table with a json column. Where in this json i have some
details for each day of the week. It is something like this '{"Monday":
13,"Tuesday": 13,"Wednesday": 13, "Thursday ": 12, "Friday": 13,"Saturday":
13,"Sunday": 13}'::json.
So, when i try to get the information for each day by this way:  '{"Monday":
13,"Tuesday": 13,"Wednesday": 13, "Thursday ": 12, "Friday": 13,"Saturday":
13,"Sunday": 13}'::json->>to_char(current_timestamp,'Day') , i don't get the
results for all days. 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.
Now i will user trim() function but it is better to fix that if it is
possible.
Thanks!



view thread (4+ messages)  latest in thread

Message-ID: <16238-3008a3b37b41cb0e@postgresql.org>
Permalink:  ../16238-3008a3b37b41cb0e@postgresql.org/
Also on:    postgresql.org/message-id/16238-3008a3b37b41cb0e@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, memnik@hotmail.com
  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>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox