From: | Ron <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Alter table column constraint |
Date: | 2018-12-17 20:32:25 |
Message-ID: | d0845332-78ec-5387-6672-aaf50e0b5968@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 12/17/2018 02:20 PM, Rich Shepard wrote:
> On Mon, 17 Dec 2018, Melvin Davidson wrote:
>
>> Yes, you must drop then add the revised constraint. However, from your
>> statement above, it sounds to me as if you would be better off using A
>> FOREIGN kEY CONSTRAINT. It makes things a lot simpler.
>
> Melvin,
>
> I don't follow. Here's the DDL for that column:
>
> industry varchar(24) NOT NULL
> CONSTRAINT invalid_industry
> CHECK (industry in ('Agriculture', 'Business, other', 'Chemicals',
> 'Energy', 'Law', 'Manufacturing', 'Mining', 'Municipalities',
> 'Ports/Marine Services', 'Transportation')),
>
> and I want to remove Municipalities for the more general Government.
Melvin is saying to:
1. create a table named valid_industry,
2. populate it with the valid industries,
3. create an FK constraint on your main table's industry column to
valid_industry.industry, and then
4. drop the constraint invalid_industry.
--
Angular momentum makes the world go 'round.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-12-17 20:32:35 | Re: Alter table column constraint |
Previous Message | Kumar, Virendra | 2018-12-17 20:20:12 | RE: NL Join vs Merge Join - 5 hours vs 2 seconds |