On 9/10/15, Roman Fleysher <roman.fleysher at einstein.yu.edu> wrote:
> Dear SQLiters,
>
> I am trying to temporarily disable CHECK constraint given in columns of
> table definition. As far as I understand,
>
> PRAGMA ignore_check_constraints='yes';

PRAGMA ignore_check_constraints=YES;  -- no quotes.

>
> should do it. However this example demonstrates that it is not:
>
> CREATE TABLE subject(
>   subjectID  INT,
>   gender     TEXT NOT NULL
> );
>
>
> CREATE TABLE input(
>   subjectID  INT,
>   gender     TEXT
> );
>
> INSERT INTO input(subjectID, gender) VALUES (1, 'female');
> INSERT INTO input(subjectID, gender) VALUES (2, 'male');
> INSERT INTO input(subjectID) VALUES (3);
>
> PRAGMA ignore_check_constraints='yes';
> INSERT INTO subject (rowid) SELECT rowid FROM input;
>
> Error: NOT NULL constraint failed: subject.gender
>
> I am using SQLite 3.8.11.1. Am I misusing the PRAGMA?
>
> Thank you,
>
> Roman
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to