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
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
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
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
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
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,
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
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