Your message dated Sun, 26 Apr 2015 13:18:05 +0200
with message-id <[email protected]>
and subject line Re: Bug#783339: INTERVAL hours miscomputed
has caused the Debian Bug report #783339,
regarding INTERVAL hours miscomputed
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
783339: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=783339
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: postgresql-9.1
Version: 9.1.15-0+deb7u1
Severity: important
File: postgresql

Dear Maintainer,

When "hours" are used in INTERVAL computations, #hours used in computations are 
double the #hours intended.
sample queries have been included below.

issue_tracker=> SELECT version(); SELECT now();
                                            version
-----------------------------------------------------------------------------------------------
 PostgreSQL 9.1.15 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 
4.7.2-5) 4.7.2, 64-bit
(1 row)

              now
-------------------------------
 2015-04-26 05:56:30.177713+00
(1 row)

issue_tracker=> SELECT issue_guid, time from issue_comments where issue_guid in 
 ('9FS6') and time > current_date - INTERVAL '4 hours' order  by 1 desc,2 asc; 
issue_guid |             time
------------+-------------------------------
 9FS6       | 2015-04-25 21:29:49.634983+00
 9FS6       | 2015-04-26 00:32:15.62193+00
 9FS6       | 2015-04-26 01:29:31.390987+00
 9FS6       | 2015-04-26 04:53:43.580836+00
 9FS6       | 2015-04-26 04:57:07.377853+00
 9FS6       | 2015-04-26 05:36:58.890024+00
(6 rows)

issue_tracker=> SELECT issue_guid, time from issue_comments where issue_guid in 
 ('9FS6') and time > current_date - INTERVAL '8 hours' order  by 1 desc,2 asc; 
issue_guid |             time
------------+-------------------------------
 9FS6       | 2015-04-25 16:16:34.876737+00
 9FS6       | 2015-04-25 16:19:11.695349+00
 9FS6       | 2015-04-25 16:48:28.876748+00
 9FS6       | 2015-04-25 16:49:15.693228+00
 9FS6       | 2015-04-25 18:35:26.722351+00
 9FS6       | 2015-04-25 21:29:49.634983+00
 9FS6       | 2015-04-26 00:32:15.62193+00
 9FS6       | 2015-04-26 01:29:31.390987+00
 9FS6       | 2015-04-26 04:53:43.580836+00
 9FS6       | 2015-04-26 04:57:07.377853+00
 9FS6       | 2015-04-26 05:36:58.890024+00
(11 rows)

issue_tracker=>

-- System Information:
Debian Release: 7.8
  APT prefers oldstable
  APT policy: (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.10.12-20130925-1206-a58b552 (SMP w/16 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages postgresql-9.1 depends on:
ii  libc6                  2.13-38+deb7u8
ii  libcomerr2             1.42.5-1.1+deb7u1
ii  libgssapi-krb5-2       1.10.1+dfsg-5+deb7u3
ii  libkrb5-3              1.10.1+dfsg-5+deb7u3
ii  libldap-2.4-2          2.4.31-2
ii  libpam0g               1.1.3-7.1
ii  libpq5                 9.1.15-0+deb7u1
ii  libssl1.0.0            1.0.1e-2+deb7u16
ii  libxml2                2.8.0+dfsg1-7+wheezy4
ii  locales                2.13-38+deb7u8
ii  postgresql-client-9.1  9.1.15-0+deb7u1
ii  postgresql-common      134wheezy4
ii  ssl-cert               1.0.32
ii  tzdata                 2014j-0wheezy1

postgresql-9.1 recommends no packages.

Versions of packages postgresql-9.1 suggests:
pn  locales-all             <none>
pn  oidentd | ident-server  <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
Re: Amit Tewari 2015-04-26 <20150426062818.5898.7871.reportbug@ops-db>
> When "hours" are used in INTERVAL computations, #hours used in computations 
> are double the #hours intended.
> sample queries have been included below.
> 
> issue_tracker=> SELECT version(); SELECT now();
>                                             version
> -----------------------------------------------------------------------------------------------
>  PostgreSQL 9.1.15 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 
> 4.7.2-5) 4.7.2, 64-bit
> (1 row)
> 
>               now
> -------------------------------
>  2015-04-26 05:56:30.177713+00
> (1 row)
> 
> issue_tracker=> SELECT issue_guid, time from issue_comments where issue_guid 
> in  ('9FS6') and time > current_date - INTERVAL '4 hours' order  by 1 desc,2 
> asc; issue_guid |             time
> ------------+-------------------------------
>  9FS6       | 2015-04-25 21:29:49.634983+00

Hi,

you are mixing up now() and current_date here. Current_date is a
*date*, if you use it in timestamp calculations, it will behave as if
00:00:00 was used as the time part.

All your resulting time values are > midnight minus 4 resp. 8 hours,
so everything is ok.

Christoph
-- 
[email protected] | http://www.df7cb.de/

Attachment: signature.asc
Description: Digital signature


--- End Message ---
_______________________________________________
Pkg-postgresql-public mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-postgresql-public

Reply via email to