Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfTfN-0001Gy-3g for pgsql-general@arkaria.postgresql.org; Fri, 04 Jan 2019 17:53:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gfTfL-0006Eb-BO for pgsql-general@arkaria.postgresql.org; Fri, 04 Jan 2019 17:53:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfTfK-0006EU-OX for pgsql-general@lists.postgresql.org; Fri, 04 Jan 2019 17:53:50 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfTfH-0006yT-IZ for pgsql-general@lists.postgresql.org; Fri, 04 Jan 2019 17:53:49 +0000 Received: by mail-pf1-x436.google.com with SMTP id u6so18616865pfh.11 for ; Fri, 04 Jan 2019 09:53:47 -0800 (PST) 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-transfer-encoding:content-language; bh=twDfX9e1alGdLfqTRjj+dboAzJ8bOoS+CmGvR8aeq8Q=; b=SoZNe+F9XFbbcyewJXXohBhYsfD8czI1mJM6HT9oXHJLp3RDnvvX6F0r44dy9dgwZS 28S0s3nahTYd8NkGZgX0yXU6uNohZEto93apmsUFJhTD1DBeMSw6DXcKoIFAW6fF3fiJ t4+keAuyS0bNuYOI0ggbzCuMtDcSgKDc6SJcb0PPazJOmgZoK9XRdJF8In2kUZzgPfOs n9frmSGiOAwaSdscxgctKr8pcQw8Gklr/tHa2OCNJ0DZe5cP0HtetjCvTBHcWsn0bR1P Z0n7oYhr5cpCV3p+TjgWCbdRt2Ame4jSrtfALm1YtYQF7AV3ucYo1E6aiFJ72nEU/fFF RNAw== 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-transfer-encoding :content-language; bh=twDfX9e1alGdLfqTRjj+dboAzJ8bOoS+CmGvR8aeq8Q=; b=sIgk39z+SxAmm2+IfdRssaw/JlNL6dtYyXCJ7sGbvkYWFAy7Yp5Zx2OOssKvvek3+h 4Xg5I8rh4DMcvSaWGQku9c3MVPeda1/hpnQaSepk/fG24z3YP5/8WDBd181jhiGnR1gG p4X/U4cSO/jU1j3r9PHfh7fPhl/1iwjs4VxtQKAUgcWDzwUEYOb8CmshiLSA3vhkMPTx ZeI/zVNu0agNe4YdvQ5cpkTKE09Ptb4v/5egvdMiSDPJPRsL6BqNz0u1X62ILEUo4VYD o29D1gpkf5URo0lZY0gwV/dLUKtwd+zl81/lAxVU2aBTIF9eN9FglAVZA4TW2Noypl2P B7jw== X-Gm-Message-State: AJcUuke6vLaYArZLNTUIWY4jdIZuhQFmTGacphwd6YubsWhZWsEb6JnG Go75SS6I1qzvORt103zNms8+Mx6u X-Google-Smtp-Source: ALg8bN7VkNGeBBjH+V8qyoXU9jZ4oiGQ6opYy99D2fsQeZiqzvoVHVfn0SO1VhHUEVnaHaT8VdHypg== X-Received: by 2002:a63:fa06:: with SMTP id y6mr2452926pgh.177.1546624425554; Fri, 04 Jan 2019 09:53:45 -0800 (PST) Received: from [10.104.134.14] ([155.100.47.6]) by smtp.gmail.com with ESMTPSA id s37sm77736114pgm.19.2019.01.04.09.53.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 09:53:44 -0800 (PST) Subject: Re: Comparing dates in DDL To: pgsql-general@lists.postgresql.org References: From: Rob Sargent Message-ID: <55d28758-0b55-5d91-83fc-7b601eaa3d02@gmail.com> Date: Fri, 4 Jan 2019 10:53:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/4/19 10:26 AM, Rich Shepard wrote: > On Fri, 4 Jan 2019, Rob Sargent wrote: > >> Is the end_date always knowable at record insert? > > Rob, > >   Not always. Sometimes projects have known end dates, other times the > end > is interminate until it happens. > >> CHECK(end_date is null or start_date <= end_date) > >   So a default of NULL should be applied, or just allowed to happen? > > Thanks, > > Rich > This is exactly what null is for.  Much preferable to some arbitrary value which will confuse analyses.