Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN126-0008WL-Bs for pgsql-general@arkaria.postgresql.org; Mon, 28 Sep 2020 21:50:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kN125-0003aC-9d for pgsql-general@arkaria.postgresql.org; Mon, 28 Sep 2020 21:50:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN124-0003a5-VI for pgsql-general@lists.postgresql.org; Mon, 28 Sep 2020 21:50:05 +0000 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kN11y-00084o-4u for pgsql-general@lists.postgresql.org; Mon, 28 Sep 2020 21:50:03 +0000 Received: by mail-ot1-x32c.google.com with SMTP id s66so2520871otb.2 for ; Mon, 28 Sep 2020 14:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=UKDi0xnLI74aC/8KxgoHAZYQbo0cZvj3jfJ6dRGFg48=; b=jqJ42KlV2Cb4fqr8JZNU828kM6CDjpDooxMRhSFiSOKbZF1jCFGF+WzMwYJUHpX1Jp BFauNBhOrl+PdbVHWrclLPE5nBmDYNx/WLcvMLQ4cWnNzCGW/HGELKArXKmgnn+4EWZQ MHGiE30v7CIRstG5SgcyfpxNqWfmwa+82RsHjYGG1JesbhFsKdSXYmVJQ5c3rb301E/u jrfCPuIAHKryfK3PR900yJZgbDD1iP8yy0AC3odtB4xxZwf0RX/QRjZHhIiCx0Dbw70G g33ajUPtow90UaL0K0+InqH0YZK+vyE+tch6KgEM6Lg3ZkQ1B3heARihihKqWLbp599u 9Oqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=UKDi0xnLI74aC/8KxgoHAZYQbo0cZvj3jfJ6dRGFg48=; b=iu651RwfkQGc17A0Ma7BANfBCKgmnGUsiP61C28yULtcYGExeHkvNJcXCIjKocs2kQ Mah+YLj4AV8iFIfV1qgRyLw5Zj3mwQ2Obd51KYSumhx+Q1Oj8w8GCYO3V8QqwDWLd9yg 7TduMLBgKXCebMfPf1H+YdeStuN5FYt0zZb47UDSXnPazVmcBrjmp47Z0m+06bMUYvOY wRh9Dwlp7bLZfTz2a9Chgawhi2Wyup0uQijHhUDUg2W1nEFq6wapjpl7Yxr7kdGAVLTk 1S0NkQv2XZb0Q5xHOtVqw0NHhODjN69WOvvlxPA6JQsBxN4b1V3wn5df91qbU2JYTSNi cILg== X-Gm-Message-State: AOAM5330LmEuMFfivKu9L0KV0+GB/VgdZNQRw9R1W3KvRN4WABKBPvRk EblOXXkiZq+7EJOhhOQbkEVqSDODV/3bow== X-Google-Smtp-Source: ABdhPJwiYTDa3gOlAwxFUCqc4eRrH43GWZCWm1fz6SWbwGwiRwKmIp5z9pLq1VV9zk/mCrsbdV7r/g== X-Received: by 2002:a9d:6201:: with SMTP id g1mr689798otj.270.1601329796941; Mon, 28 Sep 2020 14:49:56 -0700 (PDT) Received: from [192.168.1.10] (ip174-67-143-111.no.no.cox.net. [174.67.143.111]) by smtp.googlemail.com with ESMTPSA id e19sm539227ote.37.2020.09.28.14.49.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Sep 2020 14:49:56 -0700 (PDT) Subject: Re: DOMAIN/composite TYPE vs. base TYPE To: pgsql-general@lists.postgresql.org References: <6198aad8-df09-569e-686b-7e32979cd7e4@freedomcircle.com> <0E2C98A4-7228-4FCE-9F22-328F0543F4F0@gmail.com> <3032f56a-3a5c-682b-512e-af6e8cb363d1@freedomcircle.com> From: Ron Message-ID: Date: Mon, 28 Sep 2020 16:49:55 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <3032f56a-3a5c-682b-512e-af6e8cb363d1@freedomcircle.com> Content-Type: multipart/alternative; boundary="------------2301963E0D1B7E7308B86E47" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------2301963E0D1B7E7308B86E47 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 9/28/20 4:31 PM, Joe Abbate wrote: > Hello Rob, > > On 28/9/20 17:17, Rob Sargent wrote: >> just record all three fields (day, month, year) with nulls and do the >> to-date as needed. > > That is not sufficient.  An earlier implementation had something like a > CHAR(8) to record YYYYMMDD, but how can you indicate, for example, an > issue date of a bimonthly magazine, say July-Aug 2020?  We can store > 2020-07-01 in the DATE attribute, but we need another attribute to > indicate it's really two months.  Also, by storing three separate columns, > you loose the beauty of the PG DATE abstraction. The Gramps genealogy program has figured it out; maybe it's source code can lend you some clues. -- Angular momentum makes the world go 'round. --------------2301963E0D1B7E7308B86E47 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 9/28/20 4:31 PM, Joe Abbate wrote:
Hello Rob,

On 28/9/20 17:17, Rob Sargent wrote:
just record all three fields (day, month, year) with nulls and do the to-date as needed.

That is not sufficient.  An earlier implementation had something like a CHAR(8) to record YYYYMMDD, but how can you indicate, for example, an issue date of a bimonthly magazine, say July-Aug 2020?  We can store 2020-07-01 in the DATE attribute, but we need another attribute to indicate it's really two months.  Also, by storing three separate columns, you loose the beauty of the PG DATE abstraction.

The Gramps genealogy program has figured it out; maybe it's source code can lend you some clues.

--
Angular momentum makes the world go 'round.
--------------2301963E0D1B7E7308B86E47--