Re: [sqlite] referential integrity, and necessity of a primary key on the one side

2010-12-11 Thread TP
Kees Nuyt wrote: > It is by design. At the bottom of > http://www.sqlite.org/lang_createtable.html > it says: > The parent key of a foreign key constraint is not allowed to use the > rowid. The parent key must used named columns only. > > This means you have to alias the rowid to be able to refer

Re: [sqlite] referential integrity, and necessity of a primary key on the one side

2010-12-11 Thread Kees Nuyt
On Sat, 11 Dec 2010 12:39:39 +0100, TP wrote: >Hello, > >I have a question about referential integrity when there is no explicitly >defined primary key in the table on the one side. Look at this example: > >-- >PRAGMA foreign_keys = ON; > >CREATE TABLE foo( bar ); >INSERT

[sqlite] referential integrity, and necessity of a primary key on the one side

2010-12-11 Thread TP
Hello, I have a question about referential integrity when there is no explicitly defined primary key in the table on the one side. Look at this example: -- PRAGMA foreign_keys = ON; CREATE TABLE foo( bar ); INSERT INTO foo values( "bar1" ); CREATE TABLE fox( dog , fo

Re: [sqlite] Referential integrity based on a view.

2010-09-30 Thread Dan Kennedy
On Sep 30, 2010, at 3:30 PM, Muthuveerappan Alagappan wrote: > Hi > > I am a newbie to sqlite, I am having difficulty in trying to > build > referential integrity based on a view. > > sqlite allows me to create referential integrity based on a > view

Re: [sqlite] Referential integrity based on a view.

2010-09-30 Thread Muthuveerappan Alagappan
Thanks a lot!! Is there any proposal to build this feature (referential integrity on a view)? On Sep 30, 2010, at 19:58, "Igor Tandetnik" wrote: > Muthuveerappan Alagappan wrote: >> sqlite allows me to create referential integrity based on a view ( vu_cars ) > > This looks like a bug. I'm p

Re: [sqlite] Referential integrity based on a view.

2010-09-30 Thread Igor Tandetnik
Muthuveerappan Alagappan wrote: > sqlite allows me to create referential integrity based on a view ( vu_cars ) This looks like a bug. I'm pretty sure referencing a view in a foreigh key is not supposed to work. -- Igor Tandetnik ___ sqlite-users mail

[sqlite] Referential integrity based on a view.

2010-09-30 Thread Muthuveerappan Alagappan
Hi I am a newbie to sqlite, I am having difficulty in trying to build referential integrity based on a view. sqlite allows me to create referential integrity based on a view ( vu_cars ), however it doesn't allow me to insert any records into the

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-07 Thread Kees Nuyt
On Mon, 6 Jul 2009 16:53:35 -0500, Nicolas Williams wrote: >On Sat, Jul 04, 2009 at 10:24:50AM +0200, Kees Nuyt wrote: >> On Fri, 03 Jul 2009 14:38:43 -0700, James Gregurich >> wrote: >> >> > >> >nuts. that makes INSERT OR REPLACE worthless if you have tables >> >dependent on one another. >>

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-06 Thread James Gregurich
based on the test I just ran, it reports the first one encountered only. On Jul 6, 2009, at 2:53 PM, Nicolas Williams wrote: > On Sat, Jul 04, 2009 at 10:24:50AM +0200, Kees Nuyt wrote: >> On Fri, 03 Jul 2009 14:38:43 -0700, James Gregurich >> wrote: >> >>> >>> nuts. that makes INSERT OR REPLAC

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-06 Thread Nicolas Williams
On Sat, Jul 04, 2009 at 10:24:50AM +0200, Kees Nuyt wrote: > On Fri, 03 Jul 2009 14:38:43 -0700, James Gregurich > wrote: > > > > >nuts. that makes INSERT OR REPLACE worthless if you have tables > >dependent on one another. > > > > > >Is there any way to manually get a list of records for which

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-04 Thread Kees Nuyt
On Fri, 03 Jul 2009 14:38:43 -0700, James Gregurich wrote: > >nuts. that makes INSERT OR REPLACE worthless if you have tables >dependent on one another. > > >Is there any way to manually get a list of records for which there >would be a conflict if a given record was inserted? BEGIN; INSERT

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-03 Thread James Gregurich
nuts. that makes INSERT OR REPLACE worthless if you have tables dependent on one another. Is there any way to manually get a list of records for which there would be a conflict if a given record was inserted? > On Fri, 03 Jul 2009 11:29:14 -0700, James Gregurich > wrote: > > > > >based on

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-03 Thread Kees Nuyt
On Fri, 03 Jul 2009 11:29:14 -0700, James Gregurich wrote: > >based on my reading of the docs for INSERT OR REPLACE, it will delete >rows for ANY constraint violation, not just one involving the primary >key. Is that reading wrong? You are right, for UNIQUE constraint violations. Indeed it

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-03 Thread James Gregurich
I read on another posting in the archives that it does not. However, I haven't tried it myself. -James > Simon Slavin > Fri, 03 Jul 2009 09:44:22 -0700 > > On 3 Jul 2009, at 3:28am, James Gregurich wrote: > > > How do I maintain referential integrity on a INSERT OR REPLACE given > > it does no

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-03 Thread James Gregurich
based on my reading of the docs for INSERT OR REPLACE, it will delete rows for ANY constraint violation, not just one involving the primary key. Is that reading wrong? -James > On Thu, 02 Jul 2009 19:28:17 -0700, James Gregurich > wrote: > > > > >question: > > > >How do I maintain referent

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-03 Thread Simon Slavin
On 3 Jul 2009, at 3:28am, James Gregurich wrote: > How do I maintain referential integrity on a INSERT OR REPLACE given > it does not call the delete trigger on the offending rows? If SQLite decides that it's going to do a REPLACE rather than an INSERT, does it call the triggers for UPDATE ?

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-03 Thread Kees Nuyt
On Thu, 02 Jul 2009 19:28:17 -0700, James Gregurich wrote: > >question: > >How do I maintain referential integrity on a INSERT OR REPLACE given >it does not call the delete trigger on the offending rows? Please correct me if I'm wrong, but considering the two cases INSERT OR REPLACE handles fo

[sqlite] referential integrity and INSERT OR REPLACE

2009-07-03 Thread James Gregurich
question: How do I maintain referential integrity on a INSERT OR REPLACE given it does not call the delete trigger on the offending rows? thanks, james ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listi

[sqlite] REFERENTIAL INTEGRITY

2009-02-09 Thread Wladjmir Godioz
how can i import data in sqlite3 preserving referential integrity? if i create fields that is not autoincremented, after the import, i can't modify that field to primary key autoincrement, since alter table modify column is not supported. thanks for any help ___