Re: Comparing dates in DDL - Mailing list pgsql-general

From Rob Sargent
Subject Re: Comparing dates in DDL
Date
Msg-id f1c86c61-34c0-0741-6a6f-438a7fd5794a@gmail.com
Whole thread Raw
In response to Re: Comparing dates in DDL  (Igor Korot <ikorot01@gmail.com>)
Responses Re: Comparing dates in DDL
Re: Comparing dates in DDL
List pgsql-general
On 1/4/19 10:12 AM, Igor Korot wrote:
> Hi, Rich,
>
> On Fri, Jan 4, 2019 at 10:53 AM Rich Shepard <rshepard@appl-ecosys.com> wrote:
>>     I have a projects table that includes these two columns:
>>
>> start_date date DEFAULT CURRENT_DATE,
>> end_date date
>>          CONSTRAINT valid_start_date
>>          CHECK (start_date <= end_date),
>>
>>     1. Do I need a DEFAULT value for the end_date?
>>     2. If so, please suggest a value for it.
> start_date.day() + 1?
>
> Thank you.
>
>> TIA,
>>
>> Rich
>>

Is the end_date always knowable at record insert?

CHECK(end_date is null or start_date <= end_date)



pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Comparing dates in DDL
Next
From: Rich Shepard
Date:
Subject: Re: Comparing dates in DDL