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: fcaldasdesou@bloomberg.net
Subject: BUG #18445: date_part / extract range for hours do not match documentation
Date: Tue, 23 Apr 2024 10:10:25 +0000
Message-ID: <18445-2bdf6f3c730abe6d@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18445
Logged by:          Filipe Caldas
Email address:      fcaldasdesou@bloomberg.net
PostgreSQL version: 14.11
Operating system:   Linux (RHEL 8)
Description:        

In https://www.postgresql.org/docs/8.1/functions-datetime.html

We say that EXTRACT() should return a number between 0-23 for hours

hour
The hour field (0 - 23)
SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
Result: 20

The function seems to also return 24 in some cases eg:

SELECT date_part('hour', cast('24:00:00.00' as time))::int

Could we update the documentation or modify the function so that it wraps 24
back to 0 hours?
Thanks



view thread (7+ messages)  latest in thread

Message-ID: <18445-2bdf6f3c730abe6d@postgresql.org>
Permalink:  ../18445-2bdf6f3c730abe6d@postgresql.org/
Also on:    postgresql.org/message-id/18445-2bdf6f3c730abe6d@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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, fcaldasdesou@bloomberg.net
  Subject: Re: BUG #18445: date_part / extract range for hours do not match documentation
  In-Reply-To: <18445-2bdf6f3c730abe6d@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