Use Unique Index where possible, if a table does not have a PK defined
----------------------------------------------------------------------

                 Key: GEOT-2560
                 URL: http://jira.codehaus.org/browse/GEOT-2560
             Project: GeoTools
          Issue Type: Improvement
          Components: data jdbc-ng
            Reporter: Russell Petty
         Attachments: JDBCDataStore.patch

>From issue GEOT-2101: JDBCDataStore cannot handle tables without primary keys:

----------------------------------------------------------------------------------------------------------------------------
Russell Petty added a comment - 15/Jun/09 09:49 PM
I have an issue where the table does not have a primary key, but has a unique 
index defined instead. We want to use the unique key as if it was the primary 
key.

Unfortunately the table is not under our control. We can not alter the table to 
add a PK, or create a view and point to this. The table was created by SDE, 
which doesn't seem to like using PKs, only unique indexes.

Would it be possible to add this functionality?

----------------------------------------------------------------------------------------------------------------------------
Andrea Aime added a comment - 16/Jun/09 01:35 AM
Actually at the moment the JDBCDataSTore can handle views all right, this issue 
should be closed.
The problem is that feature ids will be pulled out of thin air, instead of 
being linked to a database column.

We could add a strategy to fall back on a unique index, but mind, when doing 
so, that column will be hidden (pk columns are turned into the feature id and 
removed from the standard attributes).

----------------------------------------------------------------------------------------------------------------------------
Russell Petty added a comment - 16/Jun/09 07:50 PM
Hi Andrea,
I am well aware of the fact that the column would be 'hidden', just like what 
happens for primary keys. However, at least in our case the unique index IS for 
all purposes a PK. So this is what we want.

Do you want me to raise a new Jira issue over this? Do you require more details 
beyond what I have stated?

----------------------------------------------------------------------------------------------------------------------------
Andrea Aime added a comment - 17/Jun/09 02:29 AM
Russel, yeah, a separate jira would be better, what you're requesting is a new 
feature which is related to this one, but not the same (this one is about not 
failing when there is no pk whatsoever).

Also, any chance you can provide a patch and testcase to handle the unique 
index case?

----------------------------------------------------------------------------------------------------------------------------



Hi Andrea,
Please find a patch attached.

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

        

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to