Re: [GENERAL] Constraint + where

2017-03-19 Thread Melvin Davidson
On Sun, Mar 19, 2017 at 8:53 PM, Patrick B wrote: > > > 2017-03-20 13:27 GMT+13:00 Melvin Davidson : > >> >> >> On Sun, Mar 19, 2017 at 8:16 PM, Patrick B >> wrote: >> >>> Hi guys, >>> >>> I've got a column 'type_note' on a new table that it's being designed: >>> >>> type_note varchar(32) NOT NU

Re: [GENERAL] Constraint + where

2017-03-19 Thread Melvin Davidson
On Sun, Mar 19, 2017 at 8:27 PM, Melvin Davidson wrote: > > > On Sun, Mar 19, 2017 at 8:16 PM, Patrick B > 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 d

Re: [GENERAL] Constraint + where

2017-03-19 Thread Patrick B
2017-03-20 13:27 GMT+13:00 Melvin Davidson : > > > On Sun, Mar 19, 2017 at 8:16 PM, Patrick B > 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

Re: [GENERAL] Constraint + where

2017-03-19 Thread Melvin Davidson
On Sun, Mar 19, 2017 at 8:16 PM, Patrick B 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 t

[GENERAL] Constraint + where

2017-03-19 Thread Patrick B
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!

Re: [GENERAL] Best way to alter a foreign constraint

2017-03-19 Thread Sylvain Marechal
2017-03-19 17:55 GMT+01:00 Adrian Klaver : > On 03/19/2017 01:54 AM, Sylvain Marechal wrote: > >> >> >> 2017-03-18 20:40 GMT+01:00 Adrian Klaver > >: >> >> On 03/18/2017 12:05 PM, Sylvain Marechal wrote: >> > > >> >> Why not CASCADE?: >> >> test=# ALTE

Re: [GENERAL] Best way to alter a foreign constraint

2017-03-19 Thread Adrian Klaver
On 03/19/2017 01:54 AM, Sylvain Marechal wrote: 2017-03-18 20:40 GMT+01:00 Adrian Klaver mailto:adrian.kla...@aklaver.com>>: On 03/18/2017 12:05 PM, Sylvain Marechal wrote: Why not CASCADE?: test=# ALTER TABLE test1 DROP CONSTRAINT test1_t1_key CASCADE; NOTICE: drop casc

Re: [GENERAL] Best way to alter a foreign constraint

2017-03-19 Thread Sylvain Marechal
2017-03-18 20:40 GMT+01:00 Adrian Klaver : > On 03/18/2017 12:05 PM, Sylvain Marechal wrote: > >> Hello all, >> >> Some of my tables were badly designed and have 2 indexes, like the >> following example (lots of tables have same problem): >> >> <<< >> postgres=# \d test1 >> Table "public.test