Re: Comparing dates in DDL

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Comparing dates in DDL
Date: 2019-01-04 17:18:51
Message-ID: f1c86c61-34c0-0741-6a6f-438a7fd5794a@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)appl-ecosys(dot)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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-01-04 17:21:52 Re: Comparing dates in DDL
Previous Message Andreas Kretschmer 2019-01-04 17:16:45 Re: Comparing dates in DDL