[ http://issues.apache.org/jira/browse/DERBY-1854?page=all ]

Suresh Thalamati updated DERBY-1854:
------------------------------------

    Attachment: derby-1854.diff

Problem was all the conglomerate descriptor entries in sys.sysconglomerates
were not getting updated with new conglomerate number generated for an index 
during compress/bulk-insert, when an index is shared. Update code was assuming 
conglomerate id is common when an index is shared, but that is not correct. 
ConglomerateID's in sys.sysconglomerates are unique. 

This patch modifies the update conglomerate descriptor code to update each
conglomerate descriptor separately using conglomerateID as the key, when
there are more than one conglomerate descriptor referring to the same 
conglomerate(conglomerate number). 

It would be great, if some can review the attached patch. 

 
svn stat:
M      java\engine\org\apache\derby\impl\sql\catalog\DataDictionaryImpl.java
M      
java\testing\org\apache\derbyTesting\functionTests\tests\lang\compressTable.sql
M      
java\testing\org\apache\derbyTesting\functionTests\master\compressTable.out


> SYSCS_COMPRESS_TABLE corrupts table with a single column which is both a 
> primary key and a foreign key
> ------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1854
>                 URL: http://issues.apache.org/jira/browse/DERBY-1854
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.1.3.0, 10.1.3.1
>         Environment: Reproduced on Linux, Win2k, and WinXP running JDK 1.4.2.x
>            Reporter: Chad Loder
>         Assigned To: Suresh Thalamati
>            Priority: Critical
>             Fix For: 10.2.2.0
>
>         Attachments: derby-1854.diff
>
>
> Running the following short SQL script from ij will cause an error "ERROR 
> XSAI2: The conglomerate (817) requested does not exist.".  It appears that 
> the SYSCS_COMPRESS_TABLE function corrupts tables that have a single column 
> which is both a primary key and a foreign key.
> connect 'jdbc:derby:/testdb;create=true';
> CREATE TABLE users (
>  user_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
>  user_login VARCHAR(255) NOT NULL,
>  PRIMARY KEY (user_id));
> CREATE TABLE admins (
>  user_id INT NOT NULL,
>  PRIMARY KEY (user_id),
>  CONSTRAINT admin_uid_fk FOREIGN KEY (user_id) REFERENCES users (user_id));
>  
> INSERT INTO users (user_login) VALUES('TEST1');
> INSERT INTO admins VALUES (VALUES IDENTITY_VAL_LOCAL());
> CALL SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP', 'ADMINS', 0);
> SELECT * from admins;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to