Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'yet.': 0.04; 'subject:Python': 0.06; 'default.': 0.09; 'separately': 0.09; 'subject:2.7': 0.09; 'cc:addr:python-list': 0.11; 'thread': 0.14; '(note,': 0.16; '23,': 0.16; '8:40': 0.16; 'assumptions': 0.16; 'backwards': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'least.': 0.16; 'sqlite': 0.16; 'stuff.': 0.16; 'url:sqlite': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'putting': 0.22; 'cc:addr:python.org': 0.22; 'pointer': 0.24; 'cc:2**0': 0.24; 'developers': 0.25; '(for': 0.26; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'went': 0.31; 'disable': 0.31; 'disabled': 0.31; 'enabled': 0.31; 'keys': 0.31; 'writes:': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'explains': 0.36; "didn't": 0.36; 'url:org': 0.36; 'nov': 0.38; 'pm,': 0.38; 'skip:u 10': 0.60; 'future': 0.60; 'skip:n 10': 0.64; 'frank': 0.68; 'default': 0.69; 'foreign': 0.74; 'connection.': 0.74; 'careful': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=FYU1OpducLE4x3xBuwTxgaS4+ApkntPBqxW6f9jbq/o=; b=0MNC3gfQJ3w3uwu+McBXNxvQw+JCGuO9PZ1Gk+r1r8CNzWdZBh+Bgyxo0kzzoGB33E Lgz5NNyUqRYiMQeABZT0Nmy5dExwWGl4nNn6WT8Ir3fETESFkI7rryWBG6rmLXJxzL8T rrHitOyXZC1gyg0S2onuyx4p2yx6FQBy2wq+0GV41cI3921Mz3voSVt9+57fkXtxD8V+ /PKfBGYQxMm4puavVpuAIwd30j/TE53WTcyVOuQNgFqolyTBNJu/Rc1IEnGbLFcq1b8P 55xXhe5LLL0tNmOgT3fugHzga6GtS2bX5na1poGZUd3QU3bbvSQxlpl6hg1tdgXdoYdP QeDg== MIME-Version: 1.0 X-Received: by 10.42.106.12 with SMTP id x12mr20080735ico.26.1416736396686; Sun, 23 Nov 2014 01:53:16 -0800 (PST) In-Reply-To: References: <5d474a87-e2a5-43d3-b07c-4a1194880b4d@googlegroups.com> <54716987.7040301@gmail.com> Date: Sun, 23 Nov 2014 20:53:16 +1100 Subject: Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416736404 news.xs4all.nl 2837 [2001:888:2000:d::a6]:43349 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81354 On Sun, Nov 23, 2014 at 8:40 PM, Jussi Piitulainen wrote: > Chris Angelico writes: >> On Sun, Nov 23, 2014 at 7:21 PM, Frank Millman wrote: >> >> > To enable them, add the following - >> > >> > pragma foreign_keys = on; >> > >> > It works for me. >> >> Thanks, I went poking around briefly but didn't find that pragma. > > I didn't notice a pointer to the relevant documentation in this thread > yet. So here, and in the rest of that page: > > >From that page: """Foreign key constraints are disabled by default (for backwards compatibility), so must be enabled separately for each database connection. (Note, however, that future releases of SQLite might change so that foreign key constraints enabled by default. Careful developers will not make any assumptions about whether or not foreign keys are enabled by default but will instead enable or disable them as necessary.)""" That explains it. Putting the "backwards" into "backwards compatibility", but understandable, at least. I'm pointing all the people I know to this page; just enable the things and then you can actually trust stuff. ChrisA