M. A. Sridhar
2005-07-21 18:12:05 UTC
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
"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