Discussion:
Error code -1?
M. A. Sridhar
2005-07-21 18:12:05 UTC
Permalink
I'm running into a strange error with some queries: Mckoi 1.0.2 throws an
"Error -1, error code 1" with no explanation. (I'm running it on IBM Java 1.4
on a Linux box, if that helps.) I can reproduce this problem on a simple
4-table database of suppliers, parts and part types. The query is
automatically generated, and in this case it is attempting to list suppliers,
parts and part types, including suppliers who do not supply any parts. I
would greatly appreciate any help.

Here is the query:

select Supplier.name as atr_0, sq1.col0 as atr_1, sq1.col1 as atr_2
from Supplier
left join (
select Supplier.supplier_id as pk, Part.name as col0, part_type.name
as col1
from Supplier, Link, Part left join part_type on part.part_type =
part_type.part_type_id
where Part.part_id = Link.part and Link.supplier =
Supplier.supplier_id) as sq1
on Supplier.supplier_id = sq1.pk

And here are the four tables in question:


create table Supplier (
supplier_id integer not null,
name varchar(30) not null,
constraint supplier__pk primary key (supplier_id)
);


create table Part (
part_id integer not null,
name varchar(30) not null,
sku varchar(30) not null,
part_type integer not null,
ship_date timestamp,
constraint part__pk primary key (part_id)
);


create table Link (
link_id integer not null,
supplier integer not null,
part integer not null,
constraint link_pk primary key (link_id)
);


alter table Link add constraint sup_fk foreign key (supplier) references
Supplier (supplier_id);
alter table Link add constraint part_fk foreign key (part) references Part
(part_id);

create table Part_type (
part_type_id integer not null,
name varchar(64) not null,
constraint part_typepk primary key (part_type_id)
);

alter table Part add constraint part_type_fk
foreign key (part_type) references Part_type (part_type_id);


Thanks.


M. A. Sridhar


---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com
Tobias Downer
2005-07-28 01:11:27 UTC
Permalink
Hi,

Thanks for the test script. I could reproduce this error on both 1.0.2
and 1.0.3. This error happens because Mckoi incorrectly labels sections
of the query tree on nested outer joins which causes this error. To
work around the problem, you will need to remove the outer join from the
sub-query.

I do have a patch for this problem for 1.0.3. If you need 1.0.2
patched, please email me and I will see what I can do for you.

Toby.
Post by M. A. Sridhar
I'm running into a strange error with some queries: Mckoi 1.0.2 throws an
"Error -1, error code 1" with no explanation. (I'm running it on IBM Java 1.4
on a Linux box, if that helps.) I can reproduce this problem on a simple
4-table database of suppliers, parts and part types. The query is
automatically generated, and in this case it is attempting to list suppliers,
parts and part types, including suppliers who do not supply any parts. I
would greatly appreciate any help.
select Supplier.name as atr_0, sq1.col0 as atr_1, sq1.col1 as atr_2
from Supplier
left join (
select Supplier.supplier_id as pk, Part.name as col0, part_type.name
as col1
from Supplier, Link, Part left join part_type on part.part_type =
part_type.part_type_id
where Part.part_id = Link.part and Link.supplier =
Supplier.supplier_id) as sq1
on Supplier.supplier_id = sq1.pk
create table Supplier (
supplier_id integer not null,
name varchar(30) not null,
constraint supplier__pk primary key (supplier_id)
);
create table Part (
part_id integer not null,
name varchar(30) not null,
sku varchar(30) not null,
part_type integer not null,
ship_date timestamp,
constraint part__pk primary key (part_id)
);
create table Link (
link_id integer not null,
supplier integer not null,
part integer not null,
constraint link_pk primary key (link_id)
);
alter table Link add constraint sup_fk foreign key (supplier) references
Supplier (supplier_id);
alter table Link add constraint part_fk foreign key (part) references Part
(part_id);
create table Part_type (
part_type_id integer not null,
name varchar(64) not null,
constraint part_typepk primary key (part_type_id)
);
alter table Part add constraint part_type_fk
foreign key (part_type) references Part_type (part_type_id);
Thanks.
M. A. Sridhar
---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com
M. A. Sridhar
2005-07-28 01:14:19 UTC
Permalink
Hi Toby,

I'm using and deploying 1.0.2 now. I don't think it would be a big deal to
upgrade to 1.0.3 if you think that would be better. Please advise.

On a related note, are you going to release a new version anytime soon, with
the bug fixes you have put in over the last several months? If so, when?

Thanks and regards.

Sridhar
Post by Tobias Downer
Hi,
Thanks for the test script. I could reproduce this error on both 1.0.2
and 1.0.3. This error happens because Mckoi incorrectly labels sections
of the query tree on nested outer joins which causes this error. To
work around the problem, you will need to remove the outer join from the
sub-query.
I do have a patch for this problem for 1.0.3. If you need 1.0.2
patched, please email me and I will see what I can do for you.
Toby.
Post by M. A. Sridhar
I'm running into a strange error with some queries: Mckoi 1.0.2 throws an
"Error -1, error code 1" with no explanation. (I'm running it on IBM Java
1.4
Post by M. A. Sridhar
on a Linux box, if that helps.) I can reproduce this problem on a simple
4-table database of suppliers, parts and part types. The query is
automatically generated, and in this case it is attempting to list
suppliers,
Post by M. A. Sridhar
parts and part types, including suppliers who do not supply any parts. I
would greatly appreciate any help.
select Supplier.name as atr_0, sq1.col0 as atr_1, sq1.col1 as atr_2
from Supplier
left join (
select Supplier.supplier_id as pk, Part.name as col0,
part_type.name
Post by M. A. Sridhar
as col1
from Supplier, Link, Part left join part_type on part.part_type
=
Post by M. A. Sridhar
part_type.part_type_id
where Part.part_id = Link.part and Link.supplier =
Supplier.supplier_id) as sq1
on Supplier.supplier_id = sq1.pk
create table Supplier (
supplier_id integer not null,
name varchar(30) not null,
constraint supplier__pk primary key (supplier_id)
);
create table Part (
part_id integer not null,
name varchar(30) not null,
sku varchar(30) not null,
part_type integer not null,
ship_date timestamp,
constraint part__pk primary key (part_id)
);
create table Link (
link_id integer not null,
supplier integer not null,
part integer not null,
constraint link_pk primary key (link_id)
);
alter table Link add constraint sup_fk foreign key (supplier) references
Supplier (supplier_id);
alter table Link add constraint part_fk foreign key (part) references
Part
Post by M. A. Sridhar
(part_id);
create table Part_type (
part_type_id integer not null,
name varchar(64) not null,
constraint part_typepk primary key (part_type_id)
);
alter table Part add constraint part_type_fk
foreign key (part_type) references Part_type (part_type_id);
Thanks.
M. A. Sridhar
---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com

Loading...