Re: Constraint + where

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Constraint + where
Date: 2017-03-20 00:54:41
Message-ID: CANu8Fiz77HzbXXqLrdU3G8FZN5WtJd7KYWnM5LmrphdgxBOkUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Mar 19, 2017 at 8:27 PM, Melvin Davidson <melvin6925(at)gmail(dot)com>
wrote:

>
>
> On Sun, Mar 19, 2017 at 8:16 PM, Patrick B <patrickbakerbr(at)gmail(dot)com>
> wrote:
>
>> Hi guys,
>>
>> I've got a column 'type_note' on a new table that it's being designed:
>>
>> type_note varchar(32) NOT NULL;
>>
>> On that column, there will be three different data:
>>
>> 1. yes
>> 2. no
>> 3. maybe
>>
>> I wanna create a FK but just when the data on that column is = maybe.
>>
>> How can I do that? Thanks!
>>
>>
> Why just "maybe"? Since there can only be three valid answers, why not FK
> for all three?
>
> --
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.
>

Also "type_note varchar(32) NOT NULL;" is pointless.
You should make it either type_note(1) with values of Y,N or M.

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2017-03-20 00:57:19 Re: Constraint + where
Previous Message Patrick B 2017-03-20 00:53:33 Re: Constraint + where