You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by xecutor <pk...@freemail.hu> on 2008/12/13 22:03:21 UTC

What cause this?

Hi,
I've created some tables with these scripts:
create table FINDER(
    ID             int generated by default as identity,
    NAME        varchar(50) not null,
    TYPE         int,
    RANGE       double,
    DEPTH       double,
    constraint  finder_pk primary key(ID),
    constraint  finder_fk_type foreign key(TYPE) references TYPE(ID)
);
create table FINDER_AMP(
	ID		int generated by default as identity ,
	NAME		varchar(50) not null,
	TYPE		int,
	constraint finder_amp_pk primary key(ID),
	constraint finder_amp_fk_type foreign key(TYPE) references TYPE(ID)
);
create table CLAIM(
	ID		int generated by default as identity ,
	CONTINENT	int,
	X		double,
	Y		double,
	Z		double,
	DEPTH		numeric(5),
	RESOURCE	int,
	TYPE		int,
	AMMOUNT	numeric(10),
	DATE_		timestamp,
	FINDER		int,
	FINDER_AMP	int,
	constraint claim_pk primary key (ID),
	constraint claim_fk_continent foreign key (CONTINENT) references
CONTINENT(ID),
	constraint claim_fk_resource foreign key (RESOURCE) references
RESOURCE(ID),
	constraint claim_fk_type foreign key (TYPE) references TYPE(ID),
	constraint claim_fk_finder foreign key (FINDER) references FINDER(ID),
	constraint claim_fk_finder_amp foreign key (FINDER_AMP) references
FINDER_AMP(ID)
);

and I don't understand what caused this:
http://www.nabble.com/file/p20994381/sd.gif . As you can see there are two
subentries under the "claim_fk_finder" entry. Is it normal?
-- 
View this message in context: http://www.nabble.com/What-cause-this--tp20994381p20994381.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: What cause this?

Posted by xecutor <pk...@freemail.hu>.
Thank you for your help. I think it's just a litle bug in Netbeans and
doesn't have an affect on my work, 'cause I was able to insert into the
CLAIM table without a problem. I'll try to make a contact with Netbeans
support to tell them what i've found.
-- 
View this message in context: http://www.nabble.com/What-cause-this--tp20994381p21001932.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: What cause this?

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> The result of the script you gave me:
> CONSTRAINTNAME	TABLENAME
> ---------------------------------------
> FINDER_FK_TYPE	FINDER
> FINDER_AMP_FK_TYPE	FINDER_AMP
> RESOURCE_FK_TYPE	RESOURCE
> CLAIM_FK_CONTINENT	CLAIM
> CLAIM_FK_RESOURCE	CLAIM
> CLAIM_FK_TYPE		CLAIM
> CLAIM_FK_FINDER	CLAIM
> CLAIM_FK_FINDER_AMP	CLAIM

Each foreign key appears to be listed exactly once, which is good.

> Btw I use the Netbean's 6.5 embedded graphical tool.

Have you asked the Netbeans team about this behavior?
Perhaps they are using a different technique to query the
database for foreign key information?

Do you have any other DDL tools you can query the database
with, to see what foreign key information they display?
Perhaps SQL Squirrel, or DDLUtils, or Eclipse, etc?

thanks,

bryan




Re: What cause this?

Posted by xecutor <pk...@freemail.hu>.
Oh, sorry maybe I should gave you all the scripts of the tables referenced by
the CLAIM table. 
Here are the missing parts:

create table TYPE(
	ID		int generated  by default as identity,
	NAME		varchar(20) not null,
	constraint type_pk primary key(ID)
); 
create table RESOURCE(
	ID		int generated by default as identity ,
	NAME		varchar(50) not null,
	TYPE		int,
	TTVALUE	numeric(3,2),
	constraint resource_pk primary key(ID),
	constraint resource_fk_type foreign key(TYPE) references TYPE(ID)
);
create table CONTINENT(
	ID 		int generated by default as identity ,
	NAME		varchar(20) not null,
	REAL_WIDTH	numeric(5) not null,
	REAL_HEIGHT	numeric(5) not null,
	WIDTH		double not null,
	HEIGHT		double not null,
	SCALE		double,
	DEF_ZOOM	double,
	IMAGE		varchar(255) not null,
	constraint continent_pk primary key (ID)
); 

The result of the script you gave me:
CONSTRAINTNAME	TABLENAME
---------------------------------------
FINDER_FK_TYPE	FINDER
FINDER_AMP_FK_TYPE	FINDER_AMP
RESOURCE_FK_TYPE	RESOURCE
CLAIM_FK_CONTINENT	CLAIM
CLAIM_FK_RESOURCE	CLAIM
CLAIM_FK_TYPE		CLAIM
CLAIM_FK_FINDER	CLAIM
CLAIM_FK_FINDER_AMP	CLAIM

Btw I use the Netbean's 6.5 embedded graphical tool.
-- 
View this message in context: http://www.nabble.com/What-cause-this--tp20994381p20998034.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: What cause this?

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> and I don't understand what caused this:
> http://www.nabble.com/file/p20994381/sd.gif . As you can see there are two
> subentries under the "claim_fk_finder" entry. Is it normal?

What tool produced the display that you showed in that picture?

I tried running your script through Derby's IJ tool, after adding
create table statements for the tables TYPE, RESOURCE, and CONTINENT,
and then I ran:

select ct.constraintname, t.tablename from sys.sysconstraints ct,
sys.sysconglomerates cg, sys.systables t, sys.sysforeignkeys f
where f.constraintid=ct.constraintid and f.conglomerateid=cg.conglomerateid
and cg.tableid=t.tableid;

And I only see one row for CLAIM_FK_FINDER.

It would interesting to know what that SELECT statement produces in
your environment.

thanks,

bryan