pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: stan <stanb@panix.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Storing a time interval
Date: Fri, 8 Nov 2019 15:38:49 -0500
Message-ID: <20191108203849.GA5401@panix.com> (raw)
In-Reply-To: <143433ed-b3f2-2749-4ae8-d282dcb7f3ce@aklaver.com>
References: <20191108194307.GA16920@panix.com>
	<CAHOFxGpt1FG4W0RpXY7HCYebw3=_+c=ZBFcDEWaS+uzC2Q+u3w@mail.gmail.com>
	<143433ed-b3f2-2749-4ae8-d282dcb7f3ce@aklaver.com>

On Fri, Nov 08, 2019 at 12:12:59PM -0800, Adrian Klaver wrote:
> On 11/8/19 11:57 AM, Michael Lewis wrote:
> > You certainly could choose to store as??tstzrange, but why not use two
> > fields?
> > 
> > https://www.postgresql.org/docs/current/rangetypes.html
> 
> I would lean more to a composite type:
> 
> https://www.postgresql.org/docs/11/rowtypes.html
> 
> Range types are built around looking for values within the range, whereas
> the OP is looking for two discrete values. The two field method you suggest
> above also encapsulates that.
> 
Thanks folks. 

After thinking over both your sugestions, I beleive teh optimum way to do this
may look like:


CREATE TYPE po_dates AS (
    po_isssued_date        timestamptz,
	discount_last_date     timestamptz,
	net_date               timestamptz
	);

-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin





view thread (7+ messages)  latest in thread

Message-ID: <20191108203849.GA5401@panix.com>
Permalink:  ../20191108203849.GA5401@panix.com/
Also on:    postgresql.org/message-id/20191108203849.GA5401@panix.com

 · 

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-general@postgresql.org
  Cc: stanb@panix.com, adrian.klaver@aklaver.com
  Subject: Re: Storing a time interval
  In-Reply-To: <20191108203849.GA5401@panix.com>
  References: <20191108194307.GA16920@panix.com> <CAHOFxGpt1FG4W0RpXY7HCYebw3=_+c=ZBFcDEWaS+uzC2Q+u3w@mail.gmail.com> <143433ed-b3f2-2749-4ae8-d282dcb7f3ce@aklaver.com> <20191108203849.GA5401@panix.com>

* 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