[
https://issues.apache.org/jira/browse/SQOOP-2443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14692792#comment-14692792
]
Jarek Jarcec Cecho commented on SQOOP-2443:
-------------------------------------------
While working on this patch, I've noticed that the current behavior is actually
severy broken in two ways:
* The current function returns first column when we sort all PK columns by
their name. This might not be the first column of the primary key which means
that we might not be able to do fast lookups if the first column of PK is not
alphabetically the first.
* In case that table with the same name exists in multiple schemas or catalogs
(JDBC jargon), then we will return primary key from one of the tables (depends
on undefined order returned by the call {{getPrimaryKeys}}. E.g. identified
primary key column might not even exists in transferred table.
> Sqoop2: Generic JDBC: Properly detect compound primary keys in
> GenericJdbcExecutor
> ----------------------------------------------------------------------------------
>
> Key: SQOOP-2443
> URL: https://issues.apache.org/jira/browse/SQOOP-2443
> Project: Sqoop
> Issue Type: Sub-task
> Reporter: Jarek Jarcec Cecho
> Assignee: Jarek Jarcec Cecho
> Fix For: 1.99.7
>
>
> [GenericJdbcExecutor.getPrimaryKey|https://github.com/apache/sqoop/blob/sqoop2/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java#L195]
> currently returns the first column of the primary key. This works well if
> the table have one single column as PK, but won't work correctly when the
> table have compound key. I would like to return entire PK here and let the
> user of this method decides what to do (report error or use one of the
> columns of the key).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)