Re: Incorrect handling of timezones with extract - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: Incorrect handling of timezones with extract
Date
Msg-id 513F89C2.3030005@agliodbs.com
Whole thread Raw
In response to Re: Incorrect handling of timezones with extract  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> The behavior of timestamp-plus-interval is certainly supported by that
> argument, but I'm less convinced about timestamp-minus-timestamp.  The
> raw result of the timestamp subtraction here is 71 hours (not the normal
> 72).  Perhaps it should be outputting it that way instead of converting
> to "2 days 23 hours", which is arguably inaccurate.

Probably, yes.  We added a barrier so that interval is supposed to be
years-months | weeks-days | hours-minutes-seconds-ms-ns.  However, it
sounds like we missed a few cases.

Mind you, there's a kind of insurmountable issue with timestamp
subtraction, where you can come up with *lots* of cases where timestamp
subtraction is not reversable due to the way we handle intervalization.Realistically, we'd need to have something like
ats_sub( tstz, tstz,
 
interval ) function to have a 100% reversible option.  That probably
contributes to why Oracle has never supported timestamp - timestamp.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Column defaults for foreign tables (was Re: [v9.3] writable foreign tables)
Next
From: Alex
Date:
Subject: Display output file name in psql prompt?