There are a number of code paths in the server that use the
"bait/switch" method.  Off the top of my head: some alter table
modify column paths, maybe drop column, bulk load to an empty table.
Were these also broken for this problem?  Is the code to do the
syscat update shared, and thus this fixes all of them?  Probably
worth adding some test cases.

Mamta A. Satoor (JIRA) wrote:
[ http://issues.apache.org/jira/browse/DERBY-1854?page=comments#action_12436636 ] Mamta A. Satoor commented on DERBY-1854:
----------------------------------------

I did a quick review of the patch and the changes look good to me. DERBY-655 
made changes such that duplicate indexes will have their own unique 
conglomerateIDs but  there were other places in the code which relied on 
duplicate conglomerateIDs for duplicate indexes. I give a +1 to this patch.


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.1.0, 10.3.0.0

       Attachments: derby-1854-andrew-10.1.diff, 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;



Reply via email to