pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11031: Unexpected interval representations
4+ messages / 3 participants
[nested] [flat]

* BUG #11031: Unexpected interval representations
@ 2014-07-24 13:23  marius.bauer@here.com
  0 siblings, 1 reply; 4+ messages in thread

From: marius.bauer@here.com @ 2014-07-24 13:23 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11031
Logged by:          Marius Bauer
Email address:      marius.bauer@here.com
PostgreSQL version: 9.3.3
Operating system:   Amazon RDS
Description:        

Please see following query and result:

unitystg=> select a + b as sum, b - a as dif, 2 * a as pro, b / 2 as quo
from (select interval'1 day 15:45:25' as a, interval'2 days 12:34:56' as b)
as foo;
       sum       |       dif       |       pro       |      quo
-----------------+-----------------+-----------------+----------------
 3 days 28:20:21 | 1 day -03:10:29 | 2 days 31:30:50 | 1 day 06:17:28
(1 row)

Usually I'd expect the day will be adjusted in those cases when the hour is
>= 24 or < 0, but this does not happen.

The interval value itself is correct, just the representation is unexpected.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #11031: Unexpected interval representations
@ 2014-07-24 14:49  David G Johnston <david.g.johnston@gmail.com>
  parent: marius.bauer@here.com
  0 siblings, 1 reply; 4+ messages in thread

From: David G Johnston @ 2014-07-24 14:49 UTC (permalink / raw)
  To: pgsql-bugs

marius.bauer wrote
> The following bug has been logged on the website:
> 
> Bug reference:      11031
> Logged by:          Marius Bauer
> Email address:      

> marius.bauer@

> PostgreSQL version: 9.3.3
> Operating system:   Amazon RDS
> Description:        
> 
> Please see following query and result:
> 
> unitystg=> select a + b as sum, b - a as dif, 2 * a as pro, b / 2 as quo
> from (select interval'1 day 15:45:25' as a, interval'2 days 12:34:56' as
> b)
> as foo;
>        sum       |       dif       |       pro       |      quo
> -----------------+-----------------+-----------------+----------------
>  3 days 28:20:21 | 1 day -03:10:29 | 2 days 31:30:50 | 1 day 06:17:28
> (1 row)
> 
> Usually I'd expect the day will be adjusted in those cases when the hour
> is
>>= 24 or < 0, but this does not happen.
> 
> The interval value itself is correct, just the representation is
> unexpected.

Unexpected != Bug; this question belongs on -general

See http://www.postgresql.org/docs/9.3/interactive/functions-datetime.html

Justify_days
Justify_hours

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11031-Unexpected-interval-representations-tp5812713p5812...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #11031: Unexpected interval representations
@ 2014-07-25 08:01  marius.bauer <marius.bauer@here.com>
  parent: David G Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: marius.bauer @ 2014-07-25 08:01 UTC (permalink / raw)
  To: pgsql-bugs

Thanks David, then please take this as an idea to let PostgreSQL call those
functions implicitly when an interval is cast to a text, possibly enabling
switching this behaviour on and off via a configuration setting. That'd make
our lives a little easier. Thanks again! :)



--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11031-Unexpected-interval-representations-tp5812713p5812...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #11031: Unexpected interval representations
@ 2014-07-25 13:38  David G Johnston <david.g.johnston@gmail.com>
  parent: marius.bauer <marius.bauer@here.com>
  0 siblings, 0 replies; 4+ messages in thread

From: David G Johnston @ 2014-07-25 13:38 UTC (permalink / raw)
  To: pgsql-bugs

marius.bauer wrote
> Thanks David, then please take this as an idea to let PostgreSQL call
> those functions implicitly when an interval is cast to a text, possibly
> enabling switching this behaviour on and off via a configuration setting.
> That'd make our lives a little easier. Thanks again! :)

Not my call but I doubt such a patch would be approved.  If you want that
behavior use the supplied functions.  Enabling a change in this behavior via
configuration will never fly and if we make it the default there would be no
way to get at the unaligned value.

You need a stronger argument than making lives a little easier.  Conformance
with specs, or at least a majority of other systems, would at least have the
inter-operability argument.

David J.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11031-Unexpected-interval-representations-tp5812713p5812...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2014-07-25 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-07-24 13:23 BUG #11031: Unexpected interval representations marius.bauer@here.com
2014-07-24 14:49 ` David G Johnston <david.g.johnston@gmail.com>
2014-07-25 08:01   ` marius.bauer <marius.bauer@here.com>
2014-07-25 13:38     ` David G Johnston <david.g.johnston@gmail.com>

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