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 1kN15N-0000Db-55 for pgsql-general@arkaria.postgresql.org; Mon, 28 Sep 2020 21:53:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kN15M-00073y-0F for pgsql-general@arkaria.postgresql.org; Mon, 28 Sep 2020 21:53:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN15L-00073m-KH for pgsql-general@lists.postgresql.org; Mon, 28 Sep 2020 21:53:27 +0000 Received: from out2-50.antispamcloud.com ([185.201.17.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN15I-0002S3-5D for pgsql-general@lists.postgresql.org; Mon, 28 Sep 2020 21:53:27 +0000 Received: from hp309.hostpapa.com ([69.90.160.170]) by mx169.antispamcloud.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1kN15A-0018Da-5E; Mon, 28 Sep 2020 23:53:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pendari.org ; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References :In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BuHVEqYo5en4eTj1hbTRQFVEV4EvzkpHXIHHp8hKPFY=; b=ZdI/+YnjJe+TnEJ/EoReo5rqRr KsAtvU2VNTR6NLiF655hJlQ0kwtfkHBSy2reIGfYwxEvpKfb+qaRtpm1Y2SzqCgDSXzRmWIRu5uGV JJJcPVOSECl1D63fEr81fkTxco5GycFgZtUTf028TQhwZdFoMyAuiMiex2rJDb3ox76RF4DYaSq3l 0ji83lq9zuPzHq/wma9wa1Q1OyhwnIb/mjPmkIOQhs5tKdQldmnOVTKR5aBt1jp2h0IEq7IXwewpU P1nGnb6aoIgFNk2ekcXno22HQ3ZckllcOTobzzSkWOCLf7xJOWK5CZQMw1+g427fEaA60tWXpwnIf RONekObQ==; Received: from [1.144.181.89] (port=11580 helo=[192.168.20.52]) by hp309.hostpapa.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kN14P-00FpdW-Hg; Tue, 29 Sep 2020 07:52:30 +1000 From: "Gavan Schneider" To: "Joe Abbate" Cc: "Rob Sargent" , pgsql-general@lists.postgresql.org Subject: Re: DOMAIN/composite TYPE vs. base TYPE Date: Tue, 29 Sep 2020 07:52:14 +1000 X-Mailer: MailMate (1.13.2r5721) Message-ID: In-Reply-To: <3032f56a-3a5c-682b-512e-af6e8cb363d1@freedomcircle.com> References: <6198aad8-df09-569e-686b-7e32979cd7e4@freedomcircle.com> <0E2C98A4-7228-4FCE-9F22-328F0543F4F0@gmail.com> <3032f56a-3a5c-682b-512e-af6e8cb363d1@freedomcircle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-OutGoing-Spam-Status: No, score=-1.0 X-Get-Message-Sender-Via: hp309.hostpapa.com: authenticated_id: list.pg.gavan@pendari.org X-Authenticated-Sender: hp309.hostpapa.com: list.pg.gavan@pendari.org X-AuthUser: list.pg.gavan@pendari.org X-Originating-IP: 69.90.160.170 X-Spampanel-Domain: outgoing-shared.hostpapa.com X-Spampanel-Username: outgoingshared Authentication-Results: antispamcloud.com; auth=pass (login) smtp.auth=outgoingshared@outgoing-shared.hostpapa.com X-Spampanel-Outgoing-Class: unsure X-Spampanel-Outgoing-Evidence: Combined (0.21) X-Recommended-Action: accept X-Filter-ID: Mvzo4OR0dZXEDF/gcnlw0Z1apovzGPsYhEeBL1aoZmqpSDasLI4SayDByyq9LIhVV+D4Q7uneOpN HRorrLz4LUTNWdUk1Ol2OGx3IfrIJKyP9eGNFz9TW9u+Jt8z2T3Kdle4yXgm6rbiSK9iW2dcblPy PxUCFJrPBMkAg8ZSbNxGwBkOY/72qjb1AG0voJBp1/hV3CGcI6PJ6gulHaqk4xobVr4s0ii3X4/z b62vnqUemwpIs7wyF5Xose7mdgDfjamD4SA34fhqhq0chfhJ9yTg127TqHZDxA/kZB41Rh/+79TE wV9b/+tvRgVvRyzHVG5wHyxUKYfOn1ADpeivF1PnStOuqeq+0zfvt/z1v9UaqW5GG99B9AJi2gij wgrKUuIn8CQh9So8IRVqMJHRUs94EgcD4+ERqKb7uc82rF+sdKBFyUkhOUYlbVKyq6l0Hhel62mT CAJ/3XRQhbaUCCBCSV3IUd3DQwMExSF+B+/qMM4KknKNWNsysN0cNJ+rxn1FeKALSowX5eJ+HNgQ PiMX7NqinNH4ReGDHdJcB8Dl8mOwxiJ7UogeK+io9X7I50Qn2uq41S2U+AVHOlpV4Hz7Z1++xZDv XRSpoN8g2PXxipy9TmFCZx+i3Cdo92U1LFpFCyJ/9hQbxd9VB27J3XoSKlHMxVnkurBPHtW+f1JW l9AKOV/fU5Ys3Y1o14XLaYe878wp1eaooa+nEHKVFqBuASgyFzSQYEHRVR/kC9GS8kpyhhwlIJ4j o3kydk6hJL3/ZDITPXyeupkTwMy478oCA/GYHsEaRndWzCgyw73Zww0LAQPseU27xx2gr81VPZIW iROxGryg92+NobvTMnIoeyYCNq2sdy/TAoF4eWGmWNyzcGsA5zineQnaiYS2eNfEH9HecYT4wfS2 lq8kcCe8c1vcJu9DRId6kFyWGH08CVsONrMJuGzuoGnKTKcymM3wdmgQWXh2wiHMabAAne0aBEig NkXMuWckYdZ4DW3w7ECTMt6Htob+7AUnmSKT0HHZknuewzp0MqJa0BTG0d40eTXlWiUAYdLmsJdA oPL0QnDSgOzci5XU/cIAIlEoLdn+BR8FHzUN92M7DsfMsFQaYR1YEnLfiJ387EMjTfrrb8jjJ5kT AAhMpmW6EbjpktA795OH0z2GTQcmAYeurQ== X-Report-Abuse-To: spam@quarantine10.antispamcloud.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 29 Sep 2020, at 7:31, 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. > This is only a partial “fix” and goes nowhere near solving the full wrapper/abstraction problem… Consider expressing all the component fields as a range. This allows you the ability to be a precise as you need and still have the benefits of well defined comparison functions. Regards Gavan Schneider —— Gavan Schneider, Sodwalls, NSW, Australia Explanations exist; they have existed for all time; there is always a well-known solution to every human problem — neat, plausible, and wrong. The ancients, in the case at bar, laid the blame upon the gods: sometimes they were remote and surly, and sometimes they were kind. In the Middle Ages lesser powers took a hand in the matter, and so one reads of works of art inspired by Our Lady, by the Blessed Saints, by the souls of the departed, and even by the devil. H. L. Mencken, 1920