[Monetdb-developers] Constraint violations with all details
Hi, I cannot find it back in the trackers but I think it have asked this question before. Would it be possible to output the actual failing constraint details instead of 'just an error'. sql>alter table relation_members_way add constraint relation_to_way_fkey foreign key(to_way) references ways; !SQLException:assert:INSERT INTO: FOREIGN KEY constraint 'relation_members_way.relation_to_way_fkey' violated Inserting with INSERTS will give a nice error, because the query it self contains the problem. This is not true for a copy into, or in this respect just an alter table. Stefan ps. indeed I have to think too long about a query that will show me the non existing primary keys.
Something like this might work... Select to_way from relation_members_way where to_way not in (select to_way from ways); Romulo Stefan de Konink wrote:
Hi,
I cannot find it back in the trackers but I think it have asked this question before.
Would it be possible to output the actual failing constraint details instead of 'just an error'.
sql>alter table relation_members_way add constraint relation_to_way_fkey foreign key(to_way) references ways; !SQLException:assert:INSERT INTO: FOREIGN KEY constraint 'relation_members_way.relation_to_way_fkey' violated
Inserting with INSERTS will give a nice error, because the query it self contains the problem. This is not true for a copy into, or in this respect just an alter table.
Stefan
ps. indeed I have to think too long about a query that will show me the non existing primary keys.
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-developers mailing list Monetdb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
Romulo Goncalves wrote:
Something like this might work...
Select to_way from relation_members_way where to_way not in (select to_way from ways);
Wow :) Yup that works with a slight modification too :) Select distinct relation from relation_members_way where to_way not in (select id from ways); I used: select distinct relation_members_way.relation as relation from relation_members_way left join ways on relation_members_way.to_way = ways.id where ways.id is NULL; Now it does get interesting :) because my query takes half of the time than yours. 537ms vs 1095ms. I have attached both traces :) Stefan http://kinkrsoftware.nl/contrib/monetdb/romulo.txt http://kinkrsoftware.nl/contrib/monetdb/stefan.txt
participants (2)
-
Romulo Goncalves
-
Stefan de Konink