Re: [sqlite] Foreign Key errors

2014-05-09 Thread phaworth
After looking into error messages further, I see that the constraint name is not included in NOT NULL or UNIQUE constraint errors although it is there in CHECK constraint errors. The table.column that caused the error is in the messages so it is possible to identify which column caused the error.

Re: [sqlite] Foreign Key errors

2014-05-08 Thread Constantine Yannakopoulos
On Thu, May 8, 2014 at 10:52 PM, Walter Hurry wrote: > On Thu, 08 May 2014 13:15:54 +0300, Constantine Yannakopoulos wrote: > most if not all other databases do not implement this > > $ psql > psql (9.3.4) > Type "help" for help. > ​​ > > ​I meant that they do not implement a way to *directly* g

Re: [sqlite] Foreign Key errors

2014-05-08 Thread Walter Hurry
On Thu, 08 May 2014 13:15:54 +0300, Constantine Yannakopoulos wrote: most if not all other databases do not implement this $ psql psql (9.3.4) Type "help" for help. misc=# create table parent misc-# (a_id varchar(1), misc(# constraint pk_parent primary key(a_id)); CREATE TABLE misc=# create tab

Re: [sqlite] Foreign Key errors

2014-05-08 Thread Constantine Yannakopoulos
On Thu, May 8, 2014 at 1:08 PM, Simon Slavin wrote: > Perhaps a future version of sqlite3_extended_result_codes() can return a > string as well as the code, the string being the name of the constraint > that was violated. > Yes, it would be great to be able to get the necessary info in a structu

Re: [sqlite] Foreign Key errors

2014-05-08 Thread Simon Slavin
On 8 May 2014, at 10:40am, Constantine Yannakopoulos wrote: > On Thu, May 8, 2014 at 11:50 AM, Simon Slavin wrote: > >> That's your job. You're the programmer. SQLite does not talk to users >> and its result values should never be shown to a user. > > ​Fair enough, but SQLite needs to give

Re: [sqlite] Foreign Key errors

2014-05-08 Thread Constantine Yannakopoulos
On Thu, May 8, 2014 at 11:50 AM, Simon Slavin wrote: > That's your job. You're the programmer. SQLite does not talk to users > and its result values should never be shown to a user. > ​Fair enough, but SQLite needs to give me what I need to be able to communicate something helpful to the user.

Re: [sqlite] Foreign Key errors

2014-05-08 Thread Simon Slavin
On 8 May 2014, at 9:00am, Constantine Yannakopoulos wrote: > When the fk violation occurs inside a large transaction, > e.g. during a bulk data import it is essential that the user is given any > possible help to be able to locate the data that violates ref integrity and > fix it. That's your

Re: [sqlite] Foreign Key errors

2014-05-08 Thread Constantine Yannakopoulos
On May 8, 2014 4:39 AM, "phaworth" wrote: > > I'd vote for having this as a future enhancement under the control of a > pragma or some other way of making it optional. Some of my tables have more > than 1 foreign key and without the constraint name I have to write > application code to pre-check

Re: [sqlite] Foreign Key errors

2014-05-07 Thread phaworth
I'd vote for having this as a future enhancement under the control of a pragma or some other way of making it optional. Some of my tables have more than 1 foreign key and without the constraint name I have to write application code to pre-check for foreign key errors since I can't translate the er

Re: [sqlite] Foreign Key errors

2014-05-07 Thread Dominique Devienne
On Tue, May 6, 2014 at 11:17 PM, Richard Hipp wrote: > On Tue, May 6, 2014 at 5:12 PM, Peter Haworth wrote: >> It seems that foreign key errors on columns where the foreign key >> definition has a constraint name don't include the constraint name in the >> error message. This is using sqlite ver

Re: [sqlite] Foreign Key errors

2014-05-06 Thread Stephan Beal
On Tue, May 6, 2014 at 11:24 PM, Petite Abeille wrote: > On May 6, 2014, at 11:17 PM, Richard Hipp wrote: > > > It is theoretically possible to keep track of which constraints are > failing > > so that the particular constraint can be identified in the error message. > > But that woudl require mo

Re: [sqlite] Foreign Key errors

2014-05-06 Thread Petite Abeille
On May 6, 2014, at 11:17 PM, Richard Hipp wrote: > It is theoretically possible to keep track of which constraints are failing > so that the particular constraint can be identified in the error message. > But that woudl require more memory and CPU cycles. That would be resources well spent. _

Re: [sqlite] Foreign Key errors

2014-05-06 Thread Richard Hipp
On Tue, May 6, 2014 at 5:12 PM, Peter Haworth wrote: > It seems that foreign key errors on columns where the foreign key > definition has a constraint name don't include the constraint name in the > error message. This is using sqlite version 3.8.3.1. > > Is this under the control of a compile s

[sqlite] Foreign Key errors

2014-05-06 Thread Peter Haworth
It seems that foreign key errors on columns where the foreign key definition has a constraint name don't include the constraint name in the error message. This is using sqlite version 3.8.3.1. Is this under the control of a compile switch or PRAGMA or am I stuck with the way it is? Pete