[GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-24 Thread drum.lu...@gmail.com
Hi all, need some help to add a constraint to an existing table (with data). I'm running the command: *Query:* ALTER TABLE integrations.accounts DROP CONSTRAINT IF EXISTS cc_at_least_one_setting_needed, ADD CONSTRAINT cc_at_least_one_setting_needed CHECK (("qb_settings" IS NOT NULL) or ("x

Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-24 Thread Christophe Pettus
On Jan 24, 2016, at 8:12 PM, "drum.lu...@gmail.com" wrote: > How can I solve the problem? How can I get the command successfully be done? Two options: 1. Fix the data. 2. Use the NOT VALID option on ALTER TABLE ... ADD constraint, which allows the addition of a constraint without actually c

Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-24 Thread Christophe Pettus
On Jan 24, 2016, at 8:17 PM, Christophe Pettus wrote: > 2. Use the NOT VALID option on ALTER TABLE ... ADD constraint, which allows > the addition of a constraint without actually checking its validity. And note that you might miss some potential planner optimizations this way, as the planner

Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-24 Thread Charles Clavadetscher
m which it must apply. Bye Charles > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Christophe Pettus > Sent: Montag, 25. Januar 2016 05:18 > To: Postgres General > Subject: Re: [GENERAL] ERROR: c

Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-24 Thread Christophe Pettus
On Jan 24, 2016, at 9:01 PM, Charles Clavadetscher wrote: > What is the point of having a check constraint that is not checked? Well, it *is* checked going into the future; it's just not checked at the time the constraint is added. Ultimately, you do want to fix the data, but this makes it

Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-25 Thread Vitaly Burovoy
On 1/24/16, Christophe Pettus wrote: > > On Jan 24, 2016, at 9:01 PM, Charles Clavadetscher > wrote: > >> What is the point of having a check constraint that is not checked? > > Well, it *is* checked going into the future; it's just not checked at the > time the constraint is added. Ultimately,

Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-25 Thread Charles Clavadetscher
Hello Vitaly > -Original Message- > From: Vitaly Burovoy [mailto:vitaly.buro...@gmail.com] > Sent: Montag, 25. Januar 2016 14:25 > To: Christophe Pettus ; clavadetsc...@swisspug.org > Cc: Postgres General > Subject: Re: [GENERAL] ERROR: check constraint - PostgreSQL 9

Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2

2016-01-29 Thread Vick Khera
On Sun, Jan 24, 2016 at 11:12 PM, drum.lu...@gmail.com wrote: > So, I made a SELECT to get some data, to see where's the issue: > > SELECT * FROM integrations.accounts WHERE qb_settings IS NULL OR > xero_settings IS NULL OR freshbooks_settings IS NULL OR myob_settings IS > NULL OR ppy_settings IS