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 >

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

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

2016-01-25 Thread Charles Clavadetscher
; Subject: Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2 > > On 1/24/16, Christophe Pettus <x...@thebuild.com> wrote: > > > > On Jan 24, 2016, at 9:01 PM, Charles Clavadetscher > > <clavadetsc...@swisspug.org> wrote: > > > >> What is the poin

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

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

2016-01-24 Thread Charles Clavadetscher
> Subject: Re: [GENERAL] ERROR: check constraint - PostgreSQL 9.2 > > > On Jan 24, 2016, at 8:12 PM, "drum.lu...@gmail.com" <drum.lu...@gmail.com> > wrote: > > > How can I solve the problem? How can I get the command successfully be done? > > Two o

[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

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

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