[jira] [Comment Edited] (IGNITE-9606) JDBC getPrimaryKeys() returns wrong value for COLUMN_NAME

2018-10-05 Thread Pavel Kuznetsov (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-9606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16640292#comment-16640292
 ] 

Pavel Kuznetsov edited comment on IGNITE-9606 at 10/5/18 8:07 PM:
--

There were  a bug with incorrect validation. Fixed that (looks as workaround 
for me): 
https://github.com/apache/ignite/pull/4906/commits/d350c5f3ab45849f608b6bab2335d33a84f78078
Failed test : https://ci.ignite.apache.org/viewLog.html?buildId=1999089;
(IgniteCacheAtomicFieldsQuerySelfTest.testExecuteWithMetaDataAndCustomKeyPrecision)

New test run on teamcity 
https://ci.ignite.apache.org/viewQueued.html?itemId=2015843




was (Author: pkouznet):
There were  a bug with incorrect validation. Fixed that (looks as workaround 
for me): 
https://github.com/apache/ignite/pull/4906/commits/d350c5f3ab45849f608b6bab2335d33a84f78078
Failed test : https://ci.ignite.apache.org/viewLog.html?buildId=1999089;

New test run on teamcity 
https://ci.ignite.apache.org/viewQueued.html?itemId=2015843



> JDBC getPrimaryKeys() returns wrong value for COLUMN_NAME
> -
>
> Key: IGNITE-9606
> URL: https://issues.apache.org/jira/browse/IGNITE-9606
> Project: Ignite
>  Issue Type: Bug
>  Components: jdbc
>Affects Versions: 2.6
>Reporter: Pat Patterson
>Assignee: Pavel Kuznetsov
>Priority: Major
> Fix For: 2.8
>
>
> JDBC {{getPrimaryKeys()}} method returns {{_KEY}} as column name rather than 
> actual column name. This breaks apps that expect a valid column name as the 
> primary key.
> Trivially reproducible:
> {noformat}
>   public static void main(String[] args) throws Exception {
> // Register JDBC driver.
> Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
> // Open JDBC connection.
> try (Connection conn = 
> DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1/")) {
>   // Create database tables.
>   try (Statement stmt = conn.createStatement()) {
> stmt.executeUpdate("CREATE TABLE TESTER (" + " ID LONG PRIMARY KEY, 
> NAME VARCHAR) " + " WITH \"template=replicated\"");
>   }
>   // Get database metadata
>   DatabaseMetaData md = conn.getMetaData();
>   // Get primary keys
>   ResultSet rs = md.getPrimaryKeys(conn.getCatalog(), "", "TESTER");
>   //
>   while (rs.next()) {
> // Column 4 is COLUMN_NAME
> System.out.println("Primary key column is " + rs.getString(4));
>   }
> }
>   }
> {noformat}
> Expected output is:
> {noformat}
> Primary key column is ID
> {noformat}
> Actual output is:
> {noformat}
> Primary key column is _KEY
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (IGNITE-9606) JDBC getPrimaryKeys() returns wrong value for COLUMN_NAME

2018-10-03 Thread Pavel Kuznetsov (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-9606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16636941#comment-16636941
 ] 

Pavel Kuznetsov edited comment on IGNITE-9606 at 10/3/18 1:24 PM:
--

I've written test that reproduced the bug, have fixed existing one and have 
done prelementary fix.
https://github.com/apache/ignite/pull/4906/

[~tledkov-gridgain] Could you please take a look at the patch?


was (Author: pkouznet):
I've written test that reproduced the bug, have fixed existing one and have 
done prelementary fix.
https://github.com/apache/ignite/pull/4906/

[~tledkov-gridgain]

> JDBC getPrimaryKeys() returns wrong value for COLUMN_NAME
> -
>
> Key: IGNITE-9606
> URL: https://issues.apache.org/jira/browse/IGNITE-9606
> Project: Ignite
>  Issue Type: Bug
>  Components: jdbc
>Affects Versions: 2.6
>Reporter: Pat Patterson
>Assignee: Pavel Kuznetsov
>Priority: Major
> Fix For: 2.8
>
>
> JDBC {{getPrimaryKeys()}} method returns {{_KEY}} as column name rather than 
> actual column name. This breaks apps that expect a valid column name as the 
> primary key.
> Trivially reproducible:
> {noformat}
>   public static void main(String[] args) throws Exception {
> // Register JDBC driver.
> Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
> // Open JDBC connection.
> try (Connection conn = 
> DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1/")) {
>   // Create database tables.
>   try (Statement stmt = conn.createStatement()) {
> stmt.executeUpdate("CREATE TABLE TESTER (" + " ID LONG PRIMARY KEY, 
> NAME VARCHAR) " + " WITH \"template=replicated\"");
>   }
>   // Get database metadata
>   DatabaseMetaData md = conn.getMetaData();
>   // Get primary keys
>   ResultSet rs = md.getPrimaryKeys(conn.getCatalog(), "", "TESTER");
>   //
>   while (rs.next()) {
> // Column 4 is COLUMN_NAME
> System.out.println("Primary key column is " + rs.getString(4));
>   }
> }
>   }
> {noformat}
> Expected output is:
> {noformat}
> Primary key column is ID
> {noformat}
> Actual output is:
> {noformat}
> Primary key column is _KEY
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)