[Monetdb-developers] BUG in MonetDB V4.8.2 for windows

Fabian Fabian.Groffen at cwi.nl
Wed Oct 5 21:13:53 CEST 2005


Romulo Gonçalves wrote:
> This email is to report a bug in MonetDB V4.8.2 for windows.
> 
> My name is Rómulo Gonçalves, number 0536601.
> 
> 
> When I try to create a table with multiply primary key with the 
> following code (SQL99) :
> 
> CREATE TABLE URLS (
>        ID_URL int,
>        ID_Division int,
>        PRIMARY KEY (ID_URL, ID_Division)
> );
> 
> ALTER Table URLs ADD foreign key(ID_Division) references 
> URL_Division(ID_Division);
> 
> I receive the following error:
> 
> "[MonetDB][ODBC Driver 1.0]! Could not find referenced primary key in 
> table urls"

Of course this is correct, because there doesn't exist a primary key on 
column "ID_Division" in table URLS.  The PK of URLS is (ID_URL, ID_Division)

> Then I tried with the following code:
> 
> CREATE TABLE URLS (
> ID_URL int,
> ID_Division int,
> primary key(ID_URL),
> primary key(ID_Division)
> );
> 
> And no error happen when I create the table. Here is the bug.

This is indeed a bug, because a table can only have one primary key.

> The MonetDB accept that we insert more than one key and then it accepts 
> the first (in this case ID_URL) as a primary key.
> 
> But there is another bug. I can not create relational tables because I 
> need to have a multiply primary key, in this case one tuplo 
> (ID_URL,ID-Division) and for this I need to have the possibility to do 
> like the following example:
> 
> CREATE TABLE URLS (
>        ID_URL int,
>        ID_Division int,
>       * PRIMARY KEY (ID_URL, ID_Division) -> MonetDB not accept this way 
> to define multiple primary key.*
> );

Works for me:

monetdb-> CREATE TABLE URLS (
monetdb=(  ID_URL int,
monetdb=(  ID_Division int,
monetdb=(  PRIMARY KEY (ID_URL, ID_Division)
monetdb=( );
Operation successful

monetdb-> \d urls
CREATE TABLE "sys"."urls" (
         "id_url"      int       NOT NULL,
         "id_division" int       NOT NULL,
         CONSTRAINT "urls_id_url_id_division_pkey" PRIMARY KEY 
("id_division", "id_url")
);

(spot the just found bug here :) )

> Maybe the report is not a perfect report because is the first time that 
> I report bugs of one System. I hope that you understand the two bugs of 
> MonetDB that I found, if there is something that you do not understand, 
> please contact me.

We actually like bugs being reported on our sourceforge bug page: 
http://sourceforge.net/tracker/?group_id=56967&atid=482468




More information about the developers-list mailing list